Example #1
0
//screen中矩形填充,如硬件加速不支持在screen上矩形填充,或者有frame_buffer,
//driver可以简化,直接返回false即可
bool_t __lcd_fill_rect_screen(struct tagRectangle *Target,
                              struct tagRectangle *Focus,
                              u32 Color0,u32 Color1,u32 Mode)
{
    u32 x,y,width,height;
    u16 pixel;
    if(Mode != CN_FILLRECT_MODE_N)
        return false;
    pixel = GK_ConvertRGB24ToPF(CN_SYS_PF_RGB565,Color0);
    width = Focus->right-Focus->left;
    height = Focus->bottom-Focus->top;
    //转换坐标
    __ili9325_set_window(LCD_XSIZE-Focus->right,
                         LCD_YSIZE-Focus->bottom,width,height);
    __ili9325_write_cmd(0x0022);
    for(y = 0; y < height; y++)
    {
        for(x = 0; x < width; x++)
        {
            __ili9325_write_data(pixel);
        }
    }
    __ili9325_close_window();
    return true;
}
Example #2
0
bool_t __lcd_fill_rect_bm(struct tagRectBitmap *dst_bitmap,
                          struct tagRectangle *Target,
                          struct tagRectangle *Focus,
                          u32 Color0,u32 Color1,u32 Mode)
{
    u32 y;
    u16 pixel;
    u16 *dst_offset;
    if(Mode != CN_FILLRECT_MODE_N)
        return false;
    if(dst_bitmap->PixelFormat != CN_SYS_PF_RGB565)
        return false;
    pixel = GK_ConvertRGB24ToPF(CN_SYS_PF_RGB565,Color0);

    dst_offset = (u16*)((ptu32_t)dst_bitmap->bm_bits
                              + Focus->top * dst_bitmap->linebytes);
    dst_offset += Focus->left;

    for(y = Focus->top; y < Focus->bottom; y++)
    {
        memset(dst_offset,pixel,(Focus->right-Focus->left)<<1);
        dst_offset += dst_bitmap->linebytes >> 1;
    }
    return true;
}
Example #3
0
bool_t __lcd_set_pixel_screen(s32 x,s32 y,u32 color,u32 r2_code)
{
    u16 dest,pixel;
    pixel = GK_ConvertRGB24ToPF(CN_SYS_PF_RGB565,color);
    if(CN_R2_COPYPEN == r2_code)
    {
        __ili9325_set_pixel(LCD_XSIZE-x,LCD_YSIZE-y,pixel);   //转换坐标
    }else
    {
        dest = __ili9325_get_pixel(LCD_XSIZE-1-x,LCD_YSIZE-1-y);  //转换坐标
        pixel = GK_BlendRop2(dest, pixel, r2_code);
        __ili9325_set_pixel(LCD_XSIZE-1-x,LCD_YSIZE-1-y,pixel);   //转换坐标
    }
    return true;
}
Example #4
0
//screen中矩形填充,如硬件加速不支持在screen上矩形填充,或者有frame_buffer,
//driver可以简化,直接返回false即可
bool_t __lcd_fill_rect_screen(struct Rectangle *Target,
                              struct Rectangle *Focus,
                              u32 Color0,u32 Color1,u32 Mode)
{
    u32 x,y,width,height;
    u16 pixel;
    s32 n,m;
    if(Mode != CN_FILLRECT_MODE_N)
        return false;
    pixel = GK_ConvertRGB24ToPF(CN_SYS_PF_RGB565,Color0);
    width = Focus->right-Focus->left;
    height = Focus->bottom-Focus->top;
    //转换坐标
    __ili9325_set_window(CN_LCD_XSIZE-Focus->right,
                         CN_LCD_YSIZE-Focus->bottom,width,height);
    __ili9325_write_cmd(0x0022);

    n = (width+7)/8;
    for(y = 0; y < height; y++)
    {
        m = width%8;
        for(x = 0; x < n; x++)
        {
            switch(m)
            {
                case 0: __ili9325_write_data(pixel);
                case 7: __ili9325_write_data(pixel);
                case 6: __ili9325_write_data(pixel);
                case 5: __ili9325_write_data(pixel);
                case 4: __ili9325_write_data(pixel);
                case 3: __ili9325_write_data(pixel);
                case 2: __ili9325_write_data(pixel);
                case 1: __ili9325_write_data(pixel);
            }
            m = 0;
        }
    }
    __ili9325_close_window();
    return true;
}