rest of the drawing modes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11097 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,226 @@
|
||||
// DrawingModeAlphaCC.h
|
||||
|
||||
#ifndef DRAWING_MODE_ALPHA_CC_H
|
||||
#define DRAWING_MODE_ALPHA_CC_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_alpha_cc
|
||||
inline void
|
||||
blend_alpha_cc(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint16 a)
|
||||
{
|
||||
blend_composite(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_alpha_cc
|
||||
inline void
|
||||
assign_alpha_cc(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeAlphaCC : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeAlphaCC()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = fPatternHandler->HighColor().GetColor32().alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
rgb_color color = fPatternHandler->HighColor().GetColor32();
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
// cache the low and high color as 32bit values
|
||||
// high color
|
||||
int32u vh;
|
||||
int8u* p8 = (int8u*)&vh;
|
||||
p8[Order::R] = color.red;
|
||||
p8[Order::G] = color.green;
|
||||
p8[Order::B] = color.blue;
|
||||
p8[Order::A] = 255;
|
||||
// low color
|
||||
color = fPatternHandler->LowColor().GetColor32();
|
||||
int32u vl;
|
||||
p8 = (int8u*)&vl;
|
||||
p8[Order::R] = color.red;
|
||||
p8[Order::G] = color.green;
|
||||
p8[Order::B] = color.blue;
|
||||
p8[Order::A] = 255;
|
||||
// row offset as 32bit pointer
|
||||
int32u* p32 = (int32u*)(m_rbuf->row(y)) + x;
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y))
|
||||
*p32 = vh;
|
||||
else
|
||||
*p32 = vl;
|
||||
p32++;
|
||||
x++;
|
||||
} while(--len);
|
||||
} else {
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaCC::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if(alpha == 255*255) {
|
||||
assign_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = hAlpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
do {
|
||||
assign_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (alpha) {
|
||||
do {
|
||||
blend_alpha_cc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaCC::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeAlphaCC<order_rgba32> DrawingModeRGBA32AlphaCC; //----DrawingModeRGBA32AlphaCC
|
||||
typedef DrawingModeAlphaCC<order_argb32> DrawingModeARGB32AlphaCC; //----DrawingModeARGB32AlphaCC
|
||||
typedef DrawingModeAlphaCC<order_abgr32> DrawingModeABGR32AlphaCC; //----DrawingModeABGR32AlphaCC
|
||||
typedef DrawingModeAlphaCC<order_bgra32> DrawingModeBGRA32AlphaCC; //----DrawingModeBGRA32AlphaCC
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_ALPHA_CC_H
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
// DrawingModeAlphaCO.h
|
||||
|
||||
#ifndef DRAWING_MODE_ALPHA_CO_H
|
||||
#define DRAWING_MODE_ALPHA_CO_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_alpha_co
|
||||
inline void
|
||||
blend_alpha_co(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint16 a)
|
||||
{
|
||||
blend(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_alpha_co
|
||||
inline void
|
||||
assign_alpha_co(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeAlphaCO : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeAlphaCO()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = fPatternHandler->HighColor().GetColor32().alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
rgb_color color = fPatternHandler->HighColor().GetColor32();
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
// cache the low and high color as 32bit values
|
||||
// high color
|
||||
int32u vh;
|
||||
int8u* p8 = (int8u*)&vh;
|
||||
p8[Order::R] = color.red;
|
||||
p8[Order::G] = color.green;
|
||||
p8[Order::B] = color.blue;
|
||||
p8[Order::A] = 255;
|
||||
// low color
|
||||
color = fPatternHandler->LowColor().GetColor32();
|
||||
int32u vl;
|
||||
p8 = (int8u*)&vl;
|
||||
p8[Order::R] = color.red;
|
||||
p8[Order::G] = color.green;
|
||||
p8[Order::B] = color.blue;
|
||||
p8[Order::A] = 255;
|
||||
// row offset as 32bit pointer
|
||||
int32u* p32 = (int32u*)(m_rbuf->row(y)) + x;
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y))
|
||||
*p32 = vh;
|
||||
else
|
||||
*p32 = vl;
|
||||
p32++;
|
||||
x++;
|
||||
} while(--len);
|
||||
} else {
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaCO::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if(alpha == 255*255) {
|
||||
assign_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
uint8 hAlpha = fPatternHandler->HighColor().GetColor32().alpha;
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = hAlpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = hAlpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
do {
|
||||
assign_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (alpha) {
|
||||
do {
|
||||
blend_alpha_co(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaCO::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeAlphaCO<order_rgba32> DrawingModeRGBA32AlphaCO; //----DrawingModeRGBA32AlphaCO
|
||||
typedef DrawingModeAlphaCO<order_argb32> DrawingModeARGB32AlphaCO; //----DrawingModeARGB32AlphaCO
|
||||
typedef DrawingModeAlphaCO<order_abgr32> DrawingModeABGR32AlphaCO; //----DrawingModeABGR32AlphaCO
|
||||
typedef DrawingModeAlphaCO<order_bgra32> DrawingModeBGRA32AlphaCO; //----DrawingModeBGRA32AlphaCO
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_ALPHA_CO_H
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
// DrawingModeAlphaPC.h
|
||||
|
||||
#ifndef DRAWING_MODE_ALPHA_PC_H
|
||||
#define DRAWING_MODE_ALPHA_PC_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_alpha_pc
|
||||
inline void
|
||||
blend_alpha_pc(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint16 a)
|
||||
{
|
||||
blend_composite(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_alpha_pc
|
||||
inline void
|
||||
assign_alpha_pc(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeAlphaPC : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeAlphaPC()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha) {
|
||||
if (alpha == 255) {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaPC::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * *covers;
|
||||
if (alpha) {
|
||||
if(alpha == 255*255) {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = colors->a * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = colors->a * cover;
|
||||
if (alpha == 255*255) {
|
||||
do {
|
||||
assign_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (alpha) {
|
||||
do {
|
||||
blend_alpha_pc(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaPC::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeAlphaPC<order_rgba32> DrawingModeRGBA32AlphaPC; //----DrawingModeRGBA32AlphaPC
|
||||
typedef DrawingModeAlphaPC<order_argb32> DrawingModeARGB32AlphaPC; //----DrawingModeARGB32AlphaPC
|
||||
typedef DrawingModeAlphaPC<order_abgr32> DrawingModeABGR32AlphaPC; //----DrawingModeABGR32AlphaPC
|
||||
typedef DrawingModeAlphaPC<order_bgra32> DrawingModeBGRA32AlphaPC; //----DrawingModeBGRA32AlphaPC
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_ALPHA_PC_H
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
// DrawingModeAlphaPO.h
|
||||
|
||||
#ifndef DRAWING_MODE_ALPHA_PO_H
|
||||
#define DRAWING_MODE_ALPHA_PO_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_alpha_po
|
||||
inline void
|
||||
blend_alpha_po(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint16 a)
|
||||
{
|
||||
blend(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_alpha_po
|
||||
inline void
|
||||
assign_alpha_po(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeAlphaPO : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeAlphaPO()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * cover;
|
||||
if (alpha) {
|
||||
if (alpha == 255) {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaPO::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * *covers;
|
||||
if (alpha) {
|
||||
if(alpha == 255*255) {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
do {
|
||||
rgb_color color = fPatternHandler->R5ColorAt(x, y);
|
||||
uint16 alpha = color.alpha * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
uint16 alpha = colors->a * *covers;
|
||||
if (alpha) {
|
||||
if (alpha == 255*255) {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
uint16 alpha = colors->a * cover;
|
||||
if (alpha == 255*255) {
|
||||
do {
|
||||
assign_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (alpha) {
|
||||
do {
|
||||
blend_alpha_po(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, alpha);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeAlphaPO::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeAlphaPO<order_rgba32> DrawingModeRGBA32AlphaPO; //----DrawingModeRGBA32AlphaPO
|
||||
typedef DrawingModeAlphaPO<order_argb32> DrawingModeARGB32AlphaPO; //----DrawingModeARGB32AlphaPO
|
||||
typedef DrawingModeAlphaPO<order_abgr32> DrawingModeABGR32AlphaPO; //----DrawingModeABGR32AlphaPO
|
||||
typedef DrawingModeAlphaPO<order_bgra32> DrawingModeBGRA32AlphaPO; //----DrawingModeBGRA32AlphaPO
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_ALPHA_PO_H
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
// DrawingModeErase.h
|
||||
|
||||
#ifndef DRAWING_MODE_ERASE_H
|
||||
#define DRAWING_MODE_ERASE_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_erase
|
||||
inline void
|
||||
blend_erase(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint8 a)
|
||||
{
|
||||
blend(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_erase
|
||||
inline void
|
||||
assign_erase(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeErase : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeErase()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->LowColor().GetColor32();
|
||||
if (cover == 255) {
|
||||
assign_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, cover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
if(cover == 255) {
|
||||
rgb_color color = fPatternHandler->LowColor().GetColor32();
|
||||
int32u v;
|
||||
int8u* p8 = (int8u*)&v;
|
||||
p8[Order::R] = (int8u)color.red;
|
||||
p8[Order::G] = (int8u)color.green;
|
||||
p8[Order::B] = (int8u)color.blue;
|
||||
p8[Order::A] = 255;
|
||||
int32u* p32 = (int32u*)(m_rbuf->row(y)) + x;
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y))
|
||||
*p32 = v;
|
||||
p32++;
|
||||
x++;
|
||||
} while(--len);
|
||||
} else {
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->LowColor().GetColor32();
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, cover);
|
||||
}
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeErase::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->LowColor().GetColor32();
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
if (*covers) {
|
||||
if(*covers == 255) {
|
||||
assign_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color color = fPatternHandler->LowColor().GetColor32();
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
if (*covers) {
|
||||
if (*covers == 255) {
|
||||
assign_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
// TODO: compare this with BView
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
if(*covers) {
|
||||
if(*covers == 255) {
|
||||
assign_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
} else {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, *covers);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
if (cover == 255) {
|
||||
do {
|
||||
assign_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (cover) {
|
||||
do {
|
||||
blend_erase(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
colors->r, colors->g, colors->b, cover);
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeErase::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeErase<order_rgba32> DrawingModeRGBA32Erase; //----DrawingModeRGBA32Erase
|
||||
typedef DrawingModeErase<order_argb32> DrawingModeARGB32Erase; //----DrawingModeARGB32Erase
|
||||
typedef DrawingModeErase<order_abgr32> DrawingModeABGR32Erase; //----DrawingModeABGR32Erase
|
||||
typedef DrawingModeErase<order_bgra32> DrawingModeBGRA32Erase; //----DrawingModeBGRA32Erase
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_ERASE_H
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
// DrawingModeSelect.h
|
||||
|
||||
#ifndef DRAWING_MODE_SELECT_H
|
||||
#define DRAWING_MODE_SELECT_H
|
||||
|
||||
#include "DrawingMode.h"
|
||||
|
||||
// blend_select
|
||||
inline void
|
||||
blend_select(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3, uint8 a)
|
||||
{
|
||||
blend(d1, d2, d3, da, s1, s2, s3, a);
|
||||
}
|
||||
|
||||
// assign_select
|
||||
inline void
|
||||
assign_select(uint8* d1, uint8* d2, uint8* d3, uint8* da,
|
||||
uint8 s1, uint8 s2, uint8 s3)
|
||||
{
|
||||
*d1 = s1;
|
||||
*d2 = s2;
|
||||
*d3 = s3;
|
||||
*da = 255;
|
||||
}
|
||||
|
||||
|
||||
namespace agg
|
||||
{
|
||||
template<class Order>
|
||||
class DrawingModeSelect : public DrawingMode
|
||||
{
|
||||
public:
|
||||
typedef Order order_type;
|
||||
|
||||
// constructor
|
||||
DrawingModeSelect()
|
||||
: DrawingMode()
|
||||
{
|
||||
}
|
||||
|
||||
// compare
|
||||
inline bool compare(uint8* p,
|
||||
const rgb_color& high,
|
||||
const rgb_color& low, rgb_color* result)
|
||||
{
|
||||
if (p[Order::R] == high.red &&
|
||||
p[Order::G] == high.green &&
|
||||
p[Order::B] == high.blue) {
|
||||
result->red = low.red;
|
||||
result->green = low.green;
|
||||
result->blue = low.blue;
|
||||
return true;
|
||||
} else if (p[Order::R] == low.red &&
|
||||
p[Order::G] == low.green &&
|
||||
p[Order::B] == low.blue) {
|
||||
result->red = high.red;
|
||||
result->green = high.green;
|
||||
result->blue = high.blue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// blend_pixel
|
||||
virtual void blend_pixel(int x, int y, const color_type& c, int8u cover)
|
||||
{
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color high = fPatternHandler->HighColor().GetColor32();
|
||||
rgb_color low = fPatternHandler->LowColor().GetColor32();
|
||||
rgb_color color;
|
||||
if (compare(p, high, low, &color)) {
|
||||
if (cover == 255) {
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, cover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// blend_hline
|
||||
virtual void blend_hline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color high = fPatternHandler->HighColor().GetColor32();
|
||||
rgb_color low = fPatternHandler->LowColor().GetColor32();
|
||||
rgb_color color;
|
||||
if(cover == 255) {
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)
|
||||
&& compare(p, high, low, &color))
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
} else {
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)
|
||||
&& compare(p, high, low, &color)) {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, cover);
|
||||
}
|
||||
x++;
|
||||
p += 4;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
|
||||
// blend_vline
|
||||
virtual void blend_vline(int x, int y, unsigned len,
|
||||
const color_type& c, int8u cover)
|
||||
{
|
||||
printf("DrawingModeSelect::blend_vline()\n");
|
||||
}
|
||||
|
||||
// blend_solid_hspan
|
||||
virtual void blend_solid_hspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color high = fPatternHandler->HighColor().GetColor32();
|
||||
rgb_color low = fPatternHandler->LowColor().GetColor32();
|
||||
rgb_color color;
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
if (*covers && compare(p, high, low, &color)) {
|
||||
if (*covers == 255) {
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
x++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// blend_solid_vspan
|
||||
virtual void blend_solid_vspan(int x, int y, unsigned len,
|
||||
const color_type& c, const int8u* covers)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color high = fPatternHandler->HighColor().GetColor32();
|
||||
rgb_color low = fPatternHandler->LowColor().GetColor32();
|
||||
rgb_color color;
|
||||
do {
|
||||
if (fPatternHandler->IsHighColor(x, y)) {
|
||||
if (*covers && compare(p, high, low, &color)) {
|
||||
if (*covers == 255) {
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += m_rbuf->stride();
|
||||
y++;
|
||||
} while(--len);
|
||||
}
|
||||
|
||||
|
||||
// blend_color_hspan
|
||||
virtual void blend_color_hspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
int8u* p = m_rbuf->row(y) + (x << 2);
|
||||
rgb_color high = fPatternHandler->HighColor().GetColor32();
|
||||
rgb_color low = fPatternHandler->LowColor().GetColor32();
|
||||
rgb_color color;
|
||||
if (covers) {
|
||||
// non-solid opacity
|
||||
do {
|
||||
if (*covers && compare(p, high, low, &color)) {
|
||||
if (*covers == 255) {
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
} else {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
}
|
||||
covers++;
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
} else {
|
||||
// solid full opcacity
|
||||
if (cover == 255) {
|
||||
do {
|
||||
if (compare(p, high, low, &color)) {
|
||||
assign_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue);
|
||||
}
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
// solid partial opacity
|
||||
} else if (cover) {
|
||||
do {
|
||||
if (compare(p, high, low, &color)) {
|
||||
blend_select(&p[Order::R], &p[Order::G], &p[Order::B], &p[Order::A],
|
||||
color.red, color.green, color.blue, *covers);
|
||||
}
|
||||
p += 4;
|
||||
++colors;
|
||||
} while(--len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// blend_color_vspan
|
||||
virtual void blend_color_vspan(int x, int y, unsigned len,
|
||||
const color_type* colors,
|
||||
const int8u* covers,
|
||||
int8u cover)
|
||||
{
|
||||
printf("DrawingModeSelect::blend_color_vspan()\n");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef DrawingModeSelect<order_rgba32> DrawingModeRGBA32Select; //----DrawingModeRGBA32Select
|
||||
typedef DrawingModeSelect<order_argb32> DrawingModeARGB32Select; //----DrawingModeARGB32Select
|
||||
typedef DrawingModeSelect<order_abgr32> DrawingModeABGR32Select; //----DrawingModeABGR32Select
|
||||
typedef DrawingModeSelect<order_bgra32> DrawingModeBGRA32Select; //----DrawingModeBGRA32Select
|
||||
}
|
||||
|
||||
#endif // DRAWING_MODE_SELECT_H
|
||||
|
||||
Reference in New Issue
Block a user