X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Ftinyptc%2Ftest.c;fp=bigscreen%2Ftinyptc%2Ftest.c;h=cc6ccafbf6529704a2bf60083c7d790ca1a4e3bf;hp=0000000000000000000000000000000000000000;hb=140a0aae7299d15459fe9ec74ad5020887e0a960;hpb=fd56777b1051147ba14850b72f1f959cd82a1827 diff --git a/bigscreen/tinyptc/test.c b/bigscreen/tinyptc/test.c new file mode 100644 index 0000000..cc6ccaf --- /dev/null +++ b/bigscreen/tinyptc/test.c @@ -0,0 +1,67 @@ +/* + * TinyPTC x11 v0.7.3 Example file + * Copyright (C) 2001-2002 Alessandro Gatti + * Copyright (C) 2000-2001 Glenn Fiedler + * + * http://www.sourceforge.net/projects/tinyptc/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "tinyptc.h" + +#include + +#define WIDTH 320 +#define HEIGHT 200 +#define SIZE WIDTH*HEIGHT + +static int noise; +static int carry; +static int counter; +static int seed = 0x12345; +static int pixel[SIZE]; + +void +ptc_cleanup_callback (void) +{ + fprintf (stderr, "Callback!\n"); +} + +int +main () +{ + if (!ptc_open ("test", WIDTH, HEIGHT)) + return 1; + for (;;) + { + for (counter = 0; counter < SIZE; counter++) + { + noise = seed; + noise >>= 3; + noise ^= seed; + carry = noise & 1; + noise >>= 1; + seed >>= 1; + seed |= (carry << 30); + noise &= 0xFF; + pixel[counter] = (noise << 16) | (noise << 8) | noise; + } + ptc_update (pixel); + } + ptc_close (); + return 0; +}