Add RGB blending logic needed to support anti-aliasing
This commit is contained in:
parent
6fa0de358d
commit
4bcd13eabd
2
configs
2
configs
|
@ -1 +1 @@
|
|||
Subproject commit 6ef8051be6870845a0cbbe769fcf9a3205285123
|
||||
Subproject commit 9b001f72c97902ceb979fe44c5564c17d3f19be3
|
|
@ -121,6 +121,7 @@
|
|||
/* Conversions */
|
||||
|
||||
#define b8toi(a) ((a) >> 8) /* Conversion to integer */
|
||||
#define ub8toi(a) ((a) >> 8) /* Conversion to unsigned integer */
|
||||
#define itob8(i) (((b8_t)(i)) << 8) /* Conversion from integer */
|
||||
#define uitoub8(i) (((ub8_t)(i)) << 8) /* Conversion from unsigned integer */
|
||||
#define b8tof(b) (((float)b)/256.0) /* Conversion to float */
|
||||
|
@ -152,6 +153,7 @@
|
|||
/* Conversions */
|
||||
|
||||
#define b16toi(a) ((a) >> 16) /* Conversion to integer */
|
||||
#define ub16toi(a) ((a) >> 16) /* Conversion to unsgined integer */
|
||||
#define itob16(i) (((b16_t)(i)) << 16) /* Conversion from integer */
|
||||
#define uitoub16(i) (((ub16_t)(i)) << 16) /* Conversion from unsigned integer */
|
||||
#define b16tof(b) (((float)b)/65536.0) /* Conversion to float */
|
||||
|
|
|
@ -745,6 +745,39 @@ void nxgl_circletraps(FAR const struct nxgl_point_s *center,
|
|||
nxgl_coord_t radius,
|
||||
FAR struct nxgl_trapezoid_s *circle);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxglib_rgb24_blend and nxglib_rgb565_blend
|
||||
*
|
||||
* Description:
|
||||
* Blend a foreground color onto a background color. This is *not* alpha
|
||||
* blending: color2 is assumed to be opaque and "under" a semi-
|
||||
* transparent color1.
|
||||
*
|
||||
* The frac1 value could be though as related to the 1/alpha value for
|
||||
* color1. However, the background, color2, is always treated as though
|
||||
* alpha == 1.
|
||||
*
|
||||
* This algorithm is used to handle endpoints as part of the
|
||||
* implementation of anti-aliasing without transparency.
|
||||
*
|
||||
* Input Parameters:
|
||||
* color1 - The semi-transparent, forground color
|
||||
* color2 - The opaque, background color
|
||||
* frac1 - The fractional amount of color1 to blend into color2
|
||||
*
|
||||
* Returned Value:
|
||||
* The blended color, encoded just was the input color1 and color2
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_NX_DISABLE_24BPP) || !defined(CONFIG_NX_DISABLE_32BPP)
|
||||
uint32_t nxglib_rgb24_blend(uint32_t color1, uint32_t color2, ub16_t frac1);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NX_DISABLE_16BPP
|
||||
uint16_t nxglib_rgb565_blend(uint16_t color1, uint16_t color2, ub16_t frac1);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ CSRCS += nxglib_circlepts.c nxglib_circletraps.c nxglib_intersecting.c
|
|||
CSRCS += nxglib_nonintersecting.c nxglib_nullrect.c nxglib_rectadd.c
|
||||
CSRCS += nxglib_rectcopy.c nxglib_rectinside.c nxglib_rectintersect.c
|
||||
CSRCS += nxglib_rectoffset.c nxglib_rectoverlap.c nxglib_rectsize.c
|
||||
CSRCS += nxglib_rectunion.c nxglib_rgb2yuv.c nxglib_runcopy.c
|
||||
CSRCS += nxglib_runoffset.c nxglib_splitline.c nxglib_trapcopy.c
|
||||
CSRCS += nxglib_trapoffset.c nxglib_vectoradd.c nxglib_vectsubtract.c
|
||||
CSRCS += nxglib_yuv2rgb.c
|
||||
CSRCS += nxglib_rectunion.c nxglib_rgb2yuv.c nxglib_rgbblend.c
|
||||
CSRCS += nxglib_runcopy.c nxglib_runoffset.c nxglib_splitline.c
|
||||
CSRCS += nxglib_trapcopy.c nxglib_trapoffset.c nxglib_vectoradd.c
|
||||
CSRCS += nxglib_vectsubtract.c nxglib_yuv2rgb.c
|
||||
|
||||
ifneq ($(CONFIG_NX_NPLANES),1)
|
||||
CSRCS += nxglib_colorcmp.c nxglib_colorcopy.c
|
||||
|
|
Loading…
Reference in New Issue