static void CloseButton_OnUpdate( LCUI_Widget *widget ) { LCUI_Graph img; LCUI_Color color; LCUI_Widget *wnd; Graph_Init( &img ); LoadCloseButtonIMG( &img ); wnd = Widget_GetParent( widget, WIDGET_WINDOW ); if( wnd ) { /* 若所在窗口并未获得焦点 */ if( !Widget_GetFocus(wnd) ) { color = RGB(200,200,200); } else { LCUI_Window *wnd_data; wnd_data = (LCUI_Window*)Widget_GetPrivateData( wnd ); color = wnd_data->theme_color; } } else { color = RGB(255,0,0); } switch(widget->state) { case WIDGET_STATE_NORMAL: Graph_FillColor( &img, RGB(150,150,150) ); Widget_SetBackgroundImage( widget, &img ); Widget_SetBackgroundLayout( widget, LAYOUT_CENTER ); Widget_SetBackgroundTransparent( widget, TRUE ); break; case WIDGET_STATE_ACTIVE: color.red = _ALPHA_BLEND( 0, color.red, 100 ); color.green = _ALPHA_BLEND( 0, color.green, 100 ); color.blue = _ALPHA_BLEND( 0, color.blue, 100 ); Graph_FillColor( &img, RGB(255,255,255) ); Widget_SetBackgroundImage( widget, &img ); Widget_SetBackgroundColor( widget, color ); Widget_SetBackgroundLayout( widget, LAYOUT_CENTER ); Widget_SetBackgroundTransparent( widget, FALSE ); break; case WIDGET_STATE_OVERLAY: Graph_FillColor( &img, RGB(255,255,255) ); Widget_SetBackgroundImage( widget, &img ); Widget_SetBackgroundColor( widget, color ); Widget_SetBackgroundLayout( widget, LAYOUT_CENTER ); Widget_SetBackgroundTransparent( widget, FALSE ); case WIDGET_STATE_DISABLE: default:break; } Graph_Free( &img ); }
void Graph_ClearShadowArea( LCUI_PaintContext paint, LCUI_Rect *box, LCUI_BoxShadow *shadow ) { int i; LCUI_Graph canvas; LCUI_Rect rect, box_area, rects[4]; /* 获取内容框区域 */ box_area.x = box->x + BoxShadow_GetBoxX( shadow ); box_area.y = box->y + BoxShadow_GetBoxY( shadow ); box_area.w = BoxShadow_GetBoxWidth( shadow, box->w ); box_area.h = BoxShadow_GetBoxHeight( shadow, box->h ); rect.x = rect.y = 0; rect.w = box->w; rect.h = box->h; /* 获取内容框外的阴影区域 */ LCUIRect_CutFourRect( &box_area, &rect, rects ); for( i=0; i<4; ++i ) { if( LCUIRect_GetOverlayRect( &paint->rect, &rects[i], &rects[i] ) ) { rects[i].x -= paint->rect.x; rects[i].y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &rects[i] ); Graph_FillColor( &canvas, shadow->color ); } } }
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_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; }
int main() { LCUI_Graph graph_buff; LCUI_GraphLayer *root_glayer; LCUI_GraphLayer *a_glayer, *b_glayer, *c_glayer; Graph_Init( &graph_buff ); /* 新建图层 */ root_glayer = GraphLayer_New(); a_glayer = GraphLayer_New(); b_glayer = GraphLayer_New(); c_glayer = GraphLayer_New(); /* 调整图层尺寸 */ GraphLayer_Resize( root_glayer, 320, 240 ); GraphLayer_Resize( a_glayer, 200, 150 ); GraphLayer_Resize( b_glayer, 100, 100 ); GraphLayer_Resize( c_glayer, 80, 80 ); /* 填充颜色 */ Graph_FillColor( &root_glayer->graph, RGB(255,255,255) ); Graph_FillColor( &a_glayer->graph, RGB(255,50,50) ); Graph_FillColor( &b_glayer->graph, RGB(50,255,50) ); Graph_FillColor( &c_glayer->graph, RGB(50,50,255) ); /* 建立父子图层关系 */ GraphLayer_AddChild( b_glayer, c_glayer ); GraphLayer_AddChild( root_glayer, a_glayer ); GraphLayer_AddChild( root_glayer, b_glayer ); /* 调整图层坐标 */ GraphLayer_SetPos( a_glayer, 50, 50 ); GraphLayer_SetPos( b_glayer, 175, 125 ); GraphLayer_SetPos( c_glayer, -15, 30 ); /* 显示图层 */ GraphLayer_Show( root_glayer ); GraphLayer_Show( a_glayer ); GraphLayer_Show( b_glayer ); GraphLayer_Show( c_glayer ); /* 获取根图层指定区域内实际显示的图形 */ GraphLayer_GetGraph( root_glayer, &graph_buff, Rect(0,0,320,240) ); /* 写入至文件 */ Graph_WritePNG( OUTPUT_GRAPHFILE, &graph_buff ); printf( "please see file: %s \n", OUTPUT_GRAPHFILE ); GraphLayer_Free( root_glayer ); return 0; }
static void Graph_DrawInnerShadow( LCUI_PaintContext paint, LCUI_Rect *box, LCUI_BoxShadow *shadow ) { int i; LCUI_Graph canvas; LCUI_Rect rsd, rb, rects[4]; rb.x = BoxShadow_GetBoxX( shadow ); rb.y = BoxShadow_GetBoxY( shadow ); rb.w = BoxShadow_GetBoxWidth( shadow, box->w ); rb.h = BoxShadow_GetBoxHeight( shadow, box->h ); rsd.x = BoxShadow_GetX( shadow ) + BLUR_WIDTH(shadow); rsd.y = BoxShadow_GetY( shadow ) + BLUR_WIDTH(shadow); rsd.w = rb.w + INNER_SHADOW_WIDTH(shadow)*2; rsd.h = rb.h + INNER_SHADOW_WIDTH(shadow)*2; /* 截取出与内容区重叠的区域 */ if( LCUIRect_GetOverlayRect(&rb, &rsd, &rb) ) { LCUIRect_CutFourRect( &rb, &rsd, rects ); /* 从阴影区域中排除部件占用的区域 */ for( i=0; i<4; ++i ) { if( !LCUIRect_GetOverlayRect( &paint->rect, &rects[i],&rects[i]) ) { continue; } rects[i].x -= paint->rect.x; rects[i].y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &rects[i] ); Graph_FillColor( &canvas, shadow->color ); } return; } /* 不重叠则直接填充 */ if( LCUIRect_GetOverlayRect(&paint->rect, &rsd, &rb) ) { rb.x -= paint->rect.x; rb.y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &rb ); Graph_FillColor( &canvas, shadow->color ); } }
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 Graph_Create( LCUI_Graph *graph, int w, int h ) { size_t size; if( w > 10000 || h > 10000 ) { _DEBUG_MSG("graph size is too large!"); abort(); } if( h <= 0 || w <= 0 ) { Graph_Free( graph ); return -1; } graph->bytes_per_pixel = get_pixel_size( graph->color_type ); graph->bytes_per_row = graph->bytes_per_pixel * w; size = graph->bytes_per_row * h; if( Graph_IsValid(graph) ) { /* 如果现有图形尺寸大于要创建的图形的尺寸,直接改尺寸即可 */ if( graph->mem_size >= size ) { if( (w != graph->w || h != graph->h) && graph->color_type == COLOR_TYPE_ARGB ) { Graph_FillAlpha( graph, 0 ); Graph_FillColor(graph, RGB(255,255,255)); } graph->w = w; graph->h = h; return 0; } Graph_Free( graph ); } graph->mem_size = size; graph->bytes = (uchar_t*)malloc( size ); if( !graph->bytes ) { graph->w = 0; graph->h = 0; return -2; } /* 默认全透明 */ if( graph->color_type == COLOR_TYPE_ARGB ) { Graph_FillAlpha( graph, 0 ); } graph->w = w; graph->h = h; return 0; }
LCUI_API int LCUIScreen_Init( void ) { RECT client_rect; LCUI_Graph *graph; WNDCLASS wndclass; TCHAR szAppName[] = TEXT ("Typer"); wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = Win32_LCUI_WndProc; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = win32_hInstance; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR) ; return 0; } current_hwnd = CreateWindow ( szAppName, TEXT ("LCUI"), WS_OVERLAPPEDWINDOW &~WS_THICKFRAME, CW_USEDEFAULT, CW_USEDEFAULT, WIN32_WINDOW_WIDTH, WIN32_WINDOW_HEIGHT, NULL, NULL, win32_hInstance, NULL); GetClientRect( current_hwnd, &client_rect ); LCUI_Sys.screen.fb_dev_fd = -1; LCUI_Sys.screen.fb_dev_name = "win32"; LCUI_Sys.screen.bits = 32; LCUI_Sys.screen.size.w = client_rect.right; LCUI_Sys.screen.size.h = client_rect.bottom; LCUI_Sys.screen.smem_len = LCUI_Sys.screen.size.w * LCUI_Sys.screen.size.h * 4; /* 分配内存,储存像素数据 */ pixel_mem = malloc ( LCUI_Sys.screen.smem_len ); LCUI_Sys.screen.fb_mem = pixel_mem; LCUI_Sys.root_glayer = GraphLayer_New(); GraphLayer_Resize( LCUI_Sys.root_glayer, LCUI_Sys.screen.size.w, LCUI_Sys.screen.size.h ); graph = GraphLayer_GetSelfGraph( LCUI_Sys.root_glayer ); Graph_FillColor( graph, RGB(255,255,255) ); /* 获取客户区的DC */ hdc_client = GetDC( current_hwnd ); /* 为帧缓冲创建一个DC */ hdc_framebuffer = CreateCompatibleDC( hdc_client ); /* 为客户区创建一个Bitmap */ client_bitmap = CreateCompatibleBitmap( hdc_client, LCUI_Sys.screen.size.w, LCUI_Sys.screen.size.h ); /* 为帧缓冲的DC选择client_bitmap作为对象 */ SelectObject( hdc_framebuffer, client_bitmap ); GraphLayer_Show( LCUI_Sys.root_glayer ); ShowWindow( current_hwnd, SW_SHOWNORMAL ); UpdateWindow( current_hwnd ); return 0; }
LCUI_API int GraphLayer_GetGraph( LCUI_GraphLayer *ctnr, LCUI_Graph *graph_buff, LCUI_Rect rect ) { int i, total; uchar_t tmp_alpha, alpha; LCUI_Pos pos, glayer_pos; LCUI_GraphLayer *glayer; LCUI_Queue glayerQ; LCUI_Rect valid_area; LCUI_Graph tmp_graph; /* 检测这个区域是否有效 */ if (rect.x < 0 || rect.y < 0) { return -1; } if (rect.x + rect.width > ctnr->graph.w || rect.y + rect.height > ctnr->graph.h ) { return -1; } if (rect.width <= 0 || rect.height <= 0) { return -2; } if( !Graph_IsValid(graph_buff) ) { graph_buff->color_type = COLOR_TYPE_ARGB; Graph_Create( graph_buff, rect.width, rect.height ); } Graph_Init( &tmp_graph ); Queue_Init( &glayerQ, 0, NULL); Queue_UsingPointer( &glayerQ ); /* 获取rect区域内的图层列表 */ GraphLayer_GetLayers( ctnr, rect, &glayerQ ); total = Queue_GetTotal( &glayerQ ); DEBUG_MSG( "total: %d\n", total ); /* 若记录数为零,则表明该区域没有图层 */ if( total <= 0 ) { /* 若没有父图层,则填充白色 */ if( ctnr == NULL ) { Graph_FillColor( graph_buff, RGB(255,255,255) ); } else { /* 否则使用父图层的图形 */ Graph_Cut( &ctnr->graph, rect, graph_buff ); } /* 销毁记录 */ Queue_Destroy( &glayerQ ); return 0; } /* 从顶层到底层遍历图层,排除被其它图层完全遮挡或者自身完全透明的图层 */ for(i=total-1; i>=0; --i) { glayer = (LCUI_GraphLayer*)Queue_Get( &glayerQ, i ); valid_area = GraphLayer_GetValidRect( ctnr, glayer ); glayer_pos = GraphLayer_GetGlobalPos( ctnr, glayer ); valid_area.x += glayer_pos.x; valid_area.y += glayer_pos.y; alpha = GraphLayer_GetRealAlpha( glayer ); /* 当前图层的透明度小于255的话,就跳过 */ if( alpha < 255 ) { continue; } /* 跳过有alpha通道的图层 */ if( glayer->graph.color_type == COLOR_TYPE_ARGB ) { continue; } /* 如果该图层的有效区域包含目标区域 */ if( rect.x >= valid_area.x && rect.y >= valid_area.y && rect.x + rect.w <= valid_area.x + valid_area.w && rect.y + rect.h <= valid_area.y + valid_area.h ) { /* 移除底层的图层,因为已经被完全遮挡 */ for(total=i-1;total>=0; --total) { Queue_DeletePointer( &glayerQ, 0 ); } goto skip_loop; } } skip_loop: total = Queue_GetTotal( &glayerQ ); DEBUG_MSG( "total: %d\n", total ); if(i <= 0 && ctnr ) { Graph_Cut( &ctnr->graph, rect, graph_buff ); } /* 获取图层列表中的图层 */ for(i=0; i<total; ++i) { glayer = (LCUI_GraphLayer*)Queue_Get( &glayerQ, i ); //_DEBUG_MSG("%p = Queue_Get( %p, %d )\n", glayer, &glayerQ, i); if( !glayer ) { continue; } DEBUG_MSG("%d,%d,%d,%d\n", glayer->pos.x, glayer->pos.y, glayer->graph.w, glayer->graph.h); /* 获取该图层的有效区域及全局坐标 */ pos = GraphLayer_GetGlobalPos( ctnr, glayer ); valid_area = GraphLayer_GetValidRect( ctnr, glayer ); /* 引用该图层的有效区域内的图像 */ Graph_Quote( &tmp_graph, &glayer->graph, valid_area ); //_DEBUG_MSG("valid area: %d,%d,%d,%d, pos: %d,%d, size: %d,%d\n", // valid_area.x, valid_area.y, valid_area.width, valid_area.height, // pos.x, pos.y, glayer->graph.w, glayer->graph.h // ); /* 获取相对坐标 */ pos.x = pos.x - rect.x + valid_area.x; pos.y = pos.y - rect.y + valid_area.y; //_DEBUG_MSG("mix pos: %d,%d\n", pos.x, pos.y); /* 如果该图层没有继承父图层的透明度 */ if( !glayer->inherit_alpha ) { /* 直接叠加至graph_buff */ Graph_Mix( graph_buff, &tmp_graph, pos ); } else { /* 否则,计算该图层应有的透明度 */ alpha = GraphLayer_GetRealAlpha( glayer ); /* 备份该图层的全局透明度 */ tmp_alpha = glayer->graph.alpha; /* 将实际透明度作为全局透明度,参与图像叠加 */ glayer->graph.alpha = alpha; Graph_Mix( graph_buff, &tmp_graph, pos ); /* 还原全局透明度 */ glayer->graph.alpha = tmp_alpha; } } Queue_Destroy( &glayerQ ); return 0; }
LCUI_EXPORT(int) Draw_Empty_Slot(LCUI_Graph *graph, int width, int height) /* 功能:绘制进度条的空槽 */ { int i, n; unsigned char c; if(width < 4 || height < 4) { return -1; } graph->have_alpha = TRUE; Graph_Create(graph, width, height); /* 申请内存 */ Graph_FillColor(graph, RGB(250,250,250));/* 填充白色 */ Graph_FillAlpha(graph, 255); /* 四个角上的一个像素点完全透明 */ graph->rgba[3][0] = 0; graph->rgba[3][width-1] = 0; graph->rgba[3][width*(height-1)] = 0; graph->rgba[3][width*height-1] = 0; /* 绘制左边和右边的竖线条 */ for(i=0; i<height; ++i) { n = i*width; c = 160 +(30-(30.0/height)*i); graph->rgba[0][n] = c; graph->rgba[1][n] = c; graph->rgba[2][n] = c; graph->rgba[0][n+1] = 230; graph->rgba[1][n+1] = 230; graph->rgba[2][n+1] = 230; n = n+width-1; graph->rgba[0][n] = c; graph->rgba[1][n] = c; graph->rgba[2][n] = c; graph->rgba[0][n-1] = 230; graph->rgba[1][n-1] = 230; graph->rgba[2][n-1] = 230; } /* 绘制顶端的线条 */ memset(graph->rgba[0], 180, width); memset(graph->rgba[1], 180, width); memset(graph->rgba[2], 180, width); memset(graph->rgba[0]+width+1, 240, width-2); memset(graph->rgba[1]+width+1, 240, width-2); memset(graph->rgba[2]+width+1, 240, width-2); /* 绘制底端的线条 */ n = width*(height-1); memset(graph->rgba[0]+n, 140, width); memset(graph->rgba[1]+n, 140, width); memset(graph->rgba[2]+n, 140, width); n = width*(height-2); memset(graph->rgba[0]+n+1, 225, width-2); memset(graph->rgba[1]+n+1, 225, width-2); memset(graph->rgba[2]+n+1, 225, width-2); return 0; }
static void Window_ExecUpdate( LCUI_Widget *win_p ) { LCUI_Size size; LCUI_Graph *graph; LCUI_Border border; LCUI_Widget *titlebar, *btn, *client_area; LCUI_RGB border_color, back_color; btn = Window_GetCloseButton(win_p); titlebar = Window_GetTitleBar(win_p); client_area = Window_GetClientArea(win_p); graph = Widget_GetSelfGraph( win_p ); /* 按不同的风格来处理 */ switch( win_p->style_id ) { case WINDOW_STYLE_NONE: /* 没有边框 */ /* 先计算坐标和尺寸 */ Widget_SetDock( client_area, DOCK_TYPE_FILL ); Widget_Hide( titlebar );/* 隐藏标题栏 */ Widget_Show( client_area );/* 客户区需要显示 */ break; case WINDOW_STYLE_LINE: /* 线条边框 */ Widget_SetBorder(win_p, Border(1, BORDER_STYLE_SOLID, RGB(50,50,50))); Widget_SetPadding( win_p, Padding(1,1,1,1) ); Widget_SetDock( client_area, DOCK_TYPE_FILL ); Widget_Hide( titlebar ); Widget_Show( client_area ); break; case WINDOW_STYLE_PURE_BLUE: back_color = RGB(30,160,225); border_color = RGB(0,130,195); goto union_draw_method; case WINDOW_STYLE_PURE_GREEN: back_color = RGB(140,190,40); border_color = RGB(110,160,10); goto union_draw_method; case WINDOW_STYLE_PURE_RED: back_color = RGB(230,20,0); border_color = RGB(200,0,0); goto union_draw_method; case WINDOW_STYLE_PURE_ORANGE: back_color = RGB(240,150,10); border_color = RGB(210,120,0); goto union_draw_method; case WINDOW_STYLE_PURE_PURPLE: back_color = RGB(110,20,95); border_color = RGB(80,0,65); union_draw_method:; /* 若窗口未获得焦点 */ if( !Widget_GetFocus( win_p ) ) { back_color = RGB(235,235,235); border_color = RGB(211,211,211); } /* 更新窗口标题栏上的关闭按钮 */ Widget_Update( btn ); border = Border(1, BORDER_STYLE_SOLID, border_color); Widget_SetBorder( client_area, border); Widget_SetBorder( win_p, border); Widget_SetBackgroundColor( win_p, back_color ); Graph_FillColor( graph, back_color ); Widget_SetBackgroundColor( client_area, RGB(255,255,255) ); Widget_SetBackgroundImage( titlebar, NULL ); Widget_SetBackgroundLayout( titlebar, 0 ); Widget_SetBackgroundTransparent( titlebar, TRUE ); Widget_SetBackgroundTransparent( client_area, FALSE ); Widget_SetPadding( win_p, Padding(1,4,4,4) ); Widget_SetPadding( client_area, Padding(1,1,1,1) ); size = Widget_GetContainerSize( win_p ); Widget_Resize( titlebar, Size(size.h, 25) ); Widget_Resize( client_area, Size(size.w, size.h - 25) ); Widget_SetDock( titlebar, DOCK_TYPE_TOP ); Widget_SetDock( client_area, DOCK_TYPE_BOTTOM ); Widget_Show( titlebar ); Widget_Show( client_area ); break; default: // break; } }
/** 绘制边框 */ int Graph_DrawBorder( LCUI_PaintContext paint, LCUI_Rect *box, LCUI_Border *border ) { int radius; LCUI_Rect bound; LCUI_Pos start, end; LCUI_Graph canvas; if( !Graph_IsValid(&paint->canvas) ) { return -1; } /* 绘制上边框线 */ bound.x = box->x + border->top_left_radius; bound.y = box->y; bound.width = box->width - border->top_right_radius; bound.width -= border->top_left_radius; bound.height = border->top.width; if( LCUIRect_GetOverlayRect( &bound, &paint->rect, &bound ) ) { bound.x -= paint->rect.x; bound.y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &bound ); Graph_FillColor( &canvas, border->top.color ); } /* 绘制下边框线 */ bound.x = box->x; bound.y = box->y + box->height - border->bottom.width; bound.width = box->width - border->bottom_right_radius; bound.width -= border->bottom_left_radius; bound.height = border->bottom.width; if( LCUIRect_GetOverlayRect( &bound, &paint->rect, &bound ) ) { bound.x -= paint->rect.x; bound.y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &bound ); Graph_FillColor( &canvas, border->bottom.color ); } /* 绘制左边框线 */ bound.y = box->y + border->top_left_radius; bound.x = box->x; bound.width = border->left.width; bound.height = box->height - border->top_left_radius; bound.height -= border->bottom_left_radius; if( LCUIRect_GetOverlayRect( &bound, &paint->rect, &bound ) ) { bound.x -= paint->rect.x; bound.y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &bound ); Graph_FillColor( &canvas, border->left.color ); } /* 绘制右边框线 */ bound.x = box->x + box->width - border->right.width; bound.y = box->y + border->top_right_radius; bound.width = border->right.width; bound.height = box->height - border->top_right_radius; bound.height -= border->bottom_right_radius; if( LCUIRect_GetOverlayRect( &bound, &paint->rect, &bound ) ) { bound.x -= paint->rect.x; bound.y -= paint->rect.y; Graph_Quote( &canvas, &paint->canvas, &bound ); Graph_FillColor( &canvas, border->right.color ); } return 0; }