コード例 #1
0
ファイル: fblin12.c プロジェクト: LucidOne/Rovio
/* Read pixel at x, y*/
static MWPIXELVAL
linear12_readpixel(PSD psd, MWCOORD x, MWCOORD y)
{
	ADDR8	addr = psd->addr;

	assert (addr != 0);
	assert (x >= 0 && x < psd->xres);
	assert (y >= 0 && y < psd->yres);
        x=x+(x<<1);
	return RGB2PIXEL444(getpix(addr,x,y),getpix(addr,x+1,y),getpix(addr,x+2,y));
}
コード例 #2
0
static float marching_interpolation_at(float *x, int w, int h, float p, float q)
{
	int ip = p;
	int iq = q;
	float a = getpix(x, w, h, ip  , iq  );
	float b = getpix(x, w, h, ip  , iq+1);
	float c = getpix(x, w, h, ip+1, iq  );
	float d = getpix(x, w, h, ip+1, iq+1);
	float r = marchi(a, b, c, d, p-ip, q-iq);
	return r;
}
コード例 #3
0
ファイル: filter.c プロジェクト: Xploow/ScanItDown
void binarization(SDL_Surface *s)
{
	int x, y,currentpix;
	Uint8 r, g, b;
	int myArray[s->w][s->h];
	for(x = 0; x < s->w; x++) {
		for(y = 0; y < s->h; y++) {
			SDL_GetRGB(getpix(s, x, y), s->format, &r, &g, &b);
			currentpix=(r+g+b)/3;
			if(currentpix<180)
				myArray[x][y] =1; 
			else
				myArray[x][y]=0;
		}
	}  
  for(x = 0; x < s->w; x++) {
      for(y = 0; y < s->h; y++) {
	 if(myArray[x][y]==1)
	   {putpix(s, x, y, SDL_MapRGB(s->format, 0, 0, 0));}

	else
	   {putpix(s, x, y, SDL_MapRGB(s->format, 255, 255, 255));}
		}
	}
}
コード例 #4
0
ファイル: filter.c プロジェクト: Xploow/ScanItDown
void grayscale(SDL_Surface *s)
{
	int x, y;
	Uint8 r, g, b, c;
	for(x = 0; x < s->w; x++) {
		for(y = 0; y < s->h; y++) {
			SDL_GetRGB(getpix(s, x, y), s->format, &r, &g, &b);
			c = r * .3 + g * .6 + b * .1;
			putpix(s, x, y, SDL_MapRGB(s->format, c, c, c));
		}
	}
}
コード例 #5
0
ファイル: hsv.cpp プロジェクト: rene-dev/renibi
bool Ppm::rgb2hsvpix(void){
	var_pos pos;
	pos = filter.p1;
 	while(pos.y < filter.p2.y){
		pos.x = filter.p1.x;
		while(pos.x < filter.p2.x){
		setpix(pos,rgb2hsv(getpix(pos)));
		pos.x++;
		}
	pos.y++;
	}
	return (true);
}
コード例 #6
0
ファイル: filltest.c プロジェクト: greigs/gbdev
void main()
{
    UBYTE  a,b,c,d,e;
    c=0;
    /* Draw many characters on the screen with different fg and bg colours */
    for (a=0; a<=15; a++) {
	for (b=0; b<=15; b++) {
	    gotogxy(b,a);
	    d=a/4;
	    e=b/4;
	    if (d==e) {
		d=3-e;
	    }
	    color(d,e,SOLID);
	    gprintf("%c",c++);
	} 
    }

    /* Draw two circles, a line, and two boxes in different drawing modes */
    color(LTGREY,WHITE,SOLID);
    circle(140,20,15,M_FILL);
    color(BLACK,WHITE,SOLID);
    circle(140,20,10,M_NOFILL);
    color(DKGREY,WHITE,XOR);
    circle(120,40,30,M_FILL);
    line(0,0,159,143);
    color(BLACK,LTGREY,SOLID);
    box(0,130,40,143,M_NOFILL);
    box(50,130,90,143,M_FILL);

    /* Scroll the screen using the hardest method imaginable :) */
    for (c=0; c<=143; c++) {
	for (b=0; b<=142; b++) {
	    for (a=0; a<=159; a++) {
		color(getpix(a,b+1),WHITE,SOLID);
		plot_point(a,b);
	    }
	    color(WHITE,WHITE,SOLID);
	}
	line(0,143,159,143);
    }
}
コード例 #7
0
ファイル: image.cpp プロジェクト: hawken93/Imagesort
void Image::grayscale() {
    if(_dim.bits != 8) {
        std::cout << "Image::grayscale does only support 8 bpp\n";
        return;
    }
    if(_dim.channels == 1) return;
    unsigned char *img2 = new unsigned char [(_dim.width*_dim.height)];
    int x,y,k;
    float val;
    for(y=0; y<_dim.height; y++) {
        for(x=0; x<_dim.width; x++) {
            val = 0;
            for(k=0; k<_dim.channels; k++) {
                val += getpix(x,y,k);
            }
            val = val/_dim.channels;
            img2[(y*_dim.width)+x] = limit(val);
        }
    }
    _dim.channels = 1;
    delete [] buf;
    buf = img2;
}
コード例 #8
0
ファイル: vf_geq.c プロジェクト: WilliamRen/mplayer-android
static double cr(void *vf, double x, double y) {
    return getpix(vf, x, y, 2);
}
コード例 #9
0
ファイル: vf_geq.c プロジェクト: WilliamRen/mplayer-android
static double cb(void *vf, double x, double y) {
    return getpix(vf, x, y, 1);
}
コード例 #10
0
ファイル: vf_geq.c プロジェクト: WilliamRen/mplayer-android
//FIXME cubic interpolate
//FIXME keep the last few frames
static double lum(void *vf, double x, double y) {
    return getpix(vf, x, y, 0);
}
コード例 #11
0
static double alpha(void *priv, double x, double y) { return getpix(priv, x, y, 3); }
コード例 #12
0
static double  cr(void *priv, double x, double y) { return getpix(priv, x, y, 2); }
コード例 #13
0
//TODO: cubic interpolate
//TODO: keep the last few frames
static double lum(void *priv, double x, double y) { return getpix(priv, x, y, 0); }
コード例 #14
0
ファイル: image.cpp プロジェクト: hawken93/Imagesort
void Image::bicubic(int newWidth, int newHeight)
{
    if(_dim.bits != 8) {
        std::cout << "Image::bicubic does only support 8 bpp\n";
        return;
    }
    unsigned char *img2 = new unsigned char[newWidth*newHeight*_dim.channels];
    float Cc;
    float C[5];
    float d0,d2,d3,a0,a1,a2,a3;

    int i,j,k,jj;
    int x,y;

    float dx,dy;
    float tx,ty;

    int stride2 = _dim.channels*newWidth;

    tx = (float)_dim.width/newWidth;
    ty = (float)_dim.height/newHeight;

    for(i=0; i<newHeight; i++)
        for(j=0; j<newWidth; j++)
        {
            x =(int)(tx*j);
            y =(int)(ty*i);

            dx=tx*j-x;
            dy=ty*i-y;

            for(k=0; k<_dim.channels; k++)
            {
                for(jj=0; jj<=3; jj++)
                {

                    d0 =	 getpix(x-1, y-1+jj, k)
                             -getpix(x,   y-1+jj, k);
                    d2 =	 getpix(x+1, y-1+jj, k)
                             -getpix(x,   y-1+jj, k);
                    d3 =     getpix(x+2, y-1+jj, k)
                             -getpix(x,   y-1+jj, k);

                    a0 = getpix(x, y-1+jj, k);
                    a1 =-1.0/3*d0 +d2       -1.0/6*d3;
                    a2 =+1.0/2*d0 +1.0/2*d2;
                    a3 =-1.0/6*d0 -1.0/2*d2 +1.0/6*d3;

                    C[jj] = a0 + a1*dx + a2*dx*dx + a3*dx*dx*dx;

                    d0 = C[0]-C[1];
                    d2 = C[2]-C[1];
                    d3 = C[3]-C[1];

                    a0=C[1];
                    a1 =-1.0/3*d0 +d2       -1.0/6*d3;
                    a2 =+1.0/2*d0 +1.0/2*d2;
                    a3 =-1.0/6*d0 -1.0/2*d2 +1.0/6*d3;

                    Cc = a0 + a1*dy + a2*dy*dy + a3*dy*dy*dy;
                    // if((int)Cc>255) Cc=255;
                    //                 if((int)Cc<0) Cc=0;
                    img2[(i*stride2) + j*_dim.channels +k] = limit(Cc);
                }
            }

        }
    // Aand replacement
    _dim.width = newWidth;
    _dim.height = newHeight;
    delete [] buf;
    buf = img2;
}
コード例 #15
0
ファイル: vf_geq.c プロジェクト: OpenSageTV/mplayer-sage9orig
//FIXME cubic interpolate
//FIXME keep the last few frames
static double lum(struct vf_instance_s* vf, double x, double y){
    return getpix(vf, x, y, 0);
}
コード例 #16
0
ファイル: vf_geq.c プロジェクト: OpenSageTV/mplayer-sage9orig
static double cr(struct vf_instance_s* vf, double x, double y){
    return getpix(vf, x, y, 2);
}