当前位置: 首页>>代码示例>>C++>>正文


C++ GREEN函数代码示例

本文整理汇总了C++中GREEN函数的典型用法代码示例。如果您正苦于以下问题:C++ GREEN函数的具体用法?C++ GREEN怎么用?C++ GREEN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GREEN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eahd_median

// Just making this function inline speeds up ahd_interpolate_INDI() up to 15%
static inline uint16_t eahd_median(int row, int col, int color,
                                 uint16_t* image, const int width)
{
    //declare the pixel array
    int pArray[9];

    //perform the median filter (this only works for red or blue)
    //  result = median(R-G)+G or median(B-G)+G
    //
    // to perform the filter on green, it needs to be the average
    //  results = (median(G-R)+median(G-B)+R+B)/2
    
    //no checks are done here to speed up the inlining
    pArray[0] = (int) IMAGE(row    , col + 1, color) - GREEN(row    , col + 1);
    pArray[1] = (int) IMAGE(row - 1, col + 1, color) - GREEN(row - 1, col + 1);
    pArray[2] = (int) IMAGE(row - 1, col    , color) - GREEN(row - 1, col    );
    pArray[3] = (int) IMAGE(row - 1, col - 1, color) - GREEN(row - 1, col - 1);
    pArray[4] = (int) IMAGE(row    , col - 1, color) - GREEN(row    , col - 1);
    pArray[5] = (int) IMAGE(row + 1, col - 1, color) - GREEN(row + 1, col - 1);
    pArray[6] = (int) IMAGE(row + 1, col    , color) - GREEN(row + 1, col    );
    pArray[7] = (int) IMAGE(row + 1, col + 1, color) - GREEN(row + 1, col + 1);
    pArray[8] = (int) IMAGE(row    , col    , color) - GREEN(row    , col    );

    int result = median9(pArray) + GREEN(row,col);
    return DTOP(result);
}
开发者ID:irieger,项目名称:misc-tools-utilities,代码行数:27,代码来源:ufraw_routines.c

示例2: mallinfo

void System::ramUsage(cTerm & t,int argc,char *argv[])
{
	extern cyg_uint32  __rom_data_start;	//diag_printf("ROMstart 0x%08X\n",(cyg_uint32)&__rom_data_start);
	//extern cyg_uint32  __rom_data_end;	//diag_printf("ROMend   0x%08X\n",(cyg_uint32)&__rom_data_end);


	extern cyg_uint32  __ram_data_start;	//diag_printf("RAMstart 0x%08X\n",(cyg_uint32)&__ram_data_start);
	extern cyg_uint32  __ram_data_end;		//diag_printf("RAMend   0x%08X\n",(cyg_uint32)&__ram_data_end);
	extern cyg_uint32  _end;				//diag_printf("__end    0x%08X\n",(cyg_uint32)&_end);
	struct mallinfo heap_info = mallinfo();

	cyg_uint32 text_size = (cyg_uint32)&__rom_data_start - 0x08000000;
	cyg_uint32 data_size =  (cyg_uint32)&__ram_data_end - (cyg_uint32)&__ram_data_start;
	cyg_uint32 bss_size  = (cyg_uint32)&_end - (cyg_uint32)&__ram_data_end;
	cyg_uint32 total_ram = text_size + data_size + bss_size;

	t<<(GREEN("Program memory:\n"));
	t<<".text = "<<text_size<<"\n";
	t<<".data = "<<data_size<<"\n";
	t<<" .bss = "<<bss_size<<"\n";
	t<<"total = "<<total_ram<<"\n";
	t<<" perc = "<<(int)((total_ram*100)/(0x40000-0x180))<<"%\n"<<"\n";

	t<<GREEN("RAM:\n");
	t<<".heap = "<<heap_info.arena<<"\n";
	t<<" Used = "<<heap_info.usmblks+heap_info.uordblks<<"\n";
	t<<" perc = "<<(int)(((heap_info.usmblks+heap_info.uordblks)*100)/heap_info.arena)<<"%\n"<<"\n";

	return;
}
开发者ID:JanusErasmus,项目名称:pump-input-logger,代码行数:30,代码来源:TermCMD.cpp

