diff options
author | Yury Melnichek <melnichek@gmail.com> | 2013-08-28 05:40:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:00:26 +0300 |
commit | ddd458ee3ae75a2edb40f1b2264371d0ccc08772 (patch) | |
tree | 3cb8e5518bf54c280270f8a88e68a3eb92737d8d /3party/agg | |
parent | 6294535cc0e2ac42957be64430d611118f96dbd2 (diff) |
[sr] Add pixfmt_rgb4444 to agg.
Diffstat (limited to '3party/agg')
-rw-r--r-- | 3party/agg/agg_pixfmt_rgb_packed.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/3party/agg/agg_pixfmt_rgb_packed.h b/3party/agg/agg_pixfmt_rgb_packed.h index d879517de6..401bbc3165 100644 --- a/3party/agg/agg_pixfmt_rgb_packed.h +++ b/3party/agg/agg_pixfmt_rgb_packed.h @@ -786,6 +786,51 @@ namespace agg const Gamma* m_gamma; }; + //=========================================================blender_rgb4444 + struct blender_rgb4444 + { + typedef rgba8 color_type; + typedef color_type::value_type value_type; + typedef color_type::calc_type calc_type; + typedef int16u pixel_type; + + static AGG_INLINE void blend_pix(pixel_type* p, + unsigned cr, unsigned cg, unsigned cb, + unsigned alpha, + unsigned) + { + pixel_type rgb = *p; + calc_type r = (rgb >> 8) & 0xF0; + calc_type g = (rgb >> 4) & 0xF0; + calc_type b = rgb & 0xF0; + calc_type a = (rgb & 0xF) << 4; + calc_type r1 = color_type::lerp(r, cr, alpha); + calc_type g1 = color_type::lerp(g, cg, alpha); + calc_type b1 = color_type::lerp(b, cb, alpha); + calc_type a1 = color_type::prelerp(a, alpha, alpha); + *p = (pixel_type) + (((r1 >> 4) << 12) | + ((g1 >> 4) << 8) | + ((b1 >> 4) << 4) | + (a1 >> 4)); + } + + static AGG_INLINE pixel_type make_pix(unsigned r, unsigned g, unsigned b) + { + return (pixel_type)(((r & 0xF0) << 8) | + ((g & 0xF0) << 4) | + (b & 0xF0) | + 0xF); + } + + static AGG_INLINE color_type make_color(pixel_type p) + { + return color_type((p >> 8) & 0xF0, + (p >> 4) & 0xF0, + p & 0xF0, + (p & 0xF) << 4); + } + }; //===========================================pixfmt_alpha_blend_rgb_packed @@ -1217,6 +1262,7 @@ namespace agg typedef pixfmt_alpha_blend_rgb_packed<blender_rgbBBA_pre, rendering_buffer> pixfmt_rgbBBA_pre; //----pixfmt_rgbBBA_pre typedef pixfmt_alpha_blend_rgb_packed<blender_bgrABB_pre, rendering_buffer> pixfmt_bgrABB_pre; //----pixfmt_bgrABB_pre + typedef pixfmt_alpha_blend_rgb_packed<blender_rgb4444, rendering_buffer> pixfmt_rgb4444; //-----------------------------------------------------pixfmt_rgb555_gamma template<class Gamma> class pixfmt_rgb555_gamma : |