您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GREEN函数代码示例

51自学网 2021-06-01 20:55:08
  C++
这篇教程C++ GREEN函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例5: PT_CopyBlend

internal voidPT_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,


示例6: hippo_cairo_set_source_rgba32

voidhippo_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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例16: malloc

char *region_of_interest (NEURON_LAYER *nl_input, int x_center, int y_center, int width, int height){	int xi, yi, wi, hi, xo, yo, wo, ho;	NEURON_OUTPUT value;		char * output = malloc(width * height * 3 * sizeof(char));		wi = nl_input->dimentions.x;	hi = nl_input->dimentions.y;		wo = width;	ho = height;		for (yo = 0; yo < ho; yo++)	{		for (xo = 0; xo < wo; xo++)		{						xi = (int) ((double) xo + .5) + x_center - wo/2;			yi = (int) ((double) yo + .5) + y_center - ho/2;						if (xi >= 0 && xi < wi && yi >= 0 && yi < hi)				value = nl_input->neuron_vector[xi + wi * yi].output;			else				value.ival = 0;						output[3 * (yo * wo + xo) + 0] = RED(value.ival);			output[3 * (yo * wo + xo) + 1] = GREEN(value.ival);			output[3 * (yo * wo + xo) + 2] = BLUE(value.ival);		}	}		return output;}
开发者ID:LCAD-UFES,项目名称:MAE,代码行数:33,


示例17: RGB

	bool RGBLinearQuantizationFilter::Apply(til::Image &image) const	{		if (image.GetBitDepth() != til::Image::BPP_32B_R8G8B8) return false;		til::uint32 *image_pixels = reinterpret_cast<til::uint32*>(image.GetPixels());		std::vector<til::byte> palette[3] = { 			std::vector<til::byte>(max(((til::byte)(_palette_quants)),       1), 0x00),			std::vector<til::byte>(max(((til::byte)(_palette_quants >>  8)), 1), 0x00),			std::vector<til::byte>(max(((til::byte)(_palette_quants >> 16)), 1), 0x00)		};		til::byte index[] = { 			static_cast<til::byte>(0x100 / palette[0].size()) + (palette[0].size() % 2 * static_cast<til::byte>(palette[0].size() > 1)), 			static_cast<til::byte>(0x100 / palette[1].size()) + (palette[1].size() % 2 * static_cast<til::byte>(palette[1].size() > 1)), 			static_cast<til::byte>(0x100 / palette[2].size()) + (palette[2].size() % 2 * static_cast<til::byte>(palette[2].size() > 1)) 		};		for(std::vector<til::byte>::size_type i = 0, max = palette[0].size(); i < max; ++i) palette[0][i] = static_cast<til::byte>(i * index[0]);		for(std::vector<til::byte>::size_type i = 0, max = palette[1].size(); i < max; ++i) palette[1][i] = static_cast<til::byte>(i * index[1]);		for(std::vector<til::byte>::size_type i = 0, max = palette[2].size(); i < max; ++i) palette[2][i] = static_cast<til::byte>(i * index[2]);		for (til::uint64 i = 0, max = image.GetWidth() * image.GetHeight(); i < max; ++i)		{			image_pixels[i] = RGB(					palette[0][index[0] == 0x00 ? 0 : RED(image_pixels[i])   / index[0]],					palette[1][index[1] == 0x00 ? 0 : GREEN(image_pixels[i]) / index[1]],					palette[2][index[2] == 0x00 ? 0 : BLUE(image_pixels[i])  / index[2]]				);		}		return true;	}
开发者ID:vrishe,项目名称:image-filtering-dither,代码行数:33,


示例18: pinMode

// initialize the Lora stackbool Hal::initLora(){#ifdef SODAQ_ONE  // enable power, only for the Sodaq One  pinMode(ENABLE_PIN_IO, OUTPUT);  digitalWrite(ENABLE_PIN_IO, HIGH);  // enable power to the grove shield  pinMode(11, OUTPUT);  digitalWrite(11, HIGH);  pinMode(LED_RED, OUTPUT);  pinMode(LED_GREEN, OUTPUT);  pinMode(LED_BLUE, OUTPUT);  GREEN();#endif  loraSerial.begin(LoRaBee.getDefaultBaudRate());  LoRaBee.setDiag(debugSerial); // optional  if (LoRaBee.initABP(loraSerial, devAddr, appSKey, nwkSKey, false))  {    debugPrintLn("Connection to the network was successful.");    isHalInitialized = true;    //    LoRaBee.resetUplinkCntr();  }  else  {    debugPrintLn("Connection to the network failed!");  }}
开发者ID:marcelmaatkamp,项目名称:docker-applications,代码行数:31,


示例19: RED