示例3: compose_over

pixel_t compose_over(pixel_t fg, pixel_t bg)
{
	double mul;
	double mul_cmp;

	double res_a;
	double res_r;
	double res_g;
	double res_b;

	if (ALPHA(bg) == 255) {
		res_a = 1;
		mul = ((double) ALPHA(fg)) / 255.0;
		mul_cmp = 1 - mul;
	} else {
		double fg_a = ((double) ALPHA(fg)) / 255.0;
		double bg_a = ((double) ALPHA(bg)) / 255.0;

		res_a = 1 - (1 - fg_a) * (1 - bg_a);
		mul = fg_a / res_a;
		mul_cmp = 1 - mul;
	}

	res_r = mul * ((double) RED(fg)) + mul_cmp * ((double) RED(bg));
	res_g = mul * ((double) GREEN(fg)) + mul_cmp * ((double) GREEN(bg));
	res_b = mul * ((double) BLUE(fg)) + mul_cmp * ((double) BLUE(bg));

	return PIXEL((unsigned) (res_a * 255),
	    (unsigned) res_r, (unsigned) res_g, (unsigned) res_b);
}
开发者ID:jvesely,项目名称:helenos,代码行数:30,代码来源:compose.c

示例4: ALPHA

ColorARGB GifTranscoder::computeAverage(ColorARGB c1, ColorARGB c2, ColorARGB c3, ColorARGB c4) {
    char avgAlpha = (char)(((int) ALPHA(c1) + (int) ALPHA(c2) +
                            (int) ALPHA(c3) + (int) ALPHA(c4)) / 4);
    char avgRed =   (char)(((int) RED(c1) + (int) RED(c2) +
                            (int) RED(c3) + (int) RED(c4)) / 4);
    char avgGreen = (char)(((int) GREEN(c1) + (int) GREEN(c2) +
                            (int) GREEN(c3) + (int) GREEN(c4)) / 4);
    char avgBlue =  (char)(((int) BLUE(c1) + (int) BLUE(c2) +
                            (int) BLUE(c3) + (int) BLUE(c4)) / 4);
    return MAKE_COLOR_ARGB(avgAlpha, avgRed, avgGreen, avgBlue);
}
开发者ID:b-project,项目名称:Messaging,代码行数:11,代码来源:GifTranscoder.cpp

示例5: PT_CopyBlend

internal void
PT_CopyBlend(u32 *destPixels, PT_Rect *destRect, u32 destPixelsPerRow,
             u32 *srcPixels, PT_Rect *srcRect, u32 srcPixelsPerRow,
             u32 *newColor)
{
    // If src and dest rects are not the same size ==> bad things
    assert(destRect->w == srcRect->w && destRect->h == srcRect->h);

    // For each pixel in the destination rect, alpha blend to it the 
    // corresponding pixel in the source rect.
    // ref: https://en.wikipedia.org/wiki/Alpha_compositing

    u32 stopX = destRect->x + destRect->w;
    u32 stopY = destRect->y + destRect->h;

    for (u32 dstY = destRect->y, srcY = srcRect->y; 
         dstY < stopY; 
         dstY++, srcY++) {
        for (u32 dstX = destRect->x, srcX = srcRect->x; 
             dstX < stopX; 
             dstX++, srcX++) {

            u32 srcColor = srcPixels[(srcY * srcPixelsPerRow) + srcX];
            u32 *destPixel = &destPixels[(dstY * destPixelsPerRow) + dstX];
            u32 destColor = *destPixel;

            // Colorize our source pixel before we blend it
            srcColor = PT_ColorizePixel(srcColor, *newColor);

            if (ALPHA(srcColor) == 0) {
                // Source is transparent - so do nothing
                continue;
            } else if (ALPHA(srcColor) == 255) {
                // Just copy the color, no blending necessary
                *destPixel = srcColor;
            } else {
                // Do alpha blending
                float srcA = ALPHA(srcColor) / 255.0;
                float invSrcA = (1.0 - srcA);
                float destA = ALPHA(destColor) / 255.0;

                float outAlpha = srcA + (destA * invSrcA);
                u8 fRed = ((RED(srcColor) * srcA) + (RED(destColor) * destA * invSrcA)) / outAlpha;
                u8 fGreen = ((GREEN(srcColor) * srcA) + (GREEN(destColor) * destA * invSrcA)) / outAlpha;
                u8 fBlue = ((BLUE(srcColor) * srcA) + (BLUE(destColor) * destA * invSrcA)) / outAlpha;
                u8 fAlpha = outAlpha * 255;

                *destPixel = COLOR_FROM_RGBA(fRed, fGreen, fBlue, fAlpha);
            }
        }
    }
}
开发者ID:pdetagyos,项目名称:RoguelikeTutorial,代码行数:52,代码来源:pt_console.c

