mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-08 19:44:45 +08:00
use rectf for draw image
This commit is contained in:
parent
b75ae0ff11
commit
8de9f6bc70
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2021/09/13
|
||||
* 修改canvas\_draw\_image改成用rectf类型(感谢智明提供补丁)
|
||||
|
||||
2021/09/11
|
||||
* 增加 object\_default\_create\_ex 用于禁止路径访问属性。
|
||||
|
||||
|
@ -694,12 +694,13 @@ ret_t canvas_draw_utf8(canvas_t* c, const char* str, xy_t x, xy_t y) {
|
||||
static ret_t canvas_do_draw_image(canvas_t* c, bitmap_t* img, const rect_t* s, const rect_t* d) {
|
||||
rectf_t src;
|
||||
rectf_t dst;
|
||||
float_t scale_w = 0;
|
||||
float_t scale_h = 0;
|
||||
|
||||
xy_t x = d->x;
|
||||
xy_t y = d->y;
|
||||
xy_t x2 = d->x + d->w - 1;
|
||||
xy_t y2 = d->y + d->h - 1;
|
||||
vgcanvas_t* vg = canvas_get_vgcanvas(c);
|
||||
|
||||
if (d->w <= 0 || d->h <= 0 || s->w <= 0 || s->h <= 0 || x > c->clip_right || x2 < c->clip_left ||
|
||||
y > c->clip_bottom || y2 < c->clip_top) {
|
||||
@ -711,8 +712,12 @@ static ret_t canvas_do_draw_image(canvas_t* c, bitmap_t* img, const rect_t* s, c
|
||||
dst.w = tk_min(x2, c->clip_right) - dst.x + 1;
|
||||
dst.h = tk_min(y2, c->clip_bottom) - dst.y + 1;
|
||||
|
||||
src.x = s->x + (dst.x - x) * s->w / d->w;
|
||||
src.y = s->y + (dst.y - y) * s->h / d->h;
|
||||
/* 因为 blend 函数中缩放,使用 256 倍的定点数,所以这里为了减低多次转换数据出现误差 */
|
||||
scale_w = ((s->w << 8) / d->w / 256.0f);
|
||||
scale_h = ((s->h << 8) / d->h / 256.0f);
|
||||
|
||||
src.x = s->x + (dst.x - x) * scale_w;
|
||||
src.y = s->y + (dst.y - y) * scale_h;
|
||||
src.w = dst.w * s->w / d->w;
|
||||
src.h = dst.h * s->h / d->h;
|
||||
|
||||
@ -727,14 +732,7 @@ static ret_t canvas_do_draw_image(canvas_t* c, bitmap_t* img, const rect_t* s, c
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
if ((src.w == dst.w && src.h == dst.h) || (src.w == img->w && src.h == img->h) || vg == NULL) {
|
||||
rect_t isrc = rect_init(src.x, src.y, src.w, src.h);
|
||||
rect_t idst = rect_init(dst.x, dst.y, dst.w, dst.h);
|
||||
return lcd_draw_image(c->lcd, img, &isrc, &idst);
|
||||
} else {
|
||||
/*如果图片缩放,而且只是绘制部分,为了避免取整出现坐标异位,使用vgcanvas绘制。*/
|
||||
return vgcanvas_draw_image(vg, img, src.x, src.y, src.w, src.h, dst.x, dst.y, dst.w, dst.h);
|
||||
}
|
||||
return lcd_draw_image(c->lcd, img, &src, &dst);
|
||||
}
|
||||
|
||||
ret_t canvas_draw_image(canvas_t* c, bitmap_t* img, const rect_t* src, const rect_t* dst_in) {
|
||||
|
@ -217,7 +217,7 @@ color_t lcd_get_point_color(lcd_t* lcd, xy_t x, xy_t y) {
|
||||
}
|
||||
}
|
||||
|
||||
ret_t lcd_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
ret_t lcd_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
return_value_if_fail(lcd != NULL && lcd->draw_image != NULL && src != NULL && dst != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
|
||||
|
@ -80,7 +80,7 @@ typedef ret_t (*lcd_draw_glyph_t)(lcd_t* lcd, glyph_t* glyph, const rect_t* src,
|
||||
typedef float_t (*lcd_measure_text_t)(lcd_t* lcd, const wchar_t* str, uint32_t nr);
|
||||
typedef ret_t (*lcd_draw_text_t)(lcd_t* lcd, const wchar_t* str, uint32_t nr, xy_t x, xy_t y);
|
||||
|
||||
typedef ret_t (*lcd_draw_image_t)(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst);
|
||||
typedef ret_t (*lcd_draw_image_t)(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst);
|
||||
typedef ret_t (*lcd_draw_image_matrix_t)(lcd_t* lcd, draw_image_info_t* info);
|
||||
typedef vgcanvas_t* (*lcd_get_vgcanvas_t)(lcd_t* lcd);
|
||||
typedef bitmap_format_t (*lcd_get_desired_bitmap_format_t)(lcd_t* lcd);
|
||||
@ -537,12 +537,12 @@ ret_t lcd_draw_text(lcd_t* lcd, const wchar_t* str, uint32_t nr, xy_t x, xy_t y)
|
||||
* 绘制图片。
|
||||
* @param {lcd_t*} lcd lcd对象。
|
||||
* @param {bitmap_t*} img 图片。
|
||||
* @param {const rect_t*} src 只绘制指定区域的部分。
|
||||
* @param {const rect_t*} dst 绘制到目标区域。
|
||||
* @param {const rectf_t*} src 只绘制指定区域的部分。
|
||||
* @param {const rectf_t*} dst 绘制到目标区域。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t lcd_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst);
|
||||
ret_t lcd_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst);
|
||||
|
||||
/**
|
||||
* @method lcd_draw_image_matrix
|
||||
|
@ -232,8 +232,7 @@ static ret_t lcd_profile_draw_text(lcd_t* lcd, const wchar_t* str, uint32_t nr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ret_t lcd_profile_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src,
|
||||
const rect_t* dst) {
|
||||
static ret_t lcd_profile_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
ret_t ret = RET_OK;
|
||||
|
||||
uint32_t cost = 0;
|
||||
|
@ -34,22 +34,24 @@ static inline void blend_a(uint8_t* dst, uint8_t* src, uint8_t alpha, bool_t pre
|
||||
}
|
||||
#endif /*blend_a*/
|
||||
|
||||
static ret_t blend_image_with_alpha(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r,
|
||||
#define BLEND_SCALE_IS_SAME_OFFSET(t) (((t) & 0xff) >= (1<<8) + 2 || ((t) & 0xff) <= 0x2)
|
||||
|
||||
static ret_t blend_image_with_alpha(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r,
|
||||
uint8_t a) {
|
||||
wh_t i = 0;
|
||||
wh_t j = 0;
|
||||
xy_t sx = src_r->x;
|
||||
xy_t sy = src_r->y;
|
||||
wh_t sw = src_r->w;
|
||||
wh_t sh = src_r->h;
|
||||
xy_t dx = dst_r->x;
|
||||
xy_t dy = dst_r->y;
|
||||
wh_t dw = dst_r->w;
|
||||
wh_t dh = dst_r->h;
|
||||
wh_t src_iw = src->w;
|
||||
wh_t src_ih = src->h;
|
||||
wh_t dst_iw = dst->w;
|
||||
wh_t dst_ih = dst->h;
|
||||
xy_t sx = (xy_t)(src_r->x);
|
||||
xy_t sy = (xy_t)(src_r->y);
|
||||
wh_t sw = (wh_t)(src_r->w);
|
||||
wh_t sh = (wh_t)(src_r->h);
|
||||
xy_t dx = (xy_t)(dst_r->x);
|
||||
xy_t dy = (xy_t)(dst_r->y);
|
||||
wh_t dw = (wh_t)(dst_r->w);
|
||||
wh_t dh = (wh_t)(dst_r->h);
|
||||
uint8_t* srcp = NULL;
|
||||
uint8_t* dstp = NULL;
|
||||
uint8_t* src_data = NULL;
|
||||
@ -62,6 +64,9 @@ static ret_t blend_image_with_alpha(bitmap_t* dst, bitmap_t* src, const rect_t*
|
||||
uint32_t dst_line_offset = dst_line_length - dw * dst_bpp;
|
||||
bool_t premulti_alpha = src->flags & BITMAP_FLAG_PREMULTI_ALPHA;
|
||||
|
||||
if (!(src_r->h > 0 && src_r->w > 0 && dst_r->h > 0 && dst_r->w > 0)) {
|
||||
return RET_OK;
|
||||
}
|
||||
return_value_if_fail(sx >= 0 && sy >= 0 && (sx + sw) <= src_iw && (sy + sh) <= src_ih,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dx >= 0 && dy >= 0 && (dx + dw) <= dst_iw && (dy + dh) <= dst_ih,
|
||||
@ -87,25 +92,35 @@ static ret_t blend_image_with_alpha(bitmap_t* dst, bitmap_t* src, const rect_t*
|
||||
srcp += src_line_offset;
|
||||
}
|
||||
} else {
|
||||
uint32_t right = dw - 1;
|
||||
uint32_t bottom = dh - 1;
|
||||
uint32_t right = tk_max(dw, 1);
|
||||
uint32_t bottom = tk_max(dh, 1);
|
||||
|
||||
uint32_t scale_x = (sw << 8) / dw;
|
||||
uint32_t scale_y = (sh << 8) / dh;
|
||||
uint32_t scale_x = src_r->w * 256.0f / dst_r->w;
|
||||
uint32_t scale_y = src_r->h * 256.0f / dst_r->h;
|
||||
|
||||
uint32_t p_x = 0;
|
||||
uint32_t p_y = 0;
|
||||
uint32_t start_y = 0;
|
||||
uint32_t start_x = 0;
|
||||
uint8_t* row_data = NULL;
|
||||
if (src_r->x != 0) {
|
||||
start_x = (uint32_t)((src_r->x - sx) * 256.0f);
|
||||
}
|
||||
if (src_r->y != 0) {
|
||||
start_y = (uint32_t)((src_r->y - sy) * 256.0f);
|
||||
}
|
||||
|
||||
dstp += (dy * dst_line_length + dx * dst_bpp);
|
||||
for (j = 0; j < dh; j++) {
|
||||
uint32_t y = sy + ((j == bottom) ? (sh - 1) : ((j * scale_y) >> 8));
|
||||
uint8_t* row_data = ((uint8_t*)(src_data)) + y * src_line_length + sx * src_bpp;
|
||||
for (j = 0, p_y = start_y; j < bottom; j++, p_y += scale_y, dstp += dst_line_offset) {
|
||||
uint32_t y = sy + (p_y >> 8);
|
||||
row_data = ((uint8_t*)(src_data)) + y * src_line_length + sx * src_bpp;
|
||||
|
||||
for (i = 0; i < dw; i++) {
|
||||
uint32_t x = (i == right) ? (sw - 1) : ((i * scale_x) >> 8);
|
||||
for (i = 0, p_x = start_x; i < right; i++, p_x += scale_x, dstp += dst_bpp) {
|
||||
uint32_t x = p_x >> 8;
|
||||
|
||||
srcp = row_data + x * src_bpp;
|
||||
blend_a(dstp, srcp, a, premulti_alpha);
|
||||
dstp += dst_bpp;
|
||||
}
|
||||
dstp += dst_line_offset;
|
||||
}
|
||||
}
|
||||
bitmap_unlock_buffer(src);
|
||||
@ -114,6 +129,6 @@ static ret_t blend_image_with_alpha(bitmap_t* dst, bitmap_t* src, const rect_t*
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t blend_image_without_alpha(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r) {
|
||||
static ret_t blend_image_without_alpha(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r) {
|
||||
return blend_image_with_alpha(dst, src, dst_r, src_r, 0xff);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ static inline void blend_a_bgr565_bgra8888(uint8_t* dst, uint8_t* src, uint8_t a
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr565_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr565_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR565 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr565_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr565_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR565_BGR565_H*/
|
||||
|
@ -70,8 +70,8 @@ static inline void blend_a_bgr565_bgra8888(uint8_t* dst, uint8_t* src, uint8_t a
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr565_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr565_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR565 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr565_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr565_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR565_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr565_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr565_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR565 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr565_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr565_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR565_RGB565_H*/
|
||||
|
@ -70,8 +70,8 @@ static inline void blend_a_bgr565_rgba8888(uint8_t* dst, uint8_t* src, uint8_t a
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr565_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr565_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR565 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr565_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr565_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR565_RGBA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR888 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR888_BGR565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr888_bgr888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr888_bgr888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR888 && src->format == BITMAP_FMT_BGR888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr888_bgr888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr888_bgr888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR888_BGR888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR888 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR888_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR888 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR888_RGB565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgr888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgr888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGR888 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgr888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgr888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGR888_RGBA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgra8888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgra8888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGRA8888 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgra8888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgra8888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGRA8888_BGR565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgra8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgra8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGRA8888 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgra8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgra8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGRA8888_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgra8888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgra8888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGRA8888 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgra8888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgra8888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGRA8888_RGB565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_bgra8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_bgra8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_BGRA8888 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_bgra8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_bgra8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_BGRA8888_RGBA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb565_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb565_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB565 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb565_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb565_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB565_BGR565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb565_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb565_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB565 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb565_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb565_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB565_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb565_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb565_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB565 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb565_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb565_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB565_RGB565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb565_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb565_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB565 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb565_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb565_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB565_RGBA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB888 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB888_BGR565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB888 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB888_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB888 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB888_RGB565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb888_rgb888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb888_rgb888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB888 && src->format == BITMAP_FMT_RGB888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb888_rgb888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb888_rgb888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB888_RGB888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgb888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgb888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGB888 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgb888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgb888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGB888_RGBA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgba8888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgba8888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGBA8888 && src->format == BITMAP_FMT_BGR565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgba8888_bgr565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgba8888_bgr565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGBA8888_BGR565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgba8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgba8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGBA8888 && src->format == BITMAP_FMT_BGRA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgba8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgba8888_bgra8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGBA8888_BGRA8888_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgba8888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgba8888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGBA8888 && src->format == BITMAP_FMT_RGB565,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgba8888_rgb565(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgba8888_rgb565(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGBA8888_RGB565_H*/
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "pixel_ops.inc"
|
||||
#include "blend_image.inc"
|
||||
|
||||
ret_t blend_image_rgba8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a) {
|
||||
ret_t blend_image_rgba8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
return_value_if_fail(dst->format == BITMAP_FMT_RGBA8888 && src->format == BITMAP_FMT_RGBA8888,
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "base/bitmap.h"
|
||||
|
||||
ret_t blend_image_rgba8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r,
|
||||
const rect_t* src_r, uint8_t a);
|
||||
ret_t blend_image_rgba8888_rgba8888(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r,
|
||||
const rectf_t* src_r, uint8_t a);
|
||||
|
||||
#endif /*TK_BLEND_IMAGE_RGBA8888_RGBA8888_H*/
|
||||
|
@ -82,7 +82,7 @@ ret_t image_rotate(bitmap_t* dst, bitmap_t* src, const rect_t* src_r, lcd_orient
|
||||
return soft_rotate_image(dst, src, src_r, o);
|
||||
}
|
||||
|
||||
ret_t image_blend(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r,
|
||||
ret_t image_blend(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r,
|
||||
uint8_t global_alpha) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && dst_r != NULL && src_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
@ -91,8 +91,12 @@ ret_t image_blend(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_
|
||||
assert(dst_r->y >= 0 && (dst_r->y + dst_r->h) <= dst->h);
|
||||
|
||||
#ifdef WITH_G2D
|
||||
if (g2d_blend_image(dst, src, dst_r, src_r, global_alpha) == RET_OK) {
|
||||
return RET_OK;
|
||||
if (src_r->w == dst_r->w && src_r->h == dst_r->h) {
|
||||
rect_t tmp_src_r = rect_from_rectf(src_r);
|
||||
rect_t tmp_dst_r = rect_from_rectf(dst_r);
|
||||
if (g2d_blend_image(dst, src, (const rect_t*)&tmp_dst_r, (const rect_t*)&tmp_src_r, global_alpha) == RET_OK) {
|
||||
return RET_OK;
|
||||
}
|
||||
}
|
||||
#endif /*WITH_G2D*/
|
||||
|
||||
|
@ -80,13 +80,13 @@ ret_t image_rotate(bitmap_t* dst, bitmap_t* src, const rect_t* src_r, lcd_orient
|
||||
*
|
||||
* @param {bitmap_t*} dst 目标图片对象。
|
||||
* @param {bitmap_t*} src 源图片对象。
|
||||
* @param {const rect_t*} dst_r 目的区域。
|
||||
* @param {const rect_t*} src_r 源区域。
|
||||
* @param {const rectf_t*} dst_r 目的区域。
|
||||
* @param {const rectf_t*} src_r 源区域。
|
||||
* @param {uint8_t} global_alpha 全局alpha。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败,返回失败则上层用软件实现。
|
||||
*/
|
||||
ret_t image_blend(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r,
|
||||
ret_t image_blend(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r,
|
||||
uint8_t global_alpha);
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -223,7 +223,7 @@ ret_t soft_rotate_image(bitmap_t* dst, bitmap_t* src, const rect_t* src_r, lcd_o
|
||||
return RET_NOT_IMPL;
|
||||
}
|
||||
|
||||
ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r,
|
||||
ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r,
|
||||
uint8_t alpha) {
|
||||
return_value_if_fail(dst != NULL && src != NULL && src_r != NULL && dst_r != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
@ -233,7 +233,8 @@ ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const
|
||||
switch (src->format) {
|
||||
case BITMAP_FMT_BGR565: {
|
||||
if (dst_r->w == src_r->w && dst_r->h == src_r->h && alpha > 0xf8) {
|
||||
return soft_copy_image(dst, src, src_r, dst_r->x, dst_r->y);
|
||||
rect_t tmp_src = rect_from_rectf(src_r);
|
||||
return soft_copy_image(dst, src, (const rect_t*)(&tmp_src), (xy_t)(dst_r->x), (xy_t)(dst_r->y));
|
||||
} else {
|
||||
return blend_image_bgr565_bgr565(dst, src, dst_r, src_r, alpha);
|
||||
}
|
||||
@ -259,7 +260,8 @@ ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const
|
||||
switch (src->format) {
|
||||
case BITMAP_FMT_RGB565: {
|
||||
if (dst_r->w == src_r->w && dst_r->h == src_r->h && alpha > 0xf8) {
|
||||
return soft_copy_image(dst, src, src_r, dst_r->x, dst_r->y);
|
||||
rect_t tmp_src = rect_from_rectf(src_r);
|
||||
return soft_copy_image(dst, src, (const rect_t*)(&tmp_src), (xy_t)(dst_r->x), (xy_t)(dst_r->y));
|
||||
} else {
|
||||
return blend_image_rgb565_rgb565(dst, src, dst_r, src_r, alpha);
|
||||
}
|
||||
@ -288,7 +290,8 @@ ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const
|
||||
}
|
||||
case BITMAP_FMT_BGR888: {
|
||||
if (dst_r->w == src_r->w && dst_r->h == src_r->h && alpha > 0xf8) {
|
||||
return soft_copy_image(dst, src, src_r, dst_r->x, dst_r->y);
|
||||
rect_t tmp_src = rect_from_rectf(src_r);
|
||||
return soft_copy_image(dst, src, (const rect_t*)(&tmp_src), (xy_t)(dst_r->x), (xy_t)(dst_r->y));
|
||||
} else {
|
||||
return blend_image_bgr888_bgr888(dst, src, dst_r, src_r, alpha);
|
||||
}
|
||||
@ -314,7 +317,8 @@ ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const
|
||||
}
|
||||
case BITMAP_FMT_RGB888: {
|
||||
if (dst_r->w == src_r->w && dst_r->h == src_r->h && alpha > 0xf8) {
|
||||
return soft_copy_image(dst, src, src_r, dst_r->x, dst_r->y);
|
||||
rect_t tmp_src = rect_from_rectf(src_r);
|
||||
return soft_copy_image(dst, src, (const rect_t*)(&tmp_src), (xy_t)(dst_r->x), (xy_t)(dst_r->y));
|
||||
} else {
|
||||
return blend_image_rgb888_rgb888(dst, src, dst_r, src_r, alpha);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ ret_t soft_fill_rect(bitmap_t* dst, const rect_t* dst_r, color_t c);
|
||||
ret_t soft_clear_rect(bitmap_t* dst, const rect_t* dst_r, color_t c);
|
||||
ret_t soft_copy_image(bitmap_t* dst, bitmap_t* src, const rect_t* src_r, xy_t dx, xy_t dy);
|
||||
ret_t soft_rotate_image(bitmap_t* dst, bitmap_t* src, const rect_t* src_r, lcd_orientation_t o);
|
||||
ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rect_t* dst_r, const rect_t* src_r,
|
||||
ret_t soft_blend_image(bitmap_t* dst, bitmap_t* src, const rectf_t* dst_r, const rectf_t* src_r,
|
||||
uint8_t global_alpha);
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -247,7 +247,7 @@ static ret_t lcd_mem_draw_image_matrix(lcd_t* lcd, draw_image_info_t* info) {
|
||||
return RET_NOT_IMPL;
|
||||
}
|
||||
|
||||
static ret_t lcd_mem_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
static ret_t lcd_mem_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
bitmap_t fb;
|
||||
ret_t ret = RET_OK;
|
||||
bool_t is_opaque = (img->flags & BITMAP_FLAG_OPAQUE || img->format == BITMAP_FMT_RGB565);
|
||||
@ -256,9 +256,9 @@ static ret_t lcd_mem_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, co
|
||||
|
||||
if (img->format == fb.format && is_opaque && src->w == dst->w && src->h == dst->h &&
|
||||
lcd->global_alpha >= TK_OPACITY_ALPHA) {
|
||||
rect_t r = *src;
|
||||
xy_t dx = dst->x;
|
||||
xy_t dy = dst->y;
|
||||
xy_t dx = (xy_t)(dst->x);
|
||||
xy_t dy = (xy_t)(dst->y);
|
||||
rect_t r = rect_from_rectf(src);
|
||||
ret = image_copy(&fb, img, &r, dx, dy);
|
||||
} else {
|
||||
ret = image_blend(&fb, img, dst, src, lcd->global_alpha);
|
||||
|
@ -218,14 +218,14 @@ static ret_t lcd_mem_fragment_draw_glyph(lcd_t* lcd, glyph_t* glyph, const rect_
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t lcd_mem_fragment_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
static ret_t lcd_mem_fragment_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
lcd_mem_fragment_t* mem = (lcd_mem_fragment_t*)lcd;
|
||||
|
||||
ret_t ret = RET_OK;
|
||||
bitmap_t* fb = &(mem->fb);
|
||||
int32_t x = dst->x - mem->x;
|
||||
int32_t y = dst->y - mem->y;
|
||||
rect_t d = rect_init(x, y, dst->w, dst->h);
|
||||
rectf_t d = rectf_init(x, y, dst->w, dst->h);
|
||||
bool_t is_opaque = (img->flags & BITMAP_FLAG_OPAQUE || img->format == BITMAP_FMT_RGB565) &&
|
||||
lcd->global_alpha >= TK_OPACITY_ALPHA;
|
||||
|
||||
@ -233,7 +233,7 @@ static ret_t lcd_mem_fragment_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t
|
||||
assert(dst->w <= mem->fb.w && dst->h <= mem->fb.h);
|
||||
|
||||
if (img->format == fb->format && is_opaque && src->w == dst->w && src->h == dst->h) {
|
||||
rect_t s = *src;
|
||||
rect_t s = rect_from_rectf(src);
|
||||
ret = image_copy(fb, img, &s, x, y);
|
||||
} else {
|
||||
ret = image_blend(fb, img, &d, src, lcd->global_alpha);
|
||||
|
@ -137,20 +137,21 @@ static ret_t lcd_mono_draw_glyph(lcd_t* lcd, glyph_t* glyph, const rect_t* src,
|
||||
return lcd_mono_draw_data(lcd, glyph->data, glyph->w, glyph->h, src, x, y, !pixel);
|
||||
}
|
||||
|
||||
static ret_t lcd_mono_draw_image_mono(lcd_t* lcd, bitmap_t* img, const rect_t* src,
|
||||
const rect_t* dst) {
|
||||
static ret_t lcd_mono_draw_image_mono(lcd_t* lcd, bitmap_t* img, const rectf_t* src,
|
||||
const rectf_t* dst) {
|
||||
ret_t ret = RET_OK;
|
||||
const uint8_t* data = NULL;
|
||||
rect_t tmp_src = rect_from_rectf(src);
|
||||
return_value_if_fail(src->w == dst->w && src->h == dst->h, RET_OK);
|
||||
|
||||
data = bitmap_lock_buffer_for_read(img);
|
||||
ret = lcd_mono_draw_data(lcd, data, img->w, img->h, src, dst->x, dst->y, FALSE);
|
||||
ret = lcd_mono_draw_data(lcd, data, img->w, img->h, (const rect_t*)(&tmp_src), (xy_t)(dst->x), (xy_t)(dst->y), FALSE);
|
||||
bitmap_unlock_buffer(img);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ret_t lcd_mono_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
static ret_t lcd_mono_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
return_value_if_fail(img->format == BITMAP_FMT_MONO, RET_NOT_IMPL);
|
||||
return_value_if_fail(src->w == dst->w && src->h == dst->h, RET_NOT_IMPL);
|
||||
|
||||
|
@ -191,15 +191,15 @@ static ret_t lcd_vgcanvas_draw_points(lcd_t* lcd, point_t* points, uint32_t nr)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t lcd_vgcanvas_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
int sx = src->x;
|
||||
int sy = src->y;
|
||||
int sw = src->w;
|
||||
int sh = src->h;
|
||||
int dx = dst->x;
|
||||
int dy = dst->y;
|
||||
int dw = dst->w;
|
||||
int dh = dst->h;
|
||||
static ret_t lcd_vgcanvas_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
float_t sx = src->x;
|
||||
float_t sy = src->y;
|
||||
float_t sw = src->w;
|
||||
float_t sh = src->h;
|
||||
float_t dx = dst->x;
|
||||
float_t dy = dst->y;
|
||||
float_t dw = dst->w;
|
||||
float_t dh = dst->h;
|
||||
ret_t ret = RET_OK;
|
||||
vgcanvas_t* canvas = LCD(lcd)->canvas;
|
||||
|
||||
|
@ -198,3 +198,38 @@ rect_t* rect_scale(rect_t* r, float_t scale) {
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
rectf_t* rectf_scale(rectf_t* r, float_t scale) {
|
||||
return_value_if_fail(r != NULL, r);
|
||||
|
||||
if (scale != 1.0f) {
|
||||
r->x = r->x * scale;
|
||||
r->y = r->y * scale;
|
||||
r->w = r->w * scale;
|
||||
r->h = r->h * scale;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
rectf_t rect_to_rectf(const rect_t* r) {
|
||||
rectf_t tmp_r = {0};
|
||||
return_value_if_fail(r != NULL, tmp_r);
|
||||
tmp_r.x = (float_t)(r->x);
|
||||
tmp_r.y = (float_t)(r->y);
|
||||
tmp_r.w = (float_t)(r->w);
|
||||
tmp_r.h = (float_t)(r->h);
|
||||
|
||||
return tmp_r;
|
||||
}
|
||||
|
||||
rect_t rect_from_rectf(const rectf_t* r) {
|
||||
rect_t tmp_r = {0};
|
||||
return_value_if_fail(r != NULL, tmp_r);
|
||||
tmp_r.x = tk_roundi(r->x);
|
||||
tmp_r.y = tk_roundi(r->y);
|
||||
tmp_r.w = tk_roundi(r->w);
|
||||
tmp_r.h = tk_roundi(r->h);
|
||||
|
||||
return tmp_r;
|
||||
}
|
||||
|
@ -284,6 +284,37 @@ rect_t rect_intersect(const rect_t* r1, const rect_t* r2);
|
||||
*/
|
||||
bool_t rect_has_intersect(const rect_t* r1, const rect_t* r2);
|
||||
|
||||
/**
|
||||
* @method rectf_scale
|
||||
* 缩放rectf对象。
|
||||
*
|
||||
* @param {rectf_t*} r rect对象。
|
||||
* @param {float_t} scale 缩放比例。
|
||||
*
|
||||
* @return {rectf_t*} 返回rect对象。
|
||||
*/
|
||||
rectf_t* rectf_scale(rectf_t* r, float_t scale);
|
||||
|
||||
/**
|
||||
* @method rect_to_rectf
|
||||
* rect 类型转换到 rectf 类型。
|
||||
*
|
||||
* @param {const rect_t*} r1 rect 对象。
|
||||
*
|
||||
* @return {rectf_t} 返回 rectf_t 对象。
|
||||
*/
|
||||
rectf_t rect_to_rectf(const rect_t* r);
|
||||
|
||||
/**
|
||||
* @method rect_from_rectf
|
||||
* rectf 类型转换到 rect 类型。
|
||||
*
|
||||
* @param {const rectf_t*} r rectf 对象。
|
||||
*
|
||||
* @return {rect_t} 返回 rect 对象。
|
||||
*/
|
||||
rect_t rect_from_rectf(const rectf_t* r);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /*TK_RECT_H*/
|
||||
|
@ -46,9 +46,8 @@ static ret_t window_animator_center_scale_draw_curr(window_animator_t* wa) {
|
||||
float_t scale = wa->percent;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(win->x, win->y, win->w, win->h);
|
||||
rect_t dst = rect_init(0, 0, win->w * scale, win->h * scale);
|
||||
|
||||
rectf_t src = rectf_init(win->x, win->y, win->w, win->h);
|
||||
rectf_t dst = rectf_init(0.0f, 0.0f, win->w * scale, win->h * scale);
|
||||
if (wa->time_percent < 5) {
|
||||
float_t alpha = wa->open ? wa->time_percent : 1 - wa->time_percent;
|
||||
lcd_set_global_alpha(c->lcd, alpha * 0xff);
|
||||
@ -56,10 +55,10 @@ static ret_t window_animator_center_scale_draw_curr(window_animator_t* wa) {
|
||||
lcd_set_global_alpha(c->lcd, 0xff);
|
||||
}
|
||||
|
||||
dst.x = win->x + ((win->w - dst.w) >> 1);
|
||||
dst.y = win->y + ((win->h - dst.h) >> 1);
|
||||
dst.x = win->x + ((win->w - dst.w) / 2.0f);
|
||||
dst.y = win->y + ((win->h - dst.h) / 2.0f);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
#ifdef WITH_NANOVG_GPU
|
||||
vgcanvas_t* vg = canvas_get_vgcanvas(c);
|
||||
|
@ -37,14 +37,14 @@ ret_t window_animator_to_bottom_draw_curr(window_animator_t* wa) {
|
||||
int32_t y = win->y;
|
||||
int32_t h = tk_roundi(win->h * percent);
|
||||
|
||||
rect_t src = rect_init(win->x, win->y + win->h - h, win->w, h);
|
||||
rect_t dst = rect_init(win->x, y, win->w, h);
|
||||
rectf_t src = rectf_init(win->x, win->y + win->h - h, win->w, h);
|
||||
rectf_t dst = rectf_init(win->x, y, win->w, h);
|
||||
|
||||
if (h == 0) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
int32_t y = -win->h * (1 - percent);
|
||||
canvas_translate(c, 0, y);
|
||||
@ -62,14 +62,14 @@ ret_t window_animator_to_top_draw_curr(window_animator_t* wa) {
|
||||
int32_t y = win->y + tk_roundi(win->h * (1 - percent));
|
||||
int32_t h = win->y + win->h - y;
|
||||
|
||||
rect_t src = rect_init(win->x, win->y, win->w, h);
|
||||
rect_t dst = rect_init(win->x, y, win->w, h);
|
||||
rectf_t src = rectf_init(win->x, win->y, win->w, h);
|
||||
rectf_t dst = rectf_init(win->x, y, win->w, h);
|
||||
|
||||
if (h == 0) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
int32_t y = win->h * (1 - percent);
|
||||
canvas_translate(c, 0, y);
|
||||
@ -87,14 +87,14 @@ ret_t window_animator_to_left_draw_curr(window_animator_t* wa) {
|
||||
int32_t x = win->x + tk_roundi(win->w * (1 - percent));
|
||||
int32_t w = win->x + win->w - x;
|
||||
|
||||
rect_t src = rect_init(win->x, win->y, w, win->h);
|
||||
rect_t dst = rect_init(x, win->y, w, win->h);
|
||||
rectf_t src = rectf_init(win->x, win->y, w, win->h);
|
||||
rectf_t dst = rectf_init(x, win->y, w, win->h);
|
||||
|
||||
if (w == 0) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
int32_t x = -win->w * (1 - percent);
|
||||
|
||||
@ -112,14 +112,14 @@ ret_t window_animator_to_right_draw_curr(window_animator_t* wa) {
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
int32_t x = win->x;
|
||||
int32_t w = tk_roundi(win->w * percent);
|
||||
rect_t src = rect_init(win->x + win->w - w, win->y, w, win->h);
|
||||
rect_t dst = rect_init(x, win->y, w, win->h);
|
||||
rectf_t src = rectf_init(win->x + win->w - w, win->y, w, win->h);
|
||||
rectf_t dst = rectf_init(x, win->y, w, win->h);
|
||||
|
||||
if (w == 0) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
int32_t x = win->w * (1 - percent);
|
||||
|
||||
@ -309,10 +309,9 @@ ret_t window_animator_overlap_default_draw_prev(window_animator_t* wa) {
|
||||
widget_t* win = wa->prev_win;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(win->x, win->y, win->w, win->h);
|
||||
rect_t dst = rect_init(win->x, win->y, win->w, win->h);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rect_scale(&src, wa->ratio), &dst);
|
||||
rectf_t src = rectf_init(win->x, win->y, win->w, win->h);
|
||||
rectf_t dst = rectf_init(win->x, win->y, win->w, win->h);
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
widget_paint(win, c);
|
||||
return RET_OK;
|
||||
|
@ -27,12 +27,11 @@ static ret_t window_animator_fade_draw_curr(window_animator_t* wa) {
|
||||
|
||||
uint8_t global_alpha = wa->percent * 0xff;
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t dst = rect_init(win->x, win->y, win->w, win->h);
|
||||
rect_t src = rect_init(win->x, win->y, win->w, win->h);
|
||||
|
||||
rectf_t dst = rectf_init(win->x, win->y, win->w, win->h);
|
||||
rectf_t src = rectf_init(win->x, win->y, win->w, win->h);
|
||||
lcd_set_global_alpha(c->lcd, global_alpha);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
lcd_set_global_alpha(c->lcd, global_alpha);
|
||||
|
||||
|
@ -40,10 +40,9 @@ static ret_t window_animator_htranslate_draw_prev(window_animator_t* wa) {
|
||||
float_t w = win->w - x;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(x, win->y, w, win->h);
|
||||
rect_t dst = rect_init(0, win->y, w, win->h);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rect_scale(&src, wa->ratio), &dst);
|
||||
rectf_t src = rectf_init(x, win->y, w, win->h);
|
||||
rectf_t dst = rectf_init(0.0f, win->y, w, win->h);
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
canvas_translate(c, -x, 0);
|
||||
widget_paint(win, c);
|
||||
@ -60,10 +59,9 @@ static ret_t window_animator_htranslate_draw_curr(window_animator_t* wa) {
|
||||
float_t w = win->w - x;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(0, win->y, w, win->h);
|
||||
rect_t dst = rect_init(x, win->y, w, win->h);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
rectf_t src = rectf_init(0.0f, win->y, w, win->h);
|
||||
rectf_t dst = rectf_init(x, win->y, w, win->h);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
canvas_translate(c, x, 0);
|
||||
widget_paint(win, c);
|
||||
|
@ -41,10 +41,9 @@ static ret_t window_animator_vtranslate_draw_prev(window_animator_t* wa) {
|
||||
float_t h = win->h - y;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(win->x, y + win->y, win->w, h);
|
||||
rect_t dst = rect_init(win->x, win->y, win->w, h);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rect_scale(&src, wa->ratio), &dst);
|
||||
rectf_t src = rectf_init(win->x, y + win->y, win->w, h);
|
||||
rectf_t dst = rectf_init(win->x, win->y, win->w, h);
|
||||
return lcd_draw_image(c->lcd, &(wa->prev_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
canvas_translate(c, 0, -y);
|
||||
widget_paint(win, c);
|
||||
@ -61,10 +60,9 @@ static ret_t window_animator_vtranslate_draw_curr(window_animator_t* wa) {
|
||||
float_t y = win->parent->h - h;
|
||||
|
||||
#ifndef WITHOUT_WINDOW_ANIMATOR_CACHE
|
||||
rect_t src = rect_init(win->x, win->y, win->w, h);
|
||||
rect_t dst = rect_init(win->x, y, win->w, h);
|
||||
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rect_scale(&src, wa->ratio), &dst);
|
||||
rectf_t src = rectf_init(win->x, win->y, win->w, h);
|
||||
rectf_t dst = rectf_init(win->x, y, win->w, h);
|
||||
return lcd_draw_image(c->lcd, &(wa->curr_img), rectf_scale(&src, wa->ratio), &dst);
|
||||
#else
|
||||
y = win->h * (1 - percent);
|
||||
canvas_translate(c, 0, y);
|
||||
|
@ -10,6 +10,8 @@ static void test_blend_image(uint32_t stride, bitmap_format_t bgfmt, bitmap_form
|
||||
uint32_t h = 8;
|
||||
rect_t r = rect_init(2, 2, 3, 3);
|
||||
rect_t r_all = rect_init(0, 0, w, h);
|
||||
rectf_t rf = rect_to_rectf((const rect_t*)(&r));
|
||||
rectf_t rf_all = rect_to_rectf((const rect_t*)(&r_all));
|
||||
uint32_t bpp = bitmap_get_bpp_of_format(bgfmt);
|
||||
bitmap_t* bg = bitmap_create_ex(w, h, bpp * (w + stride), bgfmt);
|
||||
bitmap_t* fg = bitmap_create_ex(w, h, bpp * (w + stride), fgfmt);
|
||||
@ -18,7 +20,7 @@ static void test_blend_image(uint32_t stride, bitmap_format_t bgfmt, bitmap_form
|
||||
color_t c_clear = color_init(0x0, 0x0, 0x0, 0xff);
|
||||
|
||||
ASSERT_EQ(image_clear(fg, &r, c), RET_OK);
|
||||
ASSERT_EQ(image_blend(bg, fg, &r, &r, 0xff), RET_OK);
|
||||
ASSERT_EQ(image_blend(bg, fg, &rf, &rf, 0xff), RET_OK);
|
||||
|
||||
bitmap_dump(bg);
|
||||
bitmap_check(bg, &r, c.rgba);
|
||||
@ -26,7 +28,7 @@ static void test_blend_image(uint32_t stride, bitmap_format_t bgfmt, bitmap_form
|
||||
ASSERT_EQ(image_clear(bg, &r_all, c_clear), RET_OK);
|
||||
bitmap_dump(bg);
|
||||
|
||||
ASSERT_EQ(image_blend(bg, fg, &r_all, &r, 0xff), RET_OK);
|
||||
ASSERT_EQ(image_blend(bg, fg, &rf_all, &rf, 0xff), RET_OK);
|
||||
bitmap_dump(bg);
|
||||
bitmap_check(bg, &r_all, c.rgba);
|
||||
|
||||
|
@ -94,7 +94,7 @@ static ret_t lcd_log_draw_glyph(lcd_t* lcd, glyph_t* glyph, const rect_t* src, x
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t lcd_log_draw_image(lcd_t* lcd, bitmap_t* img, const rect_t* src, const rect_t* dst) {
|
||||
static ret_t lcd_log_draw_image(lcd_t* lcd, bitmap_t* img, const rectf_t* src, const rectf_t* dst) {
|
||||
lcd_log_t* log = (lcd_log_t*)lcd;
|
||||
|
||||
log->str += "dg(" + (itos(src->x)) + string(",") + (itos(src->y)) + string(",") + (itos(src->w)) +
|
||||
|
@ -208,8 +208,8 @@ static void bitmap_gen(bitmap_t* b, uint32_t w, uint32_t h) {
|
||||
static void test_draw_bitmap(lcd_t* lcd, uint32_t x, uint32_t y, uint32_t w, uint32_t h) {
|
||||
bitmap_t b;
|
||||
bitmap_gen(&b, w, h);
|
||||
rect_t r = rect_init(0, 0, w, h);
|
||||
rect_t d = rect_init(x, y, w, h);
|
||||
rectf_t r = rectf_init(0, 0, w, h);
|
||||
rectf_t d = rectf_init(x, y, w, h);
|
||||
uint8_t* bdata = bitmap_lock_buffer_for_write(&b);
|
||||
ASSERT_EQ(lcd_draw_image(lcd, &b, &r, &d), RET_OK);
|
||||
lcd_check_data(lcd, (uint8_t*)(bdata), x, y, w, h);
|
||||
|
Loading…
x
Reference in New Issue
Block a user