void ColorQuantizer::shrink(cube_t *cube){    byte    r, g, b;    word    i,color;    cube->rmin = 255;    cube->rmax = 0;    cube->gmin = 255;    cube->gmax = 0;    cube->bmin = 255;    cube->bmax = 0;    for (i = cube->lower; i <= cube->upper; i++)    {        color = histPtr[i];        r = RED(color);        if (r > cube->rmax) cube->rmax = r;        if (r < cube->rmin) cube->rmin = r;        g = GREEN(color);        if (g > cube->gmax) cube->gmax = g;        if (g < cube->gmin) cube->gmin = g;        b = BLUE(color);        if (b > cube->bmax) cube->bmax = b;        if (b < cube->bmin) cube->bmin = b;    }}
开发者ID:abellgithub,项目名称:PRC,代码行数:25,


示例20: help

void TermCMD::help(cTerm & t,int argc,char *argv[]){	t<<(GREEN("TermCMD commands:/n"));	cmd_table_t* t_ptr = NULL;	char txt[16];	int k = 0;	do	{		t_ptr = &mCmdTable[k++];		if(!t_ptr->cmd)			break;		if(t_ptr->f)		{			sprintf(txt,"%s %s", t_ptr->cmd, t_ptr->argDesc);			t<<"  "<<t.format("%-10s - ",txt)<<t.format("%s/n",t_ptr->desc);		}		else		{			//this is a caption			t<<t.format(BLUE("%s/n"), t_ptr->cmd);		}	}while(t_ptr->cmd);}
开发者ID:JanusErasmus,项目名称:pump-input-logger,代码行数:27,


示例21: memset

void SpiFlash::writeCmd(cTerm & t,int argc,char *argv[]){	if (argc > 3)	{		cyg_uint32 addr = (cyg_uint32)strtoul(argv[1],NULL,16);		cyg_uint32 num = (cyg_uint32)strtoul(argv[2],NULL,16);		cyg_uint8 val = (cyg_uint8)strtoul(argv[3],NULL,16);		cyg_uint8 buff[num];		memset(buff,val,num);		int error = cyg_flash_program(addr, buff, num, 0);		if (!error)		{			t<<t.format(GREEN("Wrote %d bytes of 0x%02X to serial flash at address 0x%08X/n"), num, val, addr);		}		else		{			t<<(RED("Error writing to serial flash!/n"));			printfError(error);		}	}	else	{		t<<"You need to supply an address, number of bytes and value to write/n";	}}
开发者ID:JanusErasmus,项目名称:pump-input-logger,代码行数:30,


示例22: cyg_flash_read

void SpiFlash::readCmd(cTerm & t,int argc,char *argv[]){	if (argc > 2)	{		cyg_uint32 addr = (cyg_uint32)strtoul(argv[1],NULL,16);		cyg_uint32 num = (cyg_uint32)strtoul(argv[2],NULL,16);		cyg_uint8 buff[num];		int error = cyg_flash_read(addr, buff, num, 0);		if (!error)		{			t<<t.format(GREEN("Read %d bytes from serial flash at address 0x%08X/n"), num, addr);//			for (cyg_uint32 i = 0 ; i < num ; i++)//			{//				diag_printf(" 0x%02X", buff[i]);////			}			diag_dump_buf(buff, num);			diag_printf("/n");		}		else		{			t<<(RED("Error reading from serial flash!/n"));			printfError(error);		}	}	else	{		t<<"You need to supply an address and number of bytes to read/n";	}}
开发者ID:JanusErasmus,项目名称:pump-input-logger,代码行数:33,


示例23: hsv_v_filter

void hsv_v_filter(FILTER_DESC *filter_desc){	// http://en.wikipedia.org/wiki/HSL_and_HSV	// http://cs.haifa.ac.il/hagit/courses/ist/Lectures/Demos/ColorApplet2/t_convert.html		PARAM_LIST *p_list = NULL;	NEURON_LAYER_LIST *n_list = NULL;	NEURON_LAYER *nl_output = NULL, *nl_input = NULL;	int nl_number, p_number;	int xo, yo, wi, hi, wo, ho;	int r, g, b;	// Checks the Neuron Layers Number	for (nl_number = 0, n_list = filter_desc->neuron_layer_list; n_list != NULL; n_list = n_list->next, nl_number++)            	;	// Checks the Parameters Number	for (p_number = 0, p_list = filter_desc->filter_params; p_list != NULL; p_list = p_list->next, p_number++)            	;	if (p_number != 1)	{		Erro ("Error: Wrong number of parameters. The blue_mask_filter must have no parameters.", "", "");		return;	}	// Gets the Input Neuron Layer	nl_input = filter_desc->neuron_layer_list->neuron_layer;	// Gets the Filter Output 	nl_output = filter_desc->output;		// Input-Output width	wi = nl_input->dimentions.x;	hi = nl_input->dimentions.y;	wo = nl_output->dimentions.x;	ho = nl_output->dimentions.y;		if (wi != wo || hi != ho)	{		Erro ("Error: Input and output layers on blue_channel_mask filter must have the same 2D size.", "", "");		return;	}		for (yo = 0; yo < ho; yo++)	{		for (xo = 0; xo < wo; xo++)		{			r = RED(nl_input->neuron_vector[xo + yo * wo].output.ival);			g = GREEN(nl_input->neuron_vector[xo + yo * wo].output.ival);			b = BLUE(nl_input->neuron_vector[xo + yo * wo].output.ival);						nl_output->neuron_vector[xo + yo * wo].output.ival = max_value(r, g, b);		}	}}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:58,


示例24: sample_rgb

static rgb_color sample_rgb(uint16_t x, uint16_t y) {  RGBQUAD quad;  rgb_color ret;  FreeImage_GetPixelColor(dib,x,y,&quad);  ret.r = RED(&quad);  ret.g = GREEN(&quad);  ret.b = BLUE(&quad);  return ret;}
开发者ID:bpabel,项目名称:knittington,代码行数:9,


示例25: Cr_filter

void Cr_filter(FILTER_DESC *filter_desc){	// http://www.equasys.de/colorconversion.html		PARAM_LIST *p_list = NULL;	NEURON_LAYER_LIST *n_list = NULL;	NEURON_LAYER *nl_output = NULL, *nl_input = NULL;	int nl_number, p_number;	int xo, yo, wi, hi, wo, ho;	double r, g, b;	// Checks the Neuron Layers Number	for (nl_number = 0, n_list = filter_desc->neuron_layer_list; n_list != NULL; n_list = n_list->next, nl_number++)            	;	// Checks the Parameters Number	for (p_number = 0, p_list = filter_desc->filter_params; p_list != NULL; p_list = p_list->next, p_number++)            	;	if (p_number != 1)	{		Erro ("Error: Wrong number of parameters. The blue_mask_filter must have no parameters.", "", "");		return;	}	// Gets the Input Neuron Layer	nl_input = filter_desc->neuron_layer_list->neuron_layer;	// Gets the Filter Output 	nl_output = filter_desc->output;		// Input-Output width	wi = nl_input->dimentions.x;	hi = nl_input->dimentions.y;	wo = nl_output->dimentions.x;	ho = nl_output->dimentions.y;		if (wi != wo || hi != ho)	{		Erro ("Error: Input and output layers on blue_channel_mask filter must have the same 2D size.", "", "");		return;	}		for (yo = 0; yo < ho; yo++)	{		for (xo = 0; xo < wo; xo++)		{			r = (double) RED(nl_input->neuron_vector[xo + yo * wo].output.ival);			g = (double) GREEN(nl_input->neuron_vector[xo + yo * wo].output.ival);			b = (double) BLUE(nl_input->neuron_vector[xo + yo * wo].output.ival);			nl_output->neuron_vector[xo + yo * wo].output.ival = (int) (0.500 * r - 0.419 * g - 0.081 * b + 128.0);		}	}}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:56,


示例26: rgb565_to_rgb32

uint32 rgb565_to_rgb32(uint16 rgb565){    uint8 r, g, b;    uint32 rgb;    r = (uint8)RED(rgb565);    g = (uint8)GREEN(rgb565);    b = (uint8)BLUE(rgb565);    rgb = (((r << 8) + g) << 8) + b;    return rgb;}
开发者ID:craig-unilectric,项目名称:pdp,代码行数:10,


示例27: scale_area_avg

//scale using area averagingvoid scale_area_avg(struct image* src, struct image* dest){	int m, n, i, j;		for (i = 0; i < dest->height; i++){		for (j = 0; j < dest->width; j++){			int rval = 0, gval = 0, bval = 0;			for (m = i * SCALE_FACTOR; m < (i + 1) * SCALE_FACTOR; m++){				for (n = j * SCALE_FACTOR; n < (j + 1) * SCALE_FACTOR; n++){					rval += RED(src, m, n);					gval += GREEN(src, m, n);					bval += BLUE(src, m, n);				}			}			RED(dest, i, j) = rval / SCALE_FACTOR / SCALE_FACTOR;			GREEN(dest, i, j) = gval / SCALE_FACTOR / SCALE_FACTOR;			BLUE(dest, i, j) = bval / SCALE_FACTOR / SCALE_FACTOR;		}	}}
开发者ID:LaitaStefan,项目名称:labs-2014,代码行数:20,


示例28: omb_draw_rounded_rect

void omb_draw_rounded_rect(int x, int y, int width, int height, int color, int radius){	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;						int relative_x = j - x;			int relative_y = i - y;						// top left corner			if (relative_y < radius && relative_x < radius) {				if (!omb_is_point_inside_circle(relative_x, relative_y, radius)) {					continue;				}			}						// top right corner			else if (relative_y < radius && width - relative_x < radius) {				if (!omb_is_point_inside_circle(width - relative_x, relative_y, radius)) {					continue;				}			}						// bottom left corner			else if (height - relative_y < radius && relative_x < radius) {				if (!omb_is_point_inside_circle(relative_x, height - relative_y, radius)) {					continue;				}			}			// bottom right corner			else if (height - relative_y < radius && width - relative_x < radius) {				if (!omb_is_point_inside_circle(width - relative_x, height - relative_y, radius)) {					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,代码行数:55,



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


C++ GRETH_REGSAVE函数代码示例
C++ GP_ERROR函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。