Example #1
0
static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc *self, int x, int y, rtgui_color_t color)
{
	struct rtgui_dc_buffer *dst;
	unsigned r, g, b, a;

	dst = (struct rtgui_dc_buffer *)self;

	/* does not draw point out of dc */
	if ((x > dst->width) || (y > dst->height)) return ;

	r = RTGUI_RGB_R(color);
	g = RTGUI_RGB_G(color);
	b = RTGUI_RGB_B(color);
	a = RTGUI_RGB_A(color);

	switch (dst->pixel_format)
	{
	case RTGRAPHIC_PIXEL_FORMAT_RGB565:
		DRAW_SETPIXELXY_RGB565(x, y);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_BGR565:
		DRAW_SETPIXELXY_BGR565(x, y);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_RGB888:
		DRAW_SETPIXELXY_RGB888(x, y);
		break;
	case RTGRAPHIC_PIXEL_FORMAT_ARGB888:
		DRAW_SETPIXELXY_ARGB8888(x, y);
		break;
	}
}
static int
SDL_BlendPoint_RGB565(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
                      Uint8 g, Uint8 b, Uint8 a)
{
    unsigned inva = 0xff - a;

    switch (blendMode) {
    case SDL_BLENDMODE_BLEND:
        DRAW_SETPIXELXY_BLEND_RGB565(x, y);
        break;
    case SDL_BLENDMODE_ADD:
        DRAW_SETPIXELXY_ADD_RGB565(x, y);
        break;
    case SDL_BLENDMODE_MOD:
        DRAW_SETPIXELXY_MOD_RGB565(x, y);
        break;
    default:
        DRAW_SETPIXELXY_RGB565(x, y);
        break;
    }
    return 0;
}