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; }
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; }
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; }
static void LoadCloseButtonIMG( LCUI_Graph *graph ) { graph->color_type = COLOR_TYPE_ARGB; Graph_Create( graph, 10, 10 ); Graph_FillColor( graph, RGB(255,255,255) ); Graph_SetAlphaBits( graph, close_btn_alpha, 10*10 ); }
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; }
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; }
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; }
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; }
static size_t WidgetRenderer_Render( LCUI_WidgetRenderer renderer ) { size_t count = 0; LCUI_PaintContextRec self_paint; LCUI_WidgetRenderer that = renderer; /* 如果部件有需要绘制的内容 */ if( that->can_render_self ) { count += 1; self_paint = *that->paint; self_paint.canvas = that->self_graph; Widget_OnPaint( that->target, &self_paint ); /* 若不需要缓存自身位图则直接绘制到画布上 */ if( !that->has_self_graph ) { Graph_Mix( &that->paint->canvas, &that->self_graph, 0, 0, that->paint->with_alpha ); } } if( that->can_render_centent ) { count += WidgetRenderer_RenderChildren( that ); } /* 如果与圆角边框重叠,则裁剪掉边框外的内容 */ if( that->is_cover_border ) { /* content_graph ... */ } if( !that->has_layer_graph ) { if( that->has_content_graph ) { Graph_Mix( &that->paint->canvas, &that->content_graph, that->content_paint_rect.x, that->content_paint_rect.y, TRUE ); } return count; } /* 若需要绘制的是当前部件图层,则先混合部件自身位图和内容位图,得出当 * 前部件的图层,然后将该图层混合到输出的位图中 */ if( that->can_render_self ) { Graph_Copy( &that->layer_graph, &that->self_graph ); Graph_Mix( &that->layer_graph, &that->content_graph, that->content_paint_rect.x, that->content_paint_rect.y, TRUE ); } else { Graph_Create( &that->layer_graph, that->paint->rect.width, that->paint->rect.height ); Graph_Replace( &that->layer_graph, &that->content_graph, that->content_paint_rect.x, that->content_paint_rect.y ); } that->layer_graph.opacity = that->target->computed_style.opacity; Graph_Mix( &that->paint->canvas, &that->layer_graph, 0, 0, that->paint->with_alpha ); return count; }
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; }
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; }
int LCUI_ReadBMP( LCUI_ImageReader reader, LCUI_Graph *graph ) { size_t n, row, bytes_per_row; unsigned char *buffer, *dest; LCUI_BMPReader bmp_reader = reader->data; INFOHEADER *info = &bmp_reader->info; if( reader->type != LCUI_BMP_READER ) { return -EINVAL; } if( reader->header.type == LCUI_UNKNOWN_IMAGE ) { if( LCUI_ReadBMPHeader( reader ) != 0 ) { return -ENODATA; } } /* 信息头中的偏移位置是相对于起始处,需要减去当前已经偏移的位置 */ n = bmp_reader->header.offset - bmp_reader->info.size - 14; reader->fn_skip( reader->stream_data, n ); if( 0 != Graph_Create( graph, info->width, info->height ) ) { return -ENOMEM; } /* 暂时不实现其它色彩类型处理 */ if( info->bits != 24 ) { return -ENOSYS; } bytes_per_row = (info->bits * info->width + 31) / 32 * 4; if( bytes_per_row < graph->bytes_per_row ) { return -EINVAL; } buffer = malloc( bytes_per_row ); if( !buffer ) { return -ENOMEM; } /* 从最后一行开始保存 */ dest = graph->bytes + graph->bytes_per_row * (graph->height - 1); for( row = 0; row < info->height; ++row ) { n = reader->fn_read( reader->stream_data, buffer, bytes_per_row ); if( n < bytes_per_row ) { break; } memcpy( dest, buffer, graph->bytes_per_row ); dest -= graph->bytes_per_row; if( reader->fn_prog ) { reader->fn_prog( reader->prog_arg, 100.0f * row / info->height ); } } free( buffer ); return 0; }
int TextLayer_SetMaxSize( LCUI_TextLayer layer, int width, int height ) { layer->max_width = width; layer->max_height = height; if( layer->is_using_buffer ) { Graph_Create( &layer->graph, width, height ); } layer->task.redraw_all = TRUE; if( layer->is_autowrap_mode ) { layer->task.typeset_start_row = 0; layer->task.update_typeset = TRUE; } return 0; }
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; }
static void Window_GetCloseButtonBG( LCUI_Graph *graph ) { unsigned char alpha[]={ 0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff, 0x00,0xff,0xff,0x00,0x00,0xff,0xff,0x00, 0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00, 0x00,0xff,0xff,0x00,0x00,0xff,0xff,0x00, 0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff, }; graph->color_type = COLOR_TYPE_RGBA; Graph_Create( graph, 8, 7 ); Graph_FillColor( graph, RGB(255,255,255) ); memcpy( graph->rgba[3], alpha, sizeof(alpha) ); }
/** 设置最大尺寸 */ int TextLayer_SetMaxSize( LCUI_TextLayer *layer, LCUI_Size new_size ) { if( new_size.w <= 0 || new_size.h <= 0 ) { return -1; } layer->max_width = new_size.w; layer->max_height = new_size.h; if( layer->is_using_buffer ) { Graph_Create( &layer->graph, new_size.w, new_size.h ); } layer->task.redraw_all = TRUE; if( layer->is_autowrap_mode ) { layer->task.typeset_start_row = 0; layer->task.update_typeset = TRUE; } return 0; }
LCUI_API int GraphLayer_Resize( LCUI_GraphLayer *glayer, int w, int h ) { if( !glayer ) { return -1; } /* 尺寸没有变化的话就返回 */ if( glayer->graph.w == w && glayer->graph.h == h) { return 1; } /* 调整图层尺寸 */ if( 0 != Graph_Create( &glayer->graph, w, h ) ) { return -2; } return 0; }
static int Graph_CutRGB( const LCUI_Graph *graph, LCUI_Rect rect, LCUI_Graph *buff ) { int y; uchar_t *byte_src_row, *byte_des_row; buff->color_type = graph->color_type; if( 0 != Graph_Create(buff, rect.width, rect.height) ) { return -1; } buff->opacity = graph->opacity; byte_des_row = buff->bytes; byte_src_row = graph->bytes + rect.y*graph->bytes_per_row; byte_src_row += rect.x * graph->bytes_per_pixel; for( y=0; y<rect.h; ++y ) { memcpy( byte_des_row, byte_src_row, buff->bytes_per_row ); byte_des_row += buff->bytes_per_row; byte_src_row += graph->bytes_per_row; } return 0; }
static int RadioButton_LoadDefaultGraph( LCUI_Graph *buff, int img_res_id ) { int size; if( img_res_id >= IMG_TOTAL_NUM ) { return -1; } if( Graph_IsValid( buff ) ) { Graph_Free( buff ); } Graph_Init( buff ); buff->color_type = COLOR_TYPE_RGBA;; buff->alpha = 255; size = 15*15*sizeof(unsigned char); if( Graph_Create( buff, 15, 15 ) != 0 ) { return -2; } memcpy( buff->rgba[0], RadioButton[img_res_id][0], size ); memcpy( buff->rgba[1], RadioButton[img_res_id][1], size ); memcpy( buff->rgba[2], RadioButton[img_res_id][2], size ); memcpy( buff->rgba[3], RadioButton[img_res_id][3], size ); return 0; }
static void Exec_Update_ProgressBar(LCUI_Widget *widget) /* 功能:更新进度条的图形 */ { LCUI_ProgressBar *pb = (LCUI_ProgressBar*)Get_Widget_PrivData(widget); if(Strcmp(&widget->style, "dynamic") == 0) { /* 绘制空槽 */ Draw_Empty_Slot(&widget->graph, widget->size.w, widget->size.h); Set_Widget_Border_Style(widget, BORDER_STYLE_NONE); /* 载入两个图形 */ if(!Graph_Valid(&pb->fore_graph)) Load_Graph_ProgressBar_Fore(&pb->fore_graph); if(!Graph_Valid(&pb->flash_image)) Load_Graph_ProgressBar_Img(&pb->flash_image); Resize_Widget(pb->img_pic_box, Get_Graph_Size(&pb->flash_image)); /* 让图片盒子显示这个图形 */ Set_PictureBox_Image_From_Graph(pb->img_pic_box, &pb->flash_image); } else { Strcpy(&widget->style, "classic"); if(!Graph_Valid(&pb->fore_graph)) Graph_Create(&pb->fore_graph, 10, widget->size.h); Graph_Fill_Color(&pb->fore_graph, RGB(80,80,200)); Graph_Fill_Alpha(&pb->fore_graph, 255); } /* 让图片盒子显示这个图形 */ Set_PictureBox_Image_From_Graph(pb->fore_pic_box, &pb->fore_graph); int width, height; /* 计算进度条的长度 */ width = (widget->size.w - widget->border.left - widget->border.right) * pb->value / pb->max_value + 0.5; height = widget->size.h - widget->border.top - widget->border.bottom; Move_Widget(pb->fore_pic_box, Pos(widget->border.left, widget->border.top)); /* 改变进度条的尺寸 */ Resize_Widget(pb->fore_pic_box, Size(width, height)); }
static int Graph_CutARGB( const LCUI_Graph *graph, LCUI_Rect rect, LCUI_Graph *buff ) { int x, y; LCUI_ARGB *pixel_src, *pixel_des; buff->color_type = graph->color_type; if( 0 != Graph_Create(buff, rect.width, rect.height) ) { return -1; } buff->opacity = graph->opacity; for( y=0; y<rect.h; ++y ) { pixel_des = buff->argb + y*buff->w; pixel_src = graph->argb; pixel_src += (rect.y+y)*graph->w + rect.x; for( x=0; x<rect.w; ++x ) { *pixel_des++ = *pixel_src++; } } return 0; }
LCUI_EXPORT(int) Load_Graph_Mosaics(LCUI_Graph *pic) /* 功能:载入马赛克图形 */ { unsigned char color[]={ 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 78,78,78,78,78,78,78,78,121,121,121,121,121,121,121,121, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, 121,121,121,121,121,121,121,121,78,78,78,78,78,78,78,78, }; int value; if(Graph_IsValid(pic)) { Graph_Free(pic); } Graph_Init(pic); pic->have_alpha = FALSE; pic->type = TYPE_PNG; pic->alpha = 255; value = Graph_Create(pic,16,16); if(value == 0){ memcpy(pic->rgba[0],color,sizeof(color)); memcpy(pic->rgba[1],color,sizeof(color)); memcpy(pic->rgba[2],color,sizeof(color)); } return value; }
Resize_Frames(LCUI_Frames *p, LCUI_Size new_size) /* 功能:调整动画的容器尺寸 */ { int i, total; LCUI_Pos pos; LCUI_Frame *frame; LCUI_Graph *graph; LCUI_Size size; if(new_size.w <= 0 || new_size.h <= 0) { return -1; } if( !p ) { return -2; } p->size = new_size; total = Queue_GetTotal(&p->pic); for(i=0; i<total; ++i){ frame = Queue_Get(&p->pic, i); graph = frame->pic->src; size = Graph_GetSize(graph); pos = Frames_GetFrameMixPos(p, frame); if(pos.x+size.w > new_size.w){ size.w = new_size.w - pos.x; size.w<0 ? size.w=0 :1; } if(pos.y+size.h > new_size.h){ size.h = new_size.h - pos.y; size.h<0 ? size.h=0 :1; } Graph_Quote(frame->pic, graph, Rect(0,0,size.w, size.h)); } Graph_Create(&p->slot, new_size.w, new_size.h); Frames_UpdateGraphSlot( p, p->current ); Frames_CallFunc( p ); return 0; }
int test_string_render( void ) { int ret; LCUI_Graph img; LCUI_Pos pos = {0, 80}; LCUI_Rect area = {0, 0, 320, 240}; LCUI_TextLayer txt = TextLayer_New(); LCUI_TextStyleRec txtstyle; /* 初始化字体处理功能 */ LCUI_InitFontLibrary(); /* 创建一个图像,并使用灰色填充 */ Graph_Init( &img ); Graph_Create( &img, 320, 240 ); Graph_FillRect( &img, RGB( 240, 240, 240 ), NULL, FALSE ); /* 设置文本的字体大小 */ TextStyle_Init( &txtstyle ); txtstyle.pixel_size = 24; txtstyle.has_pixel_size = TRUE; /* 设置文本图层的固定尺寸、文本样式、文本内容、对齐方式 */ TextLayer_SetFixedSize( txt, 320, 240 ); TextLayer_SetTextStyle( txt, &txtstyle ); TextLayer_SetTextAlign( txt, SV_CENTER ); TextLayer_SetTextW( txt, L"这是一段测试文本\nHello, World!", NULL ); TextLayer_Update( txt, NULL ); /* 将文本图层绘制到图像中,然后将图像写入至 png 文件中 */ TextLayer_DrawToGraph( txt, area, pos, &img ); ret = LCUI_WritePNGFile( "test_string_render.png", &img ); Graph_Free( &img ); /* 释放字体处理功能相关资源 */ LCUI_FreeFontLibrary(); return ret; }
LCUI_API int Graph_Cut( LCUI_Graph *src_graph, LCUI_Rect rect, LCUI_Graph *out_graph ) { int k, x, y, des_n, src_n; out_graph->alpha = src_graph->alpha; rect = LCUIRect_ValidArea(Size(src_graph->w, src_graph->h), rect); if( !Graph_IsValid(src_graph) || rect.width <= 0 || rect.height <= 0) { return -1; } if( 0 != Graph_Create(out_graph, rect.width, rect.height) ) { return -1; } des_n = 0; /* 开始读取图片中的图形数组并写入窗口 */ for (y=0;y< rect.height; ++y) { k = (rect.y+y)*src_graph->w + rect.x; for (x=0;x<rect.width; ++x) { src_n = k + x; /* 计算图片内需要读取的区域的各点坐标 */ out_graph->rgba[0][des_n] = src_graph->rgba[0][src_n]; out_graph->rgba[1][des_n] = src_graph->rgba[1][src_n]; out_graph->rgba[2][des_n] = src_graph->rgba[2][src_n]; if(out_graph->color_type == COLOR_TYPE_RGBA) { if(src_graph->color_type == COLOR_TYPE_RGBA) { out_graph->rgba[3][des_n] = src_graph->rgba[3][src_n]; } else { out_graph->rgba[3][des_n] = 255; } } ++des_n; } } return 0; }
LCUI_EXPORT(int) Load_Graph_Default_CheckBox_Off_Normal ( LCUI_Graph *buff ) { int ret; unsigned char red[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x42,0x42,0x42,0x42,0x42,0x42, 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0xff,0xff,0x42,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x42, 0xff,0xff,0x43,0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9, 0xf9,0xf9,0xff,0x43,0xff,0xff,0x44,0xff,0xf9,0xf9,0xf9, 0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xff,0x44,0xff,0xff,0x45, 0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xff, 0x45,0xff,0xff,0x45,0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9, 0xf9,0xf9,0xf9,0xff,0x45,0xff,0xff,0x45,0xff,0xfa,0xfa, 0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xff,0x45,0xff,0xff, 0x46,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xff,0x46,0xff,0xff,0x46,0xff,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xfb,0xff,0x46,0xff,0xff,0x47,0xff,0xfb, 0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xff,0x47,0xff, 0xff,0x48,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xff,0x48,0xff,0xff,0x48,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x48,0xff,0xff,0x49,0x49, 0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char green[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b, 0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0xff,0xff,0x6d,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6d, 0xff,0xff,0x6f,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xfb,0xff,0x6f,0xff,0xff,0x71,0xff,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xff,0x71,0xff,0xff,0x73, 0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xff, 0x73,0xff,0xff,0x76,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xff,0x76,0xff,0xff,0x78,0xff,0xfc,0xfc, 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xff,0x78,0xff,0xff, 0x7b,0xff,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc, 0xff,0x7b,0xff,0xff,0x7d,0xff,0xfc,0xfc,0xfc,0xfc,0xfc, 0xfc,0xfc,0xfc,0xfc,0xff,0x7d,0xff,0xff,0x7f,0xff,0xfc, 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xff,0x7f,0xff, 0xff,0x80,0xff,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc, 0xfc,0xff,0x80,0xff,0xff,0x82,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x82,0xff,0xff,0x83,0x83, 0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char blue[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x84,0x84,0x84,0x84,0x84,0x84, 0x84,0x84,0x84,0x84,0x84,0x84,0x84,0xff,0xff,0x86,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x86, 0xff,0xff,0x89,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xfb,0xff,0x89,0xff,0xff,0x8b,0xff,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xff,0x8b,0xff,0xff,0x8f, 0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xff, 0x8f,0xff,0xff,0x92,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xff,0x92,0xff,0xff,0x95,0xff,0xfc,0xfc, 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xff,0x95,0xff,0xff, 0x99,0xff,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc, 0xff,0x99,0xff,0xff,0x9c,0xff,0xfc,0xfc,0xfc,0xfc,0xfc, 0xfc,0xfc,0xfc,0xfc,0xff,0x9c,0xff,0xff,0x9f,0xff,0xfc, 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xff,0x9f,0xff, 0xff,0xa2,0xff,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc, 0xfc,0xff,0xa2,0xff,0xff,0xa3,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xa3,0xff,0xff,0xa7,0xa7, 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char alpha[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00, 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00, }; if( Graph_IsValid( buff ) ) { Graph_Free( buff ); } Graph_Init( buff ); buff->have_alpha = TRUE; buff->alpha = 255; buff->type = 1; ret = Graph_Create( buff, 15, 15 ); if( ret == 0 ) { memcpy( buff->rgba[0], red, sizeof(red) ); memcpy( buff->rgba[1], green, sizeof(green) ); memcpy( buff->rgba[2], blue, sizeof(blue) ); if( buff->have_alpha ) { memcpy( buff->rgba[3], alpha, sizeof(alpha) ); } } return ret; }
LCUI_EXPORT(int) Load_Graph_Default_CheckBox_On_Selected ( LCUI_Graph *buff ) { int ret; unsigned char red[] = { 0x85,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, 0x3a,0x3a,0x3a,0x85,0x3a,0x42,0x42,0x42,0x42,0x42,0x42, 0x42,0x42,0x42,0x42,0x42,0x39,0x11,0x3a,0x3a,0x42,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x15,0x03, 0x3a,0x3a,0x43,0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9, 0xb8,0x08,0x0f,0x2b,0x3a,0x3a,0x44,0xff,0xf9,0xf9,0xf9, 0xf9,0xf9,0xf9,0xc4,0x0b,0x0e,0xd2,0x44,0x3a,0x3a,0x45, 0xff,0xf9,0xf9,0xf9,0xf9,0xf9,0xd3,0x0e,0x00,0xb9,0xff, 0x45,0x3a,0x3a,0x45,0xff,0xf9,0xf9,0xf9,0xf9,0xf1,0x2a, 0x00,0x69,0xf9,0xff,0x45,0x3a,0x3a,0x27,0x00,0x3a,0xd9, 0xfa,0xfa,0x73,0x00,0x20,0xee,0xfa,0xff,0x45,0x3a,0x3a, 0x46,0x8d,0x00,0x0e,0xa4,0xcb,0x02,0x00,0xb9,0xfb,0xfb, 0xff,0x46,0x3a,0x3a,0x46,0xff,0x7c,0x00,0x00,0x11,0x00, 0x4d,0xfb,0xfb,0xfb,0xff,0x46,0x3a,0x3a,0x47,0xff,0xfb, 0x68,0x00,0x00,0x00,0xcc,0xfb,0xfb,0xfb,0xff,0x47,0x3a, 0x3a,0x48,0xff,0xfb,0xf8,0x4f,0x00,0x53,0xfb,0xfb,0xfb, 0xfb,0xff,0x48,0x3a,0x3a,0x48,0xff,0xff,0xff,0xf9,0x42, 0xcf,0xff,0xff,0xff,0xff,0xff,0x48,0x3a,0x3a,0x49,0x49, 0x49,0x49,0x49,0x47,0x49,0x49,0x49,0x49,0x49,0x49,0x49, 0x3a,0x85,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, 0x3a,0x3a,0x3a,0x3a,0x85, }; unsigned char green[] = { 0xc8,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9, 0xa9,0xa9,0xa9,0xc8,0xa9,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b, 0x6b,0x6b,0x6b,0x6b,0x6b,0x64,0x44,0xa9,0xa9,0x6d,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcd,0x47,0x39, 0xa9,0xa9,0x6f,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xc8,0x3d,0x42,0x5a,0xa9,0xa9,0x71,0xff,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xd1,0x3f,0x41,0xdc,0x71,0xa9,0xa9,0x73, 0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xdd,0x41,0x36,0xc7,0xff, 0x73,0xa9,0xa9,0x76,0xff,0xfb,0xfb,0xfb,0xfb,0xf5,0x57, 0x36,0x8a,0xfb,0xff,0x76,0xa9,0xa9,0x5b,0x36,0x64,0xe1, 0xfc,0xfc,0x91,0x36,0x4f,0xf3,0xfc,0xff,0x78,0xa9,0xa9, 0x7b,0xa5,0x36,0x41,0xb8,0xd5,0x38,0x36,0xc9,0xfc,0xfc, 0xff,0x7b,0xa9,0xa9,0x7d,0xff,0x99,0x36,0x36,0x43,0x36, 0x72,0xfc,0xfc,0xfc,0xff,0x7d,0xa9,0xa9,0x7f,0xff,0xfc, 0x88,0x36,0x36,0x36,0xd7,0xfc,0xfc,0xfc,0xff,0x7f,0xa9, 0xa9,0x80,0xff,0xfc,0xfa,0x74,0x36,0x77,0xfc,0xfc,0xfc, 0xfc,0xff,0x80,0xa9,0xa9,0x82,0xff,0xff,0xff,0xfa,0x6a, 0xd9,0xff,0xff,0xff,0xff,0xff,0x82,0xa9,0xa9,0x83,0x83, 0x83,0x83,0x83,0x80,0x83,0x83,0x83,0x83,0x83,0x83,0x83, 0xa9,0xc8,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9, 0xa9,0xa9,0xa9,0xa9,0xc8, }; unsigned char blue[] = { 0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xfb,0xff,0x84,0x84,0x84,0x84,0x84,0x84, 0x84,0x84,0x84,0x84,0x84,0x80,0x6c,0xff,0xff,0x86,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd8,0x70,0x65, 0xff,0xff,0x89,0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb, 0xd4,0x68,0x6c,0x7c,0xff,0xff,0x8b,0xff,0xfb,0xfb,0xfb, 0xfb,0xfb,0xfb,0xdb,0x69,0x6c,0xe3,0x8b,0xff,0xff,0x8f, 0xff,0xfb,0xfb,0xfb,0xfb,0xfb,0xe4,0x6c,0x63,0xd3,0xff, 0x8f,0xff,0xff,0x92,0xff,0xfb,0xfb,0xfb,0xfb,0xf6,0x7d, 0x63,0xa4,0xfb,0xff,0x92,0xff,0xff,0x7e,0x63,0x87,0xe8, 0xfc,0xfc,0xaa,0x63,0x76,0xf5,0xfc,0xff,0x95,0xff,0xff, 0x99,0xb9,0x63,0x6b,0xc7,0xde,0x64,0x63,0xd4,0xfc,0xfc, 0xff,0x99,0xff,0xff,0x9c,0xff,0xaf,0x63,0x63,0x6d,0x63, 0x91,0xfc,0xfc,0xfc,0xff,0x9c,0xff,0xff,0x9f,0xff,0xfc, 0xa2,0x63,0x63,0x63,0xdf,0xfc,0xfc,0xfc,0xff,0x9f,0xff, 0xff,0xa2,0xff,0xfc,0xfa,0x93,0x63,0x95,0xfc,0xfc,0xfc, 0xfc,0xff,0xa2,0xff,0xff,0xa3,0xff,0xff,0xff,0xfb,0x8b, 0xe2,0xff,0xff,0xff,0xff,0xff,0xa3,0xff,0xff,0xa7,0xa7, 0xa7,0xa7,0xa7,0xa4,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, 0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xfb, }; unsigned char alpha[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; if( Graph_IsValid( buff ) ) { Graph_Free( buff ); } Graph_Init( buff ); buff->have_alpha = TRUE; buff->alpha = 255; buff->type = 1; ret = Graph_Create( buff, 15, 15 ); if( ret == 0 ) { memcpy( buff->rgba[0], red, sizeof(red) ); memcpy( buff->rgba[1], green, sizeof(green) ); memcpy( buff->rgba[2], blue, sizeof(blue) ); if( buff->have_alpha ) { memcpy( buff->rgba[3], alpha, sizeof(alpha) ); } } return ret; }
int LoadIMGSRC_publish_loading_02( LCUI_Graph *buff ) { int ret; unsigned char red[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f, 0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f, 0x6f,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff, 0xff,0xff,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0x6f,0x6f, 0x6f,0x6f,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0x6f,0x6f,0x6f, 0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0x6f,0x6f,0x6f,0x6f,0xff, 0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f, 0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f, 0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff, 0xff,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f, 0x6f,0x6f,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f, 0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f, 0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0x6f,0x6f, 0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f, 0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0x6f, 0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff, 0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f, 0x6f,0x6f,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0x6f,0x6f,0x6f,0x6f,0xff, 0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0x6f, 0x6f,0x6f,0x6f,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0x6f,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0x6f, 0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f, 0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f,0x6f,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0x6f,0x6f, 0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char green[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2, 0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2, 0xb2,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff, 0xff,0xff,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xb2,0xb2, 0xb2,0xb2,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xb2,0xb2,0xb2, 0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xb2,0xb2,0xb2,0xb2,0xff, 0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, 0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2, 0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff, 0xff,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2, 0xb2,0xb2,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, 0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2, 0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xb2,0xb2, 0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2, 0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xb2, 0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff, 0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2, 0xb2,0xb2,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xb2,0xb2,0xb2,0xb2,0xff, 0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xb2, 0xb2,0xb2,0xb2,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xb2,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xb2, 0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2, 0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2,0xb2,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xb2,0xb2, 0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char blue[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7, 0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7, 0xe7,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff, 0xff,0xff,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xe7,0xe7, 0xe7,0xe7,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xe7,0xe7,0xe7, 0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xe7,0xe7,0xe7,0xe7,0xff, 0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7, 0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7, 0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff, 0xff,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7, 0xe7,0xe7,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7, 0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7, 0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xe7,0xe7, 0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7, 0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xe7, 0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff, 0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7, 0xe7,0xe7,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xe7,0xe7,0xe7,0xe7,0xff, 0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xe7, 0xe7,0xe7,0xe7,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xe7, 0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7, 0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7,0xe7,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xe7,0xe7, 0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff, }; unsigned char alpha[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x7c,0x8d,0x05,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0xe6,0xe6, 0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x29,0xe6,0xe6,0x44,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1a,0x71, 0x30,0x00,0x00,0x00,0x00,0x29,0xe6,0xe6,0x44,0x00,0x00, 0x00,0x00,0x2a,0x8d,0x30,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x76,0xcc,0xc7,0x3e,0x00,0x00,0x00,0x29,0xe6, 0xe6,0x44,0x00,0x00,0x00,0x33,0xed,0xff,0xba,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x32,0xc5,0xcc,0xc7,0x3e, 0x00,0x00,0x29,0xe6,0xe6,0x44,0x00,0x00,0x33,0xed,0xff, 0xff,0x5d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x3a,0xc5,0xcc,0xc7,0x3e,0x00,0x26,0xe6,0xe6,0x41,0x00, 0x33,0xed,0xff,0xff,0x66,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x3a,0xc5,0xcc,0xc7,0x2b,0x05, 0x95,0xa5,0x10,0x1b,0xed,0xff,0xff,0x63,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3a, 0xc5,0xcc,0x54,0x00,0x00,0x00,0x00,0x42,0xff,0xff,0x60, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x22,0x43,0x05,0x00,0x00,0x00,0x00, 0x00,0x48,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x19,0x24,0x24,0x24,0x24,0x1d,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x0f,0x0f,0x0f, 0x0f,0x0d,0x00,0x00,0x00,0x5d,0xb3,0xb3,0xb3,0xb3,0xb3, 0xb3,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28, 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x35,0x00,0x00,0x6e,0xb3, 0xb3,0xb3,0xb3,0xb3,0xb3,0x85,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x2f,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x3c, 0x00,0x00,0x00,0x37,0x48,0x48,0x48,0x48,0x3b,0x04,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x1f,0x1f, 0x1f,0x1f,0x1a,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x0e,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x16, 0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x1f,0x8e,0x99,0x34,0x00,0x00, 0x00,0x00,0x13,0x66,0x64,0x1f,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x8e,0x99, 0x99,0x28,0x00,0x3b,0x45,0x03,0x0d,0x62,0x66,0x64,0x1f, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x1f,0x8e,0x99,0x99,0x3f,0x00,0x14,0x80,0x80,0x24,0x00, 0x1a,0x62,0x66,0x64,0x1f,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1b,0x8e,0x99,0x99,0x3f,0x00,0x00,0x17, 0x80,0x80,0x26,0x00,0x00,0x1c,0x62,0x66,0x64,0x1d,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5e,0x99,0x99,0x3f, 0x00,0x00,0x00,0x17,0x80,0x80,0x26,0x00,0x00,0x00,0x1d, 0x62,0x66,0x4e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x1f,0x6a,0x36,0x00,0x00,0x00,0x00,0x17,0x80,0x80,0x26, 0x00,0x00,0x00,0x00,0x1a,0x47,0x1e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x17,0x80,0x80,0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x15,0x80,0x80,0x24,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x53,0x5c, 0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00, }; if( Graph_IsValid( buff ) ) { Graph_Free( buff ); } Graph_Init( buff ); buff->have_alpha = TRUE; buff->alpha = 255; buff->type = 1; ret = Graph_Create( buff, 26, 26 ); if( ret == 0 ) { memcpy( buff->rgba[0], red, sizeof(red) ); memcpy( buff->rgba[1], green, sizeof(green) ); memcpy( buff->rgba[2], blue, sizeof(blue) ); if( buff->have_alpha ) { memcpy( buff->rgba[3], alpha, sizeof(alpha) ); } } return ret; }
int load_jpeg(const char *filepath, LCUI_Graph *out) /* 功能:载入并解码jpg图片 */ { #ifdef USE_LIBJPEG FILE *fp; fp = fopen(filepath,"r"); if(fp == NULL) { return -1; } int row_stride,jaka; int x,y, m, n, k; short int JPsyg; struct jpeg_decompress_struct cinfo; struct my_error_mgr jerr; JSAMPARRAY buffer; if( fread( &JPsyg, sizeof(short int), 1, fp ) ) { if ( JPsyg != -9985 ) { /* 如果不是jpg图片 */ return 1; } } rewind(fp); cinfo.err = jpeg_std_error(&jerr.pub); jerr.pub.error_exit = my_error_exit; if (setjmp(jerr.setjmp_buffer)) { jpeg_destroy_decompress(&cinfo); return 2; } jpeg_create_decompress(&cinfo); jpeg_stdio_src(&cinfo,fp); (void) jpeg_read_header(&cinfo,IS_TRUE); (void) jpeg_start_decompress(&cinfo); jaka = cinfo.num_components; //if (jaka==3) printf("color\n"); else printf("grayscale\n"); out->have_alpha = IS_FALSE; /* 设置为无透明度 */ n = Graph_Create(out, cinfo.output_width, cinfo.output_height); if( n != 0 ){ printf("load_jpeg(): error: "MALLOC_ERROR); return 1; } row_stride = cinfo.output_width * cinfo.output_components; buffer = (*cinfo.mem->alloc_sarray)( (j_common_ptr) &cinfo,JPOOL_IMAGE,row_stride,1); Graph_Lock( out, 1 ); for(y=0; cinfo.output_scanline <cinfo.output_height; ++y) { (void) jpeg_read_scanlines(&cinfo, buffer, 1); m = y*out->width; if ( jaka == 3 ) { for (x=0;x<out->width;x++) { n = x+m; k=x*3; out->rgba[0][n]=buffer[0][k++]; out->rgba[1][n]=buffer[0][k++]; out->rgba[2][n]=buffer[0][k++]; } } else { for (x=0;x<out->width;x++) { n = x+m; out->rgba[0][n]=buffer[0][x]; out->rgba[1][n]=buffer[0][x]; out->rgba[2][n]=buffer[0][x]; } } } out->type = TYPE_JPG;//图片类型为jpg Graph_Unlock( out ); (void) jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); fclose(fp); #else printf("warning: not JPEG support!"); #endif return 0; }
int LCUIGraph::create( int w, int h, LCUI_BOOL have_alpha = TRUE ) { graph.have_alpha = have_alpha; return Graph_Create( &graph, w, h ); }