- A C library for programming cognitive experiments on Windows
/* __ / /_______________ ____ ___ / __/ ___/ ___/ __ \/ __ \/ _ \ / /_(__ ) /__/ /_/ / /_/ / __/ \__/____/\___/\____/ .___/\___/ /_/ draw3.c using getpixel/putpixel */ #include <tscope.h> int main() { // put some pixels on random positions on the screen float x, y; int i, j; for (i = 0; i < 20000; i++) { // x and y values: random from a normal distribution x = ax(ts_rnorm(0, .5)); y = ay(ts_rnorm(0, .2)); ts_putpixel(x, y); } ts_button(XMAX - 20, -YMAX + 20); // change the white pixels to red ts_fgcolor(RED); int color; for (i = -XMAX; i < XMAX; i++) for (j = -YMAX; j < YMAX; j++) { color = ts_getpixel(i, j); if (color == WHITE) ts_putpixel(i, j); } ts_button(XMAX - 20, -YMAX + 20); return 0; } END_OF_MAIN();