コード例 #1
0
ファイル: pix_rds.cpp プロジェクト: kmatheussen/libpd
/////////////////////////////////////////////////////////
// processRGBAImage
//
/////////////////////////////////////////////////////////
void pix_rds :: processRGBAImage(imageStruct &image)
{
    int x, y, i;
    unsigned int *target;
    unsigned int *src = (unsigned int*)image.data;
    unsigned int *dest;
    unsigned int v;
    unsigned int R, G, B;

    myImage.xsize = image.xsize;
    myImage.ysize = image.ysize;
    myImage.setCsizeByFormat(image.format);
    myImage.upsidedown = image.upsidedown;
    myImage.reallocate();

    dest = (unsigned int*)myImage.data;

    memset(dest, 0, image.xsize * image.ysize * image.csize);
    target = dest;

    if(method) {
        for(y=0; y<image.ysize; y++) {
            for(i=0; i<stride; i++) {
                if(inline_fastrand()&0xc0000000)
                    continue;

                x = image.xsize / 2 + i;
                *(dest + x) = 0xffffffff;
	
                while(x + stride/2 < image.xsize) {
                    v = *(src + x + stride/2);
                    R = (v&0xff0000)>>(16+6);
                    G = (v&0xff00)>>(8+6);
                    B = (v&0xff)>>7;
                    x += stride + R + G + B;
                    if(x >= image.xsize) break;
                    *(dest + x) = 0xffffffff;
                }

                x = image.xsize / 2 + i;
                while(x - stride/2 >= 0) {
                    v = *(src + x - stride/2);
                    R = (v&0xff0000)>>(16+6);
		    G = (v&0xff00)>>(8+6);
		    B = (v&0xff)>>7;
                    x -= stride + R + G + B;
                    if(x < 0) break;
                    *(dest + x) = 0xffffffff;
                }
            }
            src += image.xsize;
            dest += image.xsize;
        }
    } else {
        for(y=0; y<image.ysize; y++) {
コード例 #2
0
ファイル: matrix.c プロジェクト: Elive/effectv
static void blipNone(int x)
{
	unsigned int r;

	// This is a test code to reuse a randome number for multi purpose. :-P
	// Of course it isn't good code because fastrand() doesn't generate ideal
	// randome numbers.
	r = inline_fastrand();

	if((r & 0xf0) == 0xf0) {
		blips[x].mode = MODE_FALL;
		blips[x].y = 0;
		blips[x].speed = (r >> 30) + 1;
		blips[x].timer = 0;
	} else if((r & 0x0f000) ==  0x0f000) {
コード例 #3
0
ファイル: puzzle.c プロジェクト: Elive/effectv
static void autoSolve(void)
{
	/* IMPORTANT BUG: this functions does *NOT* solve the puzzle! */
	static int lastMove = 0;
	static char dir[4];
	int i, j, x, y, max;

	if(movingBlock >= 0) return;
	for(i=0; i<4; i++) {
		dir[i] = i;
	}
	dir[lastMove] = -1;
	x = spaceBlock % blockW;
	y = spaceBlock / blockW;
	if(x <= 0) dir[3] = -1;
	if(x >= blockW - 1) dir[2] = -1;
	if(y <= 0) dir[1] = -1;
	if(y >= blockH - 1) dir[0] = -1;

	max = 0;
	for(i=0; i<3; i++) {
		if(dir[i] == -1) {
			for(j=i+1; j<4; j++) {
				if(dir[j] != -1) {
					dir[i] = dir[j];
					dir[j] = -1;
					max++;
					break;
				}
			}
		} else {
			max++;
		}
	}

	if(max > 0) {
		i = dir[inline_fastrand() % max];
		if(orderMotion(i) == 0) {
			if(i < 2) {
				lastMove = 1 - i;
			} else {
				lastMove = 5 - i;
			}
		}
	}
}
コード例 #4
0
ファイル: rds.c プロジェクト: Elive/effectv
static int draw(RGB32 *src, RGB32 *dest)
{
	int x, y, i;
	RGB32 *target;
	RGB32 v;
	RGB32 R, G, B;

	memset(dest, 0, video_area * PIXEL_SIZE);
	target = dest;

	if(method) {
		for(y=0; y<video_height; y++) {
			for(i=0; i<stride; i++) {
				if(inline_fastrand()&0xc0000000)
					continue;

				x = video_width / 2 + i;
				*(dest + x) = 0xffffff;
	
				while(x + stride/2 < video_width) {
					v = *(src + x + stride/2);
					R = (v&0xff0000)>>(16+6);
					G = (v&0xff00)>>(8+6);
					B = (v&0xff)>>7;
					x += stride + R + G + B;
					if(x >= video_width) break;
					*(dest + x) = 0xffffff;
				}

				x = video_width / 2 + i;
				while(x - stride/2 >= 0) {
					v = *(src + x - stride/2);
					R = (v&0xff0000)>>(16+6);
					G = (v&0xff00)>>(8+6);
					B = (v&0xff)>>7;
					x -= stride + R + G + B;
					if(x < 0) break;
					*(dest + x) = 0xffffff;
				}
			}
			src += video_width;
			dest += video_width;
		}
	} else {
		for(y=0; y<video_height; y++) {
コード例 #5
0
ファイル: noise.c プロジェクト: Elive/effectv
static int draw(RGB32 *src, RGB32 *dest)
{
	int x, y;
	unsigned char *diff;

	if(!bgIsSet) {
		setBackground(src);
	}

	diff = image_diff_filter(image_bgsubtract_y(src));
	for(y=video_height; y>0; y--) {
		for(x=video_width; x>0; x--) {
			if(*diff++) {
				*dest = 0 - ((inline_fastrand()>>31) & y);
			} else {
				*dest = *src;
			}
			src++;
			dest++;
		}
コード例 #6
0
ファイル: rndm.c プロジェクト: Elive/effectv
static int draw(RGB32 *src, RGB32 *dst)
{
	int i, tmp, rtmp;

	rgrab++;
	if (rgrab>=rgrabtime){
		rgrab=0;

  	//bzero(dst, video_area*sizeof(RGB32)); // clear the screen
		if (rmode==0){
  	//static

			for (i=0; i<video_height*video_width; i++){
				if((inline_fastrand()>>24)<((*src)&0xff00)>>8){

					*dst=rthecolor;
				}
				else{
					*dst=0x00;
				}
				src++ ; dst++;
			}
		} else {