示例6: hippo_cairo_set_source_rgba32

void
hippo_cairo_set_source_rgba32(cairo_t *cr,
                              guint32  color)
{
    /* trying to avoid alpha 255 becoming a double alpha that isn't quite opaque ?
     * not sure this is needed.
     */
    if ((color & 0xff) == 0xff) {
        cairo_set_source_rgb(cr, RED(color), GREEN(color), BLUE(color));
    } else {
        cairo_set_source_rgba(cr, RED(color), GREEN(color), BLUE(color), ALPHA(color));
    }
}
开发者ID:manoj-makkuboy,项目名称:magnetism,代码行数:13,代码来源:hippo-canvas.c

示例7: getBilinearInterpolatedPixel

uint32_t getBilinearInterpolatedPixel(const void *pixels, int width, int height, int stride, float x, float y) {
	int x1 = (int) x;
	int x2 = x1+1;
	int y1 = (int) y;
	int y2 = y1+1;
	
	uint32_t pixel1 = getPixelRGBA(pixels, stride, x1%width, y1%height);
	uint32_t pixel2 = getPixelRGBA(pixels, stride, x2%width, y1%height);
	uint32_t pixel3 = getPixelRGBA(pixels, stride ,x1%width, y2%height);
	uint32_t pixel4 = getPixelRGBA(pixels, stride, x2%width, y2%height);
	
	int red1 = RED(pixel1);
	int green1 = GREEN(pixel1);
	int blue1 = BLUE(pixel1);
	
	int red2 = RED(pixel2);
	int green2 = GREEN(pixel2);
	int blue2 = BLUE(pixel2);
	
	int red3 = RED(pixel3);
	int green3 = GREEN(pixel3);
	int blue3 = BLUE(pixel3);
	
	int red4 = RED(pixel4);
	int green4 = GREEN(pixel4);
	int blue4 = BLUE(pixel4);
	
	float w1 = x2-x;
	float w2 = x-x1; 
	
	float red1_2 = w1*red1 + w2*red2;
	float red2_3 = w1*red3 + w2*red4;
	
	float green1_2 = w1*green1 + w2*green2;
	float green2_3 = w1*green3 + w2*green4;
	
	float blue1_2 = w1*blue1 + w2*blue2;
	float blue2_3 = w1*blue3 + w2*blue4;
	
	w1 = y2-y;
	w2 = y-y1;
	
	int red = (int) (w1*red1_2 + w2*red2_3 + 0.5);
	int green = (int) (w1*green1_2 + w2*green2_3 + 0.5);
	int blue = (int) (w1*blue1_2 + w2*blue2_3 + 0.5);

	return createRGBAPixel(red, green, blue, 0);
}
开发者ID:Joisar,项目名称:OpenPanodroid,代码行数:48,代码来源:cubicpano-jni.cpp

