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

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

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

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

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

示例1: Graph_Replace

int Graph_Replace( LCUI_Graph *back, const LCUI_Graph *fore, LCUI_Pos pos ){	LCUI_Graph write_slot;	LCUI_Rect read_rect,write_rect;		if( !Graph_IsValid(back) || !Graph_IsValid(fore) ) {		return -1;	}	write_rect.x = pos.x;	write_rect.y = pos.y;	write_rect.width = fore->width;	write_rect.height = fore->height;	Graph_Quote( &write_slot, back, &write_rect );	Graph_GetValidRect( &write_slot, &write_rect );	Graph_GetValidRect( fore, &read_rect );	if( write_rect.width <= 0 || write_rect.height <= 0	 || read_rect.width <= 0 || read_rect.height <= 0 ) {		return -2;	}	pos.x = read_rect.x;	pos.y = read_rect.y;	fore = Graph_GetQuote( fore );	back = Graph_GetQuote( back );	switch( fore->color_type ) {	case COLOR_TYPE_RGB888:		return Graph_RGBReplaceRGB( back, write_rect, fore, pos );	case COLOR_TYPE_ARGB8888:		return Graph_ARGBReplaceARGB( back, write_rect, fore, pos );	default:break;	}	return -1;}
开发者ID:rokite,项目名称:LCUI,代码行数:35,


示例2: Graph_Mix

