]> git.hungrycats.org Git - xscreensaver/blobdiff - hacks/analogtv.h
From https://www.jwz.org/xscreensaver/xscreensaver-6.09.tar.gz
[xscreensaver] / hacks / analogtv.h
index ed3ce340bb184362b3da02f433fef405daa227f4..474a7f8d419677be0a32ae6f73cccb0db8a93a31 100644 (file)
@@ -1,4 +1,4 @@
-/* analogtv, Copyright (c) 2003-2016 Trevor Blackwell <tlb@tlb.org>
+/* analogtv, Copyright (c) 2003-2018 Trevor Blackwell <tlb@tlb.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 #include "thread_util.h"
 #include "xshm.h"
 
-#if defined(USE_IPHONE) || defined(HAVE_ANDROID)
+#if defined(HAVE_IPHONE) || defined(HAVE_ANDROID)
 # define HAVE_MOBILE
 #endif
 
+/* To simulate an NTSC CRT monitor with way more scanlines, and thus
+   apply an ahistorical tv-like effect to a larger image, increase
+   this resolution multiplier.
+ */
+#ifndef ANALOGTV_SCALE
+# define ANALOGTV_SCALE 1
+#endif
+
 /*
   You'll need these to generate standard NTSC TV signals
  */
 enum {
   /* We don't handle interlace here */
-  ANALOGTV_V=262,
-  ANALOGTV_TOP=30,
-  ANALOGTV_VISLINES=200,
+  ANALOGTV_V=262*ANALOGTV_SCALE,
+  ANALOGTV_TOP=30*ANALOGTV_SCALE,
+  ANALOGTV_VISLINES=200*ANALOGTV_SCALE,
   ANALOGTV_BOT=ANALOGTV_TOP + ANALOGTV_VISLINES,
 
   /* This really defines our sampling rate, 4x the colorburst
      frequency. Handily equal to the Apple II's dot clock.
      You could also make a case for using 3x the colorburst freq,
      but 4x isn't hard to deal with. */
-  ANALOGTV_H=912,
+  ANALOGTV_H=912*ANALOGTV_SCALE,
 
   /* Each line is 63500 nS long. The sync pulse is 4700 nS long, etc.
      Define sync, back porch, colorburst, picture, and front porch
@@ -54,7 +62,7 @@ enum {
   ANALOGTV_VIS_END=ANALOGTV_PIC_START + (ANALOGTV_PIC_LEN*7/8),
   ANALOGTV_VIS_LEN=ANALOGTV_VIS_END-ANALOGTV_VIS_START,
 
-  ANALOGTV_HASHNOISE_LEN=6,
+  ANALOGTV_HASHNOISE_LEN=6*ANALOGTV_SCALE,
 
   ANALOGTV_GHOSTFIR_LEN=4,
 
@@ -252,7 +260,9 @@ void analogtv_setup_sync(analogtv_input *input, int do_cb, int do_ssavi);
 void analogtv_draw(analogtv *it, double noiselevel,
                    const analogtv_reception *const *recs, unsigned rec_count);
 
-int analogtv_load_ximage(analogtv *it, analogtv_input *input, XImage *pic_im);
+int analogtv_load_ximage(analogtv *it, analogtv_input *input,
+                         XImage *pic_im, XImage *mask_im,
+                         int xoff, int yoff, int width, int height);
 
 void analogtv_reception_update(analogtv_reception *inp);
 
@@ -285,8 +295,6 @@ void analogtv_draw_string(analogtv_input *input, analogtv_font *f,
                           char *s, int x, int y, int ntsc[4]);
 void analogtv_draw_string_centered(analogtv_input *input, analogtv_font *f,
                                    char *s, int x, int y, int ntsc[4]);
-void analogtv_draw_xpm(analogtv *tv, analogtv_input *input,
-                       const char * const *xpm, int left, int top);
 
 int analogtv_handle_events (analogtv *it);
 
@@ -305,6 +313,15 @@ int analogtv_handle_events (analogtv *it);
 # define ANALOGTV_DEF_CONTRAST "400"
 #endif
 
+/* Brightness: useful range is around -75 to 100.
+   Contrast:   useful range is around 0 - 500.
+   Color:      useful range is around +/- 500.
+   Tint:       range is mod 360.
+
+   The values in the 'analogtv' struct are the resource divided by 100.0,
+   except for tint, which is exact.
+ */
+
 #define ANALOGTV_DEFAULTS \
   "*TVColor:         70", \
   "*TVTint:          5",  \
@@ -314,6 +331,7 @@ int analogtv_handle_events (analogtv *it);
   "*use_cmap:        0",  \
   "*geometry:       800x600", \
   "*fpsSolid:       True", \
+  "*lowrez:         True", \
   THREAD_DEFAULTS \
   ANALOGTV_DEFAULTS_SHM