示例8: draw3DLine

void draw3DLine(float sx, float sy, float sz, float ex, float ey, float ez, DWORD colour)
{
	glLoadIdentity();
	/*D3DXMATRIX mat;
	D3DXMatrixIdentity(&mat);
	g_pd3dDevice->SetTransform( D3DTS_WORLD, &mat );	// Move object
*/
			DWORD &c = colour;
			float c1[4] ={
				((float)RED(c)) / 255.0f,
			  ((float)GREEN(c)) / 255.0f,
			  ((float)BLUE(c)) / 255.0f,
			  ((float)ALPHA(c)) / 255.0f
			};
			
			glColor4fv(c1);  
	
		glBegin(GL_LINES);
//		glColor4f(RED(colour), GREEN(colour), BLUE(colour), ALPHA(colour));  
		glVertex3f(sx, sy, sz);
		glVertex3f(ex, ey, ez);
	glEnd();	
	/*
	#define D3DFVF_LVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE)
	struct LVERTEX { float x, y, z; DWORD diffuse; };
	LVERTEX line[2] = {
		{ sx,	sy,	sz,	colour	}, 
		{ ex,	ey, ez,	colour	}
	};			
	SetVertexShader( D3DFVF_LVERTEX );
	g_pd3dDevice->DrawPrimitiveUP(D3DPT_LINELIST, 2, line, sizeof(LVERTEX));
*/
}
开发者ID:glenritchie,项目名称:assignment,代码行数:33,代码来源:draw_box.cpp

示例9: show_flag

static void show_flag(int idx, char *work, int *cnt, const char *name, unsigned int state, size_t worksiz)
{
  char tmp[101] = "", chr_state[15] = "";
  /* empty buffer if no (char *) name */
  if (((*cnt) < (FLAG_COLS - 1)) && (!name || (name && !name[0]))) (*cnt) = (FLAG_COLS - 1); 
  (*cnt)++;
  if (*cnt > FLAG_COLS) {
    *cnt = 1;
    work[0] = 0;
  }
  if (!work[0])
    strlcpy(work, "  ", worksiz);
  if (name && name[0]) {
    chr_state[0] = 0;
    if (state) {
      strlcat(chr_state, GREEN(idx), sizeof(chr_state));
      strlcat(chr_state, "+", sizeof(chr_state));
    } else {
      strlcat(chr_state, RED(idx), sizeof(chr_state));
      strlcat(chr_state, "-", sizeof(chr_state));
    }
    strlcat(chr_state, COLOR_END(idx), sizeof(chr_state));
    simple_snprintf(tmp, sizeof tmp, "%s%-17s", chr_state, name);
    strlcat(work, tmp, worksiz);
  }
  if (*cnt >= FLAG_COLS)
    dprintf(idx, "%s\n", work);
}
开发者ID:kirune,项目名称:wraith,代码行数:28,代码来源:cmdschan.c

示例10: compute_gray

/*
 * Enforces all pixels to grayscale.
 */
void compute_gray(struct jpeg_data *jpeg)
{
        if (jpeg == NULL || jpeg->raw_data == NULL)
                return;


        uint32_t nb_pixels, pixel;
        uint32_t *image = jpeg->raw_data;
        uint32_t R, G, B, gray;

        /* Compute the buffer size */
        if (jpeg->is_plain_image)
                nb_pixels = jpeg->width * jpeg->height;

        else
                nb_pixels = jpeg->mcu.size * jpeg->mcu.nb;


        /* Convert each pixel */
        for (uint32_t i = 0; i < nb_pixels; i++) {

                pixel = image[i];

                R = RED(pixel);
                G = GREEN(pixel);
                B = BLUE(pixel);

                gray = (R + G + B) / 3;


                image[i] = gray << 16 | gray << 8 | gray;
        }
}
开发者ID:nejmd,项目名称:JPEG,代码行数:36,代码来源:library.c