int Graph_Mix( LCUI_Graph *back, const LCUI_Graph *fore, LCUI_Pos pos ){	LCUI_Graph write_slot;	LCUI_Rect read_rect, write_rect;	void (*mixer)(LCUI_Graph*, LCUI_Rect, const LCUI_Graph *, LCUI_Pos) = NULL;	/* 预先进行有效性判断 */	if( !Graph_IsValid(back) || !Graph_IsValid(fore) ) {		return -1;	}	write_rect.x = pos.x;	write_rect.y = pos.y;	write_rect.width = fore->width;	write_rect.height = fore->height;	LCUIRect_GetCutArea( Size( back->width, back->height ),			     write_rect, &read_rect );	write_rect.x += read_rect.x;	write_rect.y += read_rect.y;	write_rect.width = read_rect.width;	write_rect.height = read_rect.height;	Graph_Quote( &write_slot, back, &write_rect );	/* 获取实际操作区域 */	Graph_GetValidRect( &write_slot, &write_rect );	Graph_GetValidRect( fore, &read_rect );	/* 若读或写的区域无效 */	if( write_rect.width <= 0 || write_rect.height <= 0	 || read_rect.width <= 0 || read_rect.height <= 0 ) {		return -2;	}	pos.x = read_rect.x;	pos.y = read_rect.y;	/* 获取引用的源图像 */	fore = Graph_GetQuote( fore );	back = Graph_GetQuote( back );	switch( fore->color_type ) {	case COLOR_TYPE_RGB888:		if( back->color_type == COLOR_TYPE_RGB888 ) {			mixer = Graph_RGBReplaceRGB;		} else {			mixer = Graph_ARGBReplaceRGB;		}		break;	case COLOR_TYPE_ARGB8888:		if( back->color_type == COLOR_TYPE_RGB888 ) {			mixer = Graph_RGBMixARGB;		} else {			mixer = Graph_ARGBMixARGB;		}	default:break;	}	if( mixer ) {		mixer( back, write_rect, fore, pos );		return 0;	}	return -3;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:59,


示例3: Graph_FillImage

LCUI_API int Graph_FillImage(	LCUI_Graph *graph,				LCUI_Graph *bg, 				int mode,				LCUI_RGB color ){	LCUI_Size size;	LCUI_Pos pos;	LCUI_Graph temp_bg;	LCUI_BOOL replace_mix;		if( Check_Option( mode, GRAPH_MIX_FLAG_REPLACE ) ) {		/* 将alpha通道置为0 */		Graph_FillAlpha( graph, 0 );		replace_mix = TRUE;	} else {		/* 填充背景色,将alpha通道置为255 */		Graph_FillColor( graph, color );		Graph_FillAlpha( graph, 255 );		replace_mix = FALSE;	}	if(!Graph_IsValid(bg) || !Graph_IsValid(graph)) {		return -1; 	}	size.w = graph->w;	size.h = graph->h;	Graph_Init(&temp_bg);	pos.x = pos.y = 0;	/* 平铺 */	if( Check_Option( mode, LAYOUT_TILE ) ) {		return Graph_Tile( bg, graph, replace_mix );	}	/* 缩放 */	if( Check_Option( mode, LAYOUT_ZOOM ) ) {		Graph_Zoom( bg, &temp_bg, TRUE, size );		pos.x = (size.w - temp_bg.w) / 2.0;		pos.y = (size.h - temp_bg.h) / 2.0;		bg = &temp_bg;	}	/* 拉伸 */	else if( Check_Option( mode, LAYOUT_STRETCH ) ) {		Graph_Zoom( bg, &temp_bg, FALSE, size );		bg = &temp_bg;	}	/* 居中 */	else if( Check_Option( mode, LAYOUT_CENTER ) ) {		pos.x = (size.w - bg->w) / 2.0;		pos.y = (size.h - bg->h) / 2.0;	}	if( replace_mix ) {		Graph_Replace( graph, bg, pos );	} else {		Graph_Mix( graph, bg, pos );	}	Graph_Free( &temp_bg );	return 0; }
开发者ID:fshunj,项目名称:LCUI,代码行数:56,


示例4: PictureBox_MoveViewArea

/* 移动PictureBox部件内的图片的显示区域的位置 */LCUI_API intPictureBox_MoveViewArea( LCUI_Widget *widget, LCUI_Pos des_pos ){	LCUI_Size size;	LCUI_Graph *p;	LCUI_PictureBox *pic_box;		pic_box = Widget_GetPrivData(widget);		if(!Graph_IsValid(pic_box->image)) {		return -1;	}	if(pic_box->scale == 1.00 || !Graph_IsValid(&pic_box->buff_graph)) {		p = pic_box->image;	} else {		p = &pic_box->buff_graph;	}	size.w = pic_box->read_box.width;	size.h = pic_box->read_box.height;	/* 处理区域数据,使之为有效区域 */	if(des_pos.x < 0) {		des_pos.x = 0;	}	if(des_pos.y < 0) {		des_pos.y = 0;	}	if(des_pos.x + size.w > p->w) {		des_pos.x = p->w - size.w;	}	if(des_pos.y + size.h > p->h) {		des_pos.y = p->h - size.h;	}	if(des_pos.x == pic_box->read_box.x 	&& des_pos.y == pic_box->read_box.y) {		return 0; 	}	/* 更新图片盒子内的图像 */	pic_box->read_box.x = des_pos.x;	pic_box->read_box.y = des_pos.y;	/* 重新计算中心点的位置 */ 	pic_box->read_box.center_x = (des_pos.x + size.w/2.0)/p->w;	pic_box->read_box.center_y = (des_pos.y + size.h/2.0)/p->h;		Widget_Draw(widget);	//用于调试	//printf("read box: %d,%d,%d,%d; %d/%d, %d/%d/n", 	//pic_box->read_box.x, pic_box->read_box.y, 	//pic_box->read_box.width, pic_box->read_box.height, 	//pic_box->read_box.x + pic_box->read_box.width,	//pic_box->read_box.y + pic_box->read_box.height,	//pic_box->buff_graph.w, pic_box->buff_graph.h);	return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:54,


示例5: Graph_PutImage

LCUI_API int Graph_PutImage( LCUI_Graph *graph, LCUI_Graph *image, int flag ){	LCUI_Pos pos;		if(!Graph_IsValid(graph) || ! Graph_IsValid(image)) {		return -1; 	}	pos.x = pos.y = 0;	if((flag & ALIGN_TOP_LEFT) == ALIGN_TOP_LEFT); /* 左上角对齐 */	else if((flag & ALIGN_TOP_CENTER) == ALIGN_TOP_CENTER) {		/* 向上中间对齐 */		pos.x = (graph->w - image->w) / 2;  	}/* 向右上角对齐 */	else if((flag & ALIGN_TOP_RIGHT) == ALIGN_TOP_RIGHT) {		pos.x = graph->w - image->w;	}/* 向中央偏左对齐 */ 	else if((flag & ALIGN_MIDDLE_LEFT) == ALIGN_MIDDLE_LEFT) {		pos.y = (graph->h - image->h) / 2; 	}/* 向正中央对齐 */	else if((flag & ALIGN_MIDDLE_CENTER) == ALIGN_MIDDLE_CENTER) { 		pos.x = (graph->w - image->w) / 2;		pos.y = (graph->h - image->h) / 2;	}/* 向中央偏右对齐 */	else if((flag & ALIGN_MIDDLE_RIGHT) == ALIGN_MIDDLE_RIGHT) { 		pos.x = graph->w - image->w;		pos.y = (graph->h - image->h) / 2;	}/* 向底部偏左对齐 */ 	else if((flag & ALIGN_BOTTOM_LEFT) == ALIGN_BOTTOM_LEFT) {		pos.y = graph->h - image->h; 	}/* 向底部居中对齐 */	else if((flag & ALIGN_BOTTOM_CENTER) == ALIGN_BOTTOM_CENTER) { 		pos.x = (graph->w - image->w) / 2;		pos.y = graph->h - image->h;	}/* 向底部偏右对齐 */	else if((flag & ALIGN_BOTTOM_RIGHT) == ALIGN_BOTTOM_RIGHT) { 		pos.x = graph->w - image->w;		pos.y = graph->h - image->h;	}		if( Check_Option(flag, GRAPH_MIX_FLAG_OVERLAY) ) {	/* 如果包含GRAPH_MIX_FLAG_OVERLAY选项 */		Graph_Mix(graph, image, pos); 	}	else if( Check_Option(flag, GRAPH_MIX_FLAG_REPLACE) ) {	/* 如果包含GRAPH_MIX_FLAG_REPLACE选项 */		Graph_Replace(graph, image, pos); 	} else {		Graph_Mix(graph, image, pos);	}		return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:52,


示例6: Graph_VertiFlipARGB

static int Graph_VertiFlipARGB( const LCUI_Graph *graph, LCUI_Graph *buff ){	int y;	LCUI_Rect rect;	uchar_t *byte_src, *byte_des;	if(!Graph_IsValid(graph)) {		return -1;	}	Graph_GetValidRect( graph, &rect );	graph = Graph_GetQuote( graph );	buff->opacity = graph->opacity;	buff->color_type = graph->color_type;	if( 0 != Graph_Create( buff, rect.width, rect.height ) ) {		return -2;	}	byte_src = graph->bytes + (rect.y + rect.h - 1)*graph->bytes_per_row;	byte_src += rect.x * graph->bytes_per_pixel;	byte_des = buff->bytes;	for( y=0; y<rect.h; ++y ) {		memcpy( byte_des, byte_src, buff->bytes_per_row );		byte_src -= graph->bytes_per_row;		byte_des += buff->bytes_per_row;	}	return 0;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:26,


示例7: Graph_HorizFlipARGB

static int Graph_HorizFlipARGB( const LCUI_Graph *graph, LCUI_Graph *buff ){	int x, y;	LCUI_Rect rect;	LCUI_ARGB *pixel_src, *pixel_des;	if(!Graph_IsValid(graph)) {		return -1;	}	Graph_GetValidRect( graph, &rect );	graph = Graph_GetQuote( graph );	buff->opacity = graph->opacity;	buff->color_type = graph->color_type;	if( 0 != Graph_Create( buff, rect.width, rect.height ) ) {		return -2;	}	for( y=0; y<rect.h; ++y ) {		pixel_des = buff->argb + y*buff->w;		pixel_src = graph->argb + (rect.y+y)*graph->w;		pixel_src += rect.x + rect.w - 1;		for( x=0; x<rect.w; ++x ) {			*pixel_des++ = *pixel_src--;		}	}	return 0;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:27,


示例8: Graph_FillRectRGB

int Graph_FillRectRGB( LCUI_Graph *graph, LCUI_Color color, LCUI_Rect rect ){	int x, y;	LCUI_Graph canvas;	uchar_t *rowbytep, *bytep;	if(!Graph_IsValid(graph)) {		return -1;	}	Graph_Quote( &canvas, graph, &rect );	Graph_GetValidRect( &canvas, &rect );	graph = Graph_GetQuote( &canvas );	rowbytep = graph->bytes + rect.y*graph->bytes_per_row;	rowbytep += rect.x*graph->bytes_per_pixel;	for( y=0; y<rect.h; ++y ) {		bytep = rowbytep;		for( x=0; x<rect.w; ++x ) {			*bytep++ = color.blue;			*bytep++ = color.green;			*bytep++ = color.red;		}		rowbytep += graph->bytes_per_row;	}	return 0;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:25,


示例9: Graph_HorizFlipRGB

static int Graph_HorizFlipRGB( const LCUI_Graph *graph, LCUI_Graph *buff ){	int x, y, n;	LCUI_Rect rect;	uchar_t *byte_src, *byte_des;	if(!Graph_IsValid(graph)) {		return -1;	}	Graph_GetValidRect( graph, &rect );	graph = Graph_GetQuote( graph );	buff->color_type = graph->color_type;	if( 0 != Graph_Create( buff, rect.width, rect.height ) ) {		return -2;	}	for( y=0; y<rect.h; ++y ) {		byte_des = buff->bytes + y*buff->w*3;		n = ((rect.y+y)*graph->w + rect.x + rect.w - 1)*3;		byte_src = buff->bytes + n;		for( x=0; x<rect.w; ++x ) {			*byte_des++ = *byte_src--;			*byte_des++ = *byte_src--;			*byte_des++ = *byte_src--;		}	}	return 0;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:28,


示例10: Graph_FillAlpha

int Graph_FillAlpha( LCUI_Graph *graph, uchar_t alpha ){	int x, y;	LCUI_Rect rect;	LCUI_ARGB *pixel, *pixel_row;	Graph_GetValidRect( graph, &rect );	graph = Graph_GetQuote( graph );	if( !Graph_IsValid(graph) ) {		return -1;	}	if( !Graph_HasAlpha(graph) ) {		return -2;	}	pixel_row = graph->argb + rect.y*graph->w + rect.x;	for(y=0; y<rect.h; ++y) {		pixel = pixel_row;		for( x=0; x<rect.w; ++x ) {			pixel->alpha = alpha;			++pixel;		}		pixel_row += graph->w;	}	return 0;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:26,


示例11: Graph_GetPixel

LCUI_API LCUI_BOOL Graph_GetPixel( LCUI_Graph *graph, LCUI_Pos pos, LCUI_RGBA *pixel ){	int i;	LCUI_Rect rect;		if( pos.x < 0 || pos.y < 0 ) {		return FALSE;	}	rect = Graph_GetValidRect( graph );	/* 若坐标超出范围 */	if( pos.x >= rect.width || pos.y >= rect.height ) {		return FALSE;	}	graph = Graph_GetQuote( graph );	if( !Graph_IsValid(graph) ) {		return FALSE;	}	i = graph->w*(pos.y+rect.y) + pos.x + rect.x;	pixel->red = graph->rgba[0][i];	pixel->green = graph->rgba[1][i];	pixel->blue = graph->rgba[2][i];		if(graph->color_type == COLOR_TYPE_RGBA) {		pixel->alpha = graph->rgba[3][i];	} else {		pixel->alpha = 255;	}	return TRUE;}
开发者ID:fshunj,项目名称:LCUI,代码行数:29,


示例12: Graph_Free

LCUI_API void Graph_Free( LCUI_Graph *pic ){	LCUI_Graph *p;	if( pic && pic->quote ) {		pic->src = NULL; 		pic->quote = FALSE;		return;	}	p = Graph_GetQuote( pic );	if( !Graph_IsValid(p)) {		return;	}	LCUIMutex_Lock( &p->mutex );	free( p->rgba[0] );	free( p->rgba[1] );	free( p->rgba[2] );	if( p->color_type == COLOR_TYPE_RGBA ) {		free( p->rgba[3] );	}	free( p->rgba );	p->rgba = NULL;	p->w = 0;	p->h = 0;	LCUIMutex_Unlock( &p->mutex );	LCUIMutex_Destroy( &pic->mutex );}
开发者ID:fshunj,项目名称:LCUI,代码行数:27,


示例13: Graph_FillAlpha

LCUI_API int Graph_FillAlpha( LCUI_Graph *src, uchar_t alpha ){	int y, row_start;	LCUI_Rect src_rect;		/* 获取引用的区域在源图形中的有效区域 */	src_rect = Graph_GetValidRect( src );	/* 获取引用的源图指针 */	src = Graph_GetQuote( src );		if(! Graph_IsValid(src) ) {		return -1;	}	if( !Graph_HaveAlpha(src) ) {		return -2;	}		row_start = src_rect.x + src_rect.y * src->w;	for(y=0; y<src_rect.height; ++y) {		memset( &src->rgba[3][row_start], 			alpha, src_rect.width*sizeof(uchar_t) );		row_start += src->w;	}	return 0; }
开发者ID:fshunj,项目名称:LCUI,代码行数:25,


示例14: PictureBox_ZoomViewArea

/* 缩放PictureBox部件的图片浏览区域 */LCUI_API intPictureBox_ZoomViewArea( LCUI_Widget *widget, double scale ){	LCUI_Graph buff, temp;	LCUI_PictureBox *pic_box;		pic_box = Widget_GetPrivData(widget);	if(!Graph_IsValid(pic_box->image)) {		return -1;	}	Graph_Init(&buff);	Graph_Init(&temp);	/* 有效范围为2%~2000% */	if(scale < 0.02) {		scale = 0.02;	}	if(scale > 20) {		scale = 20;	}	if(pic_box->size_mode != SIZE_MODE_ZOOM	 && pic_box->size_mode != SIZE_MODE_BLOCK_ZOOM) {		pic_box->size_mode = SIZE_MODE_ZOOM; /* 改为缩放模式 */	}	pic_box->scale = scale; 	Update_BuffGraph(widget); 	Update_ReadBox(widget);	Widget_Draw(widget);	Widget_Refresh(widget);	return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:31,


示例15: Graph_VertiFlip

LCUI_API int Graph_VertiFlip( LCUI_Graph *src_graph, LCUI_Graph *out_graph ){	uchar_t buff;	LCUI_Rect rect;	int x, y, center; 	int src_top_pos, src_bottom_pos;	int des_top_pos, des_bottom_pos;	int src_start_top_pos, src_start_bottom_pos;	int des_start_top_pos, des_start_bottom_pos;	if(!Graph_IsValid(src_graph)) {		return -1;	}	src_graph = Graph_GetQuote(src_graph );	rect = Graph_GetValidRect( src_graph );	out_graph->color_type = src_graph->color_type;	if( 0 != Graph_Create(out_graph, rect.width, rect.height ) ) {		return -2;	}	center = (int)(rect.height / 2.0);	/* 记录基坐标 */	des_start_top_pos = 0;	des_start_bottom_pos = (rect.height-1)*rect.width;	src_start_top_pos = rect.y * src_graph->w + rect.x;	src_start_bottom_pos = (rect.y + rect.height-1)*src_graph->w + rect.x;	for (x=0; x < rect.width; ++x) {		/* 当前坐标=基坐标+x */		des_top_pos = des_start_top_pos + x;		des_bottom_pos = des_start_bottom_pos + x;		src_top_pos = src_start_top_pos + x;		src_bottom_pos = src_start_bottom_pos + x;		for (y = 0; y <= center; ++y) {			buff = src_graph->rgba[0][src_top_pos]; 			out_graph->rgba[0][des_top_pos] = src_graph->rgba[0][src_bottom_pos];  			out_graph->rgba[0][des_bottom_pos] = buff;			buff = src_graph->rgba[1][src_top_pos]; 			out_graph->rgba[1][des_top_pos] = src_graph->rgba[1][src_bottom_pos];  			out_graph->rgba[1][des_bottom_pos] = buff;			buff = src_graph->rgba[2][src_top_pos]; 			out_graph->rgba[2][des_top_pos] = src_graph->rgba[2][src_bottom_pos];  			out_graph->rgba[2][des_bottom_pos] = buff;			if(src_graph->color_type == COLOR_TYPE_RGBA) {				buff = src_graph->rgba[3][src_top_pos]; 				out_graph->rgba[3][des_top_pos] = src_graph->rgba[3][src_bottom_pos];  				out_graph->rgba[3][des_bottom_pos] = buff;			}			src_top_pos += src_graph->w;			des_top_pos += rect.width;			src_bottom_pos -= src_graph->w;			des_bottom_pos -= rect.width;		}	}	return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:59,


示例16: Load_Graph_Default_Cursor

LCUI_API int Load_Graph_Default_Cursor(LCUI_Graph *pic)/* 功能:载入默认的鼠标指针的图形 */{	unsigned char red[]={		3,3,0,0,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,3,229,3,3,0,0,0,0,0,		0,0,0,3,255,229,3,3,0,0,0,0,0,0,0,3,255,255,229,3,3,0,0,0,0,0,0,3,255,255,255,229,		3,3,0,0,0,0,0,3,255,255,255,255,229,3,3,0,0,0,0,3,255,255,255,255,253,226,3,3,0,0,0,3,		255,255,255,253,251,248,220,3,3,0,0,3,255,255,253,251,248,245,241,214,3,3,0,3,255,253,251,248,245,241,238,234,		207,3,3,3,253,251,248,245,241,238,234,230,226,201,3,3,251,248,245,217,238,234,3,3,3,3,3,3,248,245,217,3,		164,230,3,3,0,0,0,3,245,217,3,3,3,226,201,3,0,0,0,3,217,3,3,0,3,176,219,3,3,0,0,3,		3,3,0,0,3,3,216,192,3,0,0,0,0,0,0,0,0,3,192,211,3,0,0,0,0,0,0,0,0,3,3,3,		3,0,0};	unsigned char green[]={		6,6,0,0,0,0,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,6,230,6,6,0,0,0,0,0,		0,0,0,6,255,230,6,6,0,0,0,0,0,0,0,6,255,255,230,6,6,0,0,0,0,0,0,6,255,255,255,230,		6,6,0,0,0,0,0,6,255,255,255,255,230,6,6,0,0,0,0,6,255,255,255,255,253,226,6,6,0,0,0,6,		255,255,255,253,251,248,221,6,6,0,0,6,255,255,253,251,248,245,241,214,6,6,0,6,255,253,251,248,245,241,238,234,		207,6,6,6,253,251,248,245,241,238,234,230,226,201,6,6,251,248,245,217,238,234,6,6,6,6,6,6,248,245,217,6,		165,230,6,6,0,0,0,6,245,217,6,6,6,226,201,6,0,0,0,6,217,6,6,0,6,176,219,6,6,0,0,6,		6,6,0,0,6,6,216,192,6,0,0,0,0,0,0,0,0,6,192,211,6,0,0,0,0,0,0,0,0,6,6,6,		6,0,0};	unsigned char blue[]={		26,26,0,0,0,0,0,0,0,0,0,0,26,26,26,0,0,0,0,0,0,0,0,0,26,232,26,26,0,0,0,0,0,		0,0,0,26,255,232,26,26,0,0,0,0,0,0,0,26,255,255,232,26,26,0,0,0,0,0,0,26,255,255,255,232,		26,26,0,0,0,0,0,26,255,255,255,255,232,26,26,0,0,0,0,26,255,255,255,255,253,228,26,26,0,0,0,26,		255,255,255,253,251,248,223,26,26,0,0,26,255,255,253,251,248,245,241,216,26,26,0,26,255,253,251,248,245,241,238,234,		209,26,26,26,253,251,248,245,241,238,234,230,226,203,26,26,251,248,245,219,238,234,26,26,26,26,26,26,248,245,219,26,		171,230,26,26,0,0,0,26,245,219,26,26,26,226,203,26,0,0,0,26,219,26,26,0,26,181,219,26,26,0,0,26,		26,26,0,0,26,26,216,194,26,0,0,0,0,0,0,0,0,26,194,211,26,0,0,0,0,0,0,0,0,26,26,26,		26,0,0};	unsigned char alpha[]={		231,55,0,0,0,0,0,0,0,0,0,0,231,189,55,0,0,0,0,0,0,0,0,0,231,255,189,55,0,0,0,0,0,		0,0,0,231,255,255,189,55,0,0,0,0,0,0,0,231,255,255,255,189,55,0,0,0,0,0,0,231,255,255,255,255,		189,55,0,0,0,0,0,231,255,255,255,255,255,189,55,0,0,0,0,231,255,255,255,255,255,255,189,55,0,0,0,231,		255,255,255,255,255,255,255,189,55,0,0,231,255,255,255,255,255,255,255,255,189,55,0,231,255,255,255,255,255,255,255,255,		255,189,55,231,255,255,255,255,255,255,255,255,255,255,189,231,255,255,255,255,255,255,189,189,189,189,189,231,255,255,255,244,		255,255,188,77,0,0,0,231,255,255,244,55,211,255,255,211,0,0,0,231,255,244,55,0,180,255,255,180,77,0,0,189,		244,55,0,0,55,215,255,255,209,0,0,0,0,0,0,0,0,180,255,255,204,0,0,0,0,0,0,0,0,26,215,158,		49,0,0};	int value;	if(Graph_IsValid(pic)) {		Graph_Free(pic);	}	Graph_Init(pic);	pic->have_alpha = TRUE;	pic->type = TYPE_PNG;	pic->alpha = 255;	value = Graph_Create(pic,12,19);	if(value == 0) {		memcpy(pic->rgba[0], red, sizeof(red));		memcpy(pic->rgba[1], green, sizeof(green));		memcpy(pic->rgba[2], blue, sizeof(blue));		memcpy(pic->rgba[3], alpha, sizeof(alpha));	}	return value;}
开发者ID:yydaor,项目名称:LCUI,代码行数:56,


示例17: Graph_Tile

LCUI_API int Graph_Tile( LCUI_Graph *src, LCUI_Graph *des, LCUI_BOOL replace ){	int ret = 0;	LCUI_Pos pos;		if(!Graph_IsValid(src) || !Graph_IsValid(des)) {		return -1;	}	for(pos.y=0; pos.y<des->h; pos.y+=src->h) {		for(pos.x=0; pos.x<des->w; pos.x+=src->w) {			if( replace ) {				ret += Graph_Replace( des, src, pos );			} else {				ret += Graph_Mix( des, src, pos );			}		}	}	return ret;}
开发者ID:fshunj,项目名称:LCUI,代码行数:19,


示例18: Graph_Zoom

LCUI_API int Graph_Zoom(	LCUI_Graph *in_graph,				LCUI_Graph *out_graph, 				LCUI_BOOL keep_scale,				LCUI_Size size ){	LCUI_Graph *src;	LCUI_Rect rect;	LCUI_Pos pos; 	int des_n, src_n, x, y, k, m;	double scale_x,scale_y;	if(!Graph_IsValid(in_graph)) {		return -1;	}	if(size.w <=0 || size.h <= 0) { 		Graph_Free(out_graph);		return -1;	}	/* 获取引用的有效区域,以及指向引用的对象的指针 */	rect = Graph_GetValidRect(in_graph);	src = Graph_GetQuote(in_graph);	scale_x = (double)rect.width / size.w;	scale_y = (double)rect.height / size.h;	/* 如果缩放方式为缺省,图像的宽和高的缩放比例将会一样 */	if( keep_scale ) {		if (scale_x<scale_y) {			scale_y = scale_x; 		} else {			scale_x = scale_y;		}	}	out_graph->color_type = in_graph->color_type;	if( Graph_Create(out_graph, size.w, size.h) < 0) {		return -2;	}	for (y=0; y < size.h; ++y)  {		pos.y = y*scale_y;		k = y*size.w;		m = (pos.y+rect.y)*src->w + rect.x;		for (x = 0; x < size.w; ++x) {			pos.x = x*scale_x; 			src_n  = k + x;			des_n = m + pos.x;			out_graph->rgba[0][src_n] = src->rgba[0][des_n];			out_graph->rgba[1][src_n] = src->rgba[1][des_n];			out_graph->rgba[2][src_n] = src->rgba[2][des_n];			if( in_graph->color_type == COLOR_TYPE_RGBA) {				out_graph->rgba[3][src_n] = src->rgba[3][des_n];			}		}	} 	return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:54,


示例19: Graph_Tile

int Graph_Tile( LCUI_Graph *buff,  const LCUI_Graph *graph,		LCUI_BOOL replace ){	int ret = 0;	LCUI_Pos pos;	if(!Graph_IsValid(graph) || !Graph_IsValid(buff)) {		return -1;	}	for(pos.y=0; pos.y<buff->h; pos.y+=graph->h) {		for(pos.x=0; pos.x<buff->w; pos.x+=graph->w) {			if( replace ) {				ret += Graph_Replace( buff, graph, pos );			} else {				ret += Graph_Mix( buff, graph, pos );			}		}	}	return ret;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:20,


示例20: Graph_Copy

LCUI_API void Graph_Copy( LCUI_Graph *des, LCUI_Graph *src ){	if( !des || !Graph_IsValid(src) ) {		return;	}		des->color_type = src->color_type;	/* 创建合适尺寸的Graph */	Graph_Create( des, src->w, src->h );	Graph_Replace( des, src, Pos(0,0) );	des->alpha = src->alpha;}
开发者ID:fshunj,项目名称:LCUI,代码行数:12,


示例21: Widget_IsPaintable

/** 判断部件是否有可绘制内容 */static LCUI_BOOL Widget_IsPaintable( LCUI_Widget w ){	const LCUI_WidgetStyle *s = &w->computed_style;	if( s->background.color.alpha > 0 ||	    Graph_IsValid( &s->background.image ) ||	    s->border.top.width > 0 || s->border.right.width > 0 ||	    s->border.bottom.width > 0 || s->border.left.width > 0 ||	    s->shadow.blur > 0 || s->shadow.spread > 0 ) {		return TRUE;	}	return w->proto && w->proto->paint;}
开发者ID:spacefan,项目名称:LCUI,代码行数:13,


示例22: TextLayer_Draw

/** 绘制文本 */int TextLayer_Draw( LCUI_TextLayer* layer ){	LCUI_Rect rect;	/* 如果文本位图缓存无效 */	if( layer->is_using_buffer && !Graph_IsValid( &layer->graph ) ) {		return -1;	}	rect.x = 0;	rect.y = 0;	rect.w = layer->max_width;	rect.h = layer->max_height;	return TextLayer_DrawToGraph( layer, rect, Pos(0,0), &layer->graph );}
开发者ID:oyjGit,项目名称:LCUI,代码行数:14,


示例23: select_cloth

/* 玩家选择布 */static void select_cloth( LCUI_Widget *widget, LCUI_WidgetEvent *unused ){	if(!Graph_IsValid(&left_cloth)) {		Graph_HorizFlip( &cloth, &left_cloth );	}	PictureBox_SetImage( me_pic_box, &left_cloth ); 	Widget_Disable( btn_j );	Widget_Disable( btn_s );	Widget_Disable( btn_b );	Widget_Enable( btn_next );	run_game(2);}
开发者ID:yydaor,项目名称:LCUI,代码行数:14,


示例24: Graph_Copy

void Graph_Copy( LCUI_Graph *des, const LCUI_Graph *src ){	const LCUI_Graph *graph;	if( !des || !Graph_IsValid(src) ) {		return;	}	graph = Graph_GetQuote( src );	des->color_type = graph->color_type;	/* 创建合适尺寸的Graph */	Graph_Create( des, src->w, src->h );	Graph_Replace( des, src, Pos(0,0) );	des->opacity = src->opacity;}
开发者ID:WhatDream,项目名称:LCUI,代码行数:13,


示例25: PictureBox_SetInitImage

/* 设定正在加载另一图像时显示的图像 */LCUI_API intPictureBox_SetInitImage( LCUI_Widget *widget, LCUI_Graph *pic ){	LCUI_PictureBox *pic_box;		pic_box = Widget_GetPrivData(widget);		if(Graph_IsValid(pic)) {		Graph_Copy(&pic_box->initial_image, pic);		return 0;	}	return -1;}
开发者ID:fshunj,项目名称:LCUI,代码行数:14,


示例26: Graph_HorizFlip

LCUI_API int Graph_HorizFlip( LCUI_Graph *src_graph, LCUI_Graph *out_graph ){	int x, y, center;	int src_left_pos, src_right_pos;	int des_left_pos, des_right_pos;	uchar_t buff;	LCUI_Graph *src;	LCUI_Rect rect;	if(!Graph_IsValid(src_graph)) {		return -1;	}	rect = Graph_GetValidRect( src_graph );	src = Graph_GetQuote( src_graph );	out_graph->color_type = src->color_type;	if( 0 != Graph_Create( out_graph, rect.width, rect.height ) ) {		return -2;		}	/* 水平翻转其实也就是交换两边的数据 */  	center = (int)(rect.width / 2.0);	for (y = 0; y < rect.height; ++y) {		des_left_pos = y * rect.width;		des_right_pos = des_left_pos + rect.width -1;		src_left_pos = (y + rect.y) * src->w + rect.x;		src_right_pos = src_left_pos + rect.width -1;		for (x = 0; x <= center; ++x)  {			buff = src->rgba[0][src_left_pos]; 			out_graph->rgba[0][des_left_pos] = src->rgba[0][src_right_pos];  			out_graph->rgba[0][des_right_pos] = buff;			buff = src->rgba[1][src_left_pos]; 			out_graph->rgba[1][des_left_pos] = src->rgba[1][src_right_pos];  			out_graph->rgba[1][des_right_pos] = buff;			buff = src->rgba[2][src_left_pos]; 			out_graph->rgba[2][des_left_pos] = src->rgba[2][src_right_pos];  			out_graph->rgba[2][des_right_pos] = buff;			if(src->color_type == COLOR_TYPE_RGBA) {				buff = src->rgba[3][src_left_pos]; 				out_graph->rgba[3][des_left_pos] = src->rgba[3][src_right_pos];  				out_graph->rgba[3][des_right_pos] = buff;			}			++src_left_pos;			++des_left_pos;			--src_right_pos;			--des_right_pos;		}	} 	return 0;}
开发者ID:fshunj,项目名称:LCUI,代码行数:51,


示例27: LCUIScreen_PutGraph

LCUI_API intLCUIScreen_PutGraph (LCUI_Graph *graph, LCUI_Pos des_pos ){	int total, y, n, des_row_x, src_row_x, des_x, src_x;	LCUI_Graph *src;	LCUI_Rect cut, src_rect;	LCUI_Size screen_size;	uchar_t *des_ptr;		src = Graph_GetQuote( graph );	src_rect = Graph_GetValidRect( graph );	screen_size = LCUIScreen_GetSize();		if(!Graph_IsValid(src)) {		return -1;	}	if(des_pos.x >= screen_size.w || des_pos.y >= screen_size.h) {		return -1;	}	des_ptr = pixel_mem;	Graph_Lock( src );	/* 获取图像的截取区域 */ 	if( LCUIRect_GetCutArea( screen_size,		Rect( des_pos.x, des_pos.y, src_rect.width, src_rect.height ),		&cut	)) {		des_pos.x += cut.x;		des_pos.y += cut.y;	}	/* 根据二维坐标和图像尺寸,计算源图像的起始读取点的一维坐标 */	src_row_x = (cut.y + src_rect.y) * src->width + cut.x + src_rect.x;	/* 根据二维坐标和屏幕尺寸,计算帧缓冲的起始写入点的一维坐标 */	des_row_x = des_pos.y * screen_size.w + des_pos.x;	for(y=0; y<cut.height; ++y) {		src_x = src_row_x;		des_x = des_row_x;		total = src_x + cut.width;		for (; src_x < total; ++des_x,++src_x) {			n = des_x << 2;			des_ptr[n++] = src->rgba[2][src_x];			des_ptr[n++] = src->rgba[1][src_x];			des_ptr[n++] = src->rgba[0][src_x];		}		src_row_x += src->width;		/* DIB扫描行是上下颠倒的,因此是从行尾到行首递减 */		des_row_x += screen_size.w;	}	Graph_Unlock( src );	return 0;}
开发者ID:yydaor,项目名称:LCUI,代码行数:51,


示例28: Graph_ZoomRGB

static int Graph_ZoomRGB( const LCUI_Graph *graph,			  LCUI_Graph *buff,			  LCUI_BOOL keep_scale,			  LCUI_Size size ){	LCUI_Rect rect;	int x, y, src_x, src_y, tmp;	double scale_x, scale_y;	uchar_t *byte_src, *byte_des;	if( !Graph_IsValid(graph) ) {		return -1;	}	if( size.w <= 0 || size.h <= 0 ) {		Graph_Free( buff );		return -1;	}	/* 获取引用的有效区域,以及指向引用的对象的指针 */	Graph_GetValidRect( graph, &rect );	graph = Graph_GetQuote( graph );	scale_x = (double)rect.width / size.w;	scale_y = (double)rect.height / size.h;	/* 如果保持宽高比 */	if( keep_scale ) {		if (scale_x<scale_y) {			scale_y = scale_x;		} else {			scale_x = scale_y;		}	}	buff->color_type = graph->color_type;	if( Graph_Create(buff, size.w, size.h) < 0) {		return -2;	}	for( y=0; y < size.h; ++y )  {		src_y = y * scale_y;		tmp = ((src_y + rect.y) * graph->w + rect.x) * 3;		byte_des = buff->bytes + y * size.w * 3;		for( x=0; x < size.w; ++x ) {			src_x = x * scale_x * 3;			byte_src = graph->bytes + tmp + src_x;			*byte_des++ = *byte_src++;			*byte_des++ = *byte_src++;			*byte_des++ = *byte_src++;		}	}	return 0;}
开发者ID:rokite,项目名称:LCUI,代码行数:49,


示例29: select_stone

/* 玩家选择石头 */static voidselect_stone( LCUI_Widget *widget, LCUI_WidgetEvent *unused ){	/* 如果没有存储已水平翻转的图像,就进行水平翻转 */	if(!Graph_IsValid(&left_stone)) {		Graph_HorizFlip(&stone, &left_stone);	}	/* 设定显示的图像为石头 */	PictureBox_SetImage(me_pic_box, &left_stone);	Widget_Disable(btn_j);	Widget_Disable(btn_s);	Widget_Disable(btn_b);	Widget_Enable(btn_next);	run_game(0);/* 进入游戏 */}
开发者ID:yydaor,项目名称:LCUI,代码行数:16,



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


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