Example #1
0
static int
getgifpix(			/* get a single pixel from our picture */
	int  x,
	int  y
)
{
	getrow(y);
	if (greyscale)
		return((normbright(scanln[x])*ncolors)>>8);
	if (pixscan != NULL)
		return(pixscan[x]);
	return(samplefac ? neu_map_pixel(scanln[x]) : map_pixel(scanln[x]));
}
Example #2
0
void star_move(star_t* st) {
	int x, y, z;
	z = (st->z -= 1);
	x = (st->x / z) + 128;
	y = (st->y / z) + 96;
	if (z < 1|| x < 0 || x >= MODE2_WIDTH || y < 0 || y >= MODE2_HEIGHT) {
		star_randomize(st);
		z = st->z;
		x = (st->x / z) + 128;
		y = (st->y / z) + 96;
	}
	st->last = st->addr;
	st->addr = map_pixel(x, y);
	st->sub  = map_subpixel(x);
}
Example #3
0
File: pinhole.c Project: dpithon/cg
/**
 * sampling_center - shoot ray from center of sampling surface.
 *
 * px:   pixel x coordinate
 * py:   pixel y coordinate
 */
static void sampling_center(int px, int py)
{
	struct ray ray;
	struct coord center;
	struct ipoint i;
	struct rgb rgb;

	ray.s = point_o;

	map_pixel(&center, px, py);
	center.x += sqr_edge / 2.;
	center.y += sqr_edge / 2.;

	unit_vector(&ray.v, &center, &point_o);
	reset_ipoint(&i);
	if (intersect(&i, &ray)) {
		render(&rgb, &i);
		set_pixel(px, py, &rgb);
	} else {
		set_pixel(px, py, 0);
	}
}
Example #4
0
void pset(int x, int y) {
	vmerge(map_pixel(x,y), map_subpixel(x));
}