示例11: omb_draw_rect

void omb_draw_rect(int x, int y, int width, int height, int color)
{
	int i, j;
	long int location = 0;
	unsigned char alpha = ALPHA(color);
	unsigned char red = RED(color);
	unsigned char green = GREEN(color);
	unsigned char blue = BLUE(color);
	
	for (i = y; i < y + height; i++) {
		for (j = x; j < x + width; j++) {
			
			if (i < 0 || j < 0 || i > omb_var_screen_info.yres || j > omb_var_screen_info.xres)
				continue;

			location = ((j + omb_var_screen_info.xoffset) * (omb_var_screen_info.bits_per_pixel / 8)) +
				((i + omb_var_screen_info.yoffset) * omb_fix_screen_info.line_length);

			*(omb_fb_map + location) = blue;
			*(omb_fb_map + location + 1) = green;
			*(omb_fb_map + location + 2) = red;
			*(omb_fb_map + location + 3) = alpha;
		}
	}
}
开发者ID:athoik,项目名称:openmultiboot,代码行数:25,代码来源:omb_framebuffer.c

示例12: InitPixelShade

/*
 * InitPixelShade:
 *      Fills the PixelShade array with precomputed shades of every possible pixel (32 shades)
 */
void InitPixelShade(void)
{
    int i, j;
    int r, g, b;
    int dr, dg, db;
    const double alpha[32] = { 0.0, 0.03, 0.06, 0.09,
                               0.13, 0.17, 0.21, 0.24,
                               0.27, 0.31, 0.34, 0.37,
                               0.41, 0.44, 0.47, 0.49,
                               0.51, 0.53, 0.56, 0.59,
                               0.63, 0.66, 0.69, 0.73,
                               0.76, 0.79, 0.83, 0.87,
                               0.91, 0.94, 0.97, 1.0
                             };
                             
    for (i = 0; i < 32; i++) {
        for (j = 0; j < 65536; j++) {
            r = RED(j);
            g = GREEN(j);
            b = BLUE(j);
            dr = (int)(r * alpha[i]);
            dg = (int)(g * alpha[i]);
            db = (int)(b * alpha[i]);
            PixelShade[i][j] = RGB16(dr, dg, db);
        }
    }
}
开发者ID:mreiferson,项目名称:hajiworld,代码行数:31,代码来源:hwgfx.cpp

示例13: glBegin

void GEMapCell::drawVisual(vector_t unit_size)
{
  float hx, hy, hz;
  hx = (this->parent->cell_size.x * unit_size.x) / 2 - unit_size.x/20;
  hy = (this->parent->cell_size.y * unit_size.y) / 2 - unit_size.y/20;
  hz = (this->height * unit_size.z) + 0.01;
  if (visual)
    visual->draw(unit_size);
  glBegin(GL_QUADS);
  glColor3ub(RED(bg_color), GREEN(bg_color), BLUE(bg_color));
  glVertex3f( hx, hy, 0);
  glVertex3f(-hx, hy, 0);
  glVertex3f(-hx, hy, hz);
  glVertex3f( hx, hy, hz);
  glVertex3f( hx,-hy, hz);
  glVertex3f(-hx,-hy, hz);
  glVertex3f(-hx,-hy, 0);
  glVertex3f( hx,-hy, 0);
  glVertex3f( hx, hy, hz);
  glVertex3f(-hx, hy, hz);
  glVertex3f(-hx,-hy, hz);
  glVertex3f( hx,-hy, hz);
  glVertex3f( hx,-hy, 0);
  glVertex3f(-hx,-hy, 0);
  glVertex3f(-hx, hy, 0);
  glVertex3f( hx, hy, 0);
  glEnd();
}
开发者ID:mpato,项目名称:gelfar,代码行数:28,代码来源:GEVisual.cpp

