gint/src/render-cg/image/image_p8.c

42 lines
1.1 KiB
C

#include <gint/image.h>
#include <gint/display.h>
void dimage_p8(int x, int y, image_t const *img, int eff)
{
dsubimage_p8(x, y, img, 0, 0, img->width, img->height, eff);
}
void dsubimage_p8(int x, int y, image_t const *img,
int left, int top, int w, int h, int eff)
{
if(img->format == IMAGE_P8_RGB565A)
return dsubimage_p8_clearbg(x, y, img, left, top, w, h, eff,
img->alpha);
struct gint_image_box box = { x, y, w, h, left, top };
struct gint_image_cmd cmd;
if(!gint_image_mkcmd(&box, img, eff, false, false, &cmd, DWIDTH,
DHEIGHT)) return;
cmd.loop = gint_image_p8_normal;
gint_image_p8_loop(DWIDTH, &cmd);
}
void dimage_p8_clearbg(int x, int y, image_t const *img, int eff, int bg)
{
dsubimage_p8_clearbg(x, y, img, 0, 0, img->width, img->height, eff,bg);
}
void dsubimage_p8_clearbg(int x, int y, image_t const *img,
int left, int top, int w, int h, int eff, int bg_color)
{
struct gint_image_box box = { x, y, w, h, left, top };
struct gint_image_cmd cmd;
if(!gint_image_mkcmd(&box, img, eff, false, true, &cmd, DWIDTH,
DHEIGHT)) return;
cmd.color_1 = bg_color;
cmd.loop = gint_image_p8_clearbg;
gint_image_p8_loop(DWIDTH, &cmd);
}