示例14: aravdebug

    aravdebug(const char * userfile, int lineno, const char *PATH) {

        dataPath = getenv("DLOG_OUTPUT_FOLDER") + std::string(PATH);

        //llvm::errs()<<"Data path ::"<<dataPath;
        datatempPath = dataPath + ".temp";
//		tagPath = dataPath + ".tag";

        std::string syscall = "rm -f " + dataPath;

        int status = system(syscall.c_str());
        if (status < 0)
            std::cout << "DLOG Error: " << strerror(errno) << '\n';

        OS.reset((new llvm::raw_fd_ostream(datatempPath.c_str(), ErrorInfo)));

        llvm::errs() << ErrorInfo;

        id = gid++;

        //llvm::errs()<<"created DLOG with id "<<id<<"\n";
        tagset.insert("SYSTEM");
        (*OS) << DIV("SYSTEM")<< "Created Debugger " << GREEN(id)
              << CALLINFO
              << EDIV;

        tagset.insert("CALLINFO");

        (*OS).flush();
    }
开发者ID:rata,项目名称:DLOG,代码行数:30,代码来源:mydebug.hpp

示例15: draw2DBox

/*
void draw2DBox(int top, int left, int right, int bottom, DWORD colour[4])
{
	CONTROLVERTEX Vertices[4] =	{
		// x, y, z, rhw, colour, tu,tv
		{	left,	bottom,		0.0f,	1.0f,	colour[0],	0.0f,	1.0f },		// BL
		{	right,	bottom, 0.0f,	1.0f,	colour[2],	1.0f,	1.0f },		// BR
		{	left,	top,			0.0f,	1.0f,	colour[1],	0.0f,	0.0f },		// TL
		{	right,	top,		0.0f,	1.0f,	colour[3],	1.0f,	0.0f },		// TR
	};                                                          
	
	glBegin(GL_TRIANGLE_STRIP);
	for (int i = 0; i < 4; )
	{
			DWORD &c = Vertices[i].diffuse;
			float c1[4] ={
				((float)RED(c)) / 255.0,
			  ((float)GREEN(c)) / 255.0,
			  ((float)BLUE(c)) / 255.0,
			  ((float)ALPHA(c)) / 255.0
			};
			
			glColor4fv(c1);  
			glTexCoord2d(Vertices[i].tu0,Vertices[i].tv0);
			glVertex3f(Vertices[i].x, Vertices[i].y, Vertices[i].z); 
			i++;
	}	
	glEnd();
}
*/
void draw2DBox(float top, float left, float right, float bottom, DWORD colour[4])
{
	CONTROLVERTEX Vertices[4] =	{
		// x, y, z, rhw, colour, tu,tv
		{	left,	bottom,		0.0f,	1.0f,	colour[0],	0.0f,	1.0f },		// BL
		{	right,	bottom, 0.0f,	1.0f,	colour[2],	1.0f,	1.0f },		// BR
		{	left,	top,			0.0f,	1.0f,	colour[1],	0.0f,	0.0f },		// TL
		{	right,	top,		0.0f,	1.0f,	colour[3],	1.0f,	0.0f },		// TR
	};                                                          
	
	glBegin(GL_TRIANGLE_STRIP);
	for (int i = 0; i < 4; )
	{
			DWORD &c = Vertices[i].diffuse;
			float c1[4] ={
				((float)RED(c)) / 255.0f,
			  ((float)GREEN(c)) / 255.0f,
			  ((float)BLUE(c)) / 255.0f,
			  ((float)ALPHA(c)) / 255.0f
			};
			
			glColor4fv(c1);  
			glTexCoord2d(Vertices[i].tu0,Vertices[i].tv0);
			glVertex3f(Vertices[i].x, Vertices[i].y, Vertices[i].z); 
			i++;
	}	
	glEnd();
}
开发者ID:glenritchie,项目名称:assignment,代码行数:58,代码来源:draw_box.cpp


注:本文中的GREEN函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。