📄 agg_pixfmt_rgb.h
字号:
{
((value_type*)p)[order_type::R] = c.r;
((value_type*)p)[order_type::G] = c.g;
((value_type*)p)[order_type::B] = c.b;
}
//--------------------------------------------------------------------
AGG_INLINE color_type pixel(int x, int y) const
{
value_type* p = (value_type*)m_rbuf->row_ptr(y) + x + x + x;
return color_type(p[order_type::R],
p[order_type::G],
p[order_type::B]);
}
//--------------------------------------------------------------------
AGG_INLINE void copy_pixel(int x, int y, const color_type& c)
{
value_type* p = (value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x;
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
}
//--------------------------------------------------------------------
AGG_INLINE void blend_pixel(int x, int y, const color_type& c, int8u cover)
{
copy_or_blend_pix((value_type*)m_rbuf->row_ptr(x, y, 1) + x + x + x, c, cover);
}
//--------------------------------------------------------------------
AGG_INLINE void copy_hline(int x, int y,
unsigned len,
const color_type& c)
{
value_type* p = (value_type*)m_rbuf->row_ptr(x, y, len) + x + x + x;
do
{
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
p += 3;
}
while(--len);
}
//--------------------------------------------------------------------
AGG_INLINE void copy_vline(int x, int y,
unsigned len,
const color_type& c)
{
do
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y++, 1) + x + x + x;
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
}
while(--len);
}
//--------------------------------------------------------------------
void blend_hline(int x, int y,
unsigned len,
const color_type& c,
int8u cover)
{
if (c.a)
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y, len) + x + x + x;
calc_type alpha = (calc_type(c.a) * (calc_type(cover) + 1)) >> 8;
if(alpha == base_mask)
{
do
{
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
p += 3;
}
while(--len);
}
else
{
do
{
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
p += 3;
}
while(--len);
}
}
}
//--------------------------------------------------------------------
void blend_vline(int x, int y,
unsigned len,
const color_type& c,
int8u cover)
{
if (c.a)
{
value_type* p;
calc_type alpha = (calc_type(c.a) * (cover + 1)) >> 8;
if(alpha == base_mask)
{
do
{
p = (value_type*)
m_rbuf->row_ptr(x, y++, 1) + x + x + x;
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
}
while(--len);
}
else
{
do
{
p = (value_type*)
m_rbuf->row_ptr(x, y++, 1) + x + x + x;
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, cover);
}
while(--len);
}
}
}
//--------------------------------------------------------------------
void blend_solid_hspan(int x, int y,
unsigned len,
const color_type& c,
const int8u* covers)
{
if (c.a)
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y, len) + x + x + x;
do
{
calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8;
if(alpha == base_mask)
{
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
}
else
{
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers);
}
p += 3;
++covers;
}
while(--len);
}
}
//--------------------------------------------------------------------
void blend_solid_vspan(int x, int y,
unsigned len,
const color_type& c,
const int8u* covers)
{
if (c.a)
{
do
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y++, 1) + x + x + x;
calc_type alpha = (calc_type(c.a) * (calc_type(*covers) + 1)) >> 8;
if(alpha == base_mask)
{
p[order_type::R] = c.r;
p[order_type::G] = c.g;
p[order_type::B] = c.b;
}
else
{
m_blender.blend_pix(p, c.r, c.g, c.b, alpha, *covers);
}
++covers;
}
while(--len);
}
}
//--------------------------------------------------------------------
void copy_color_hspan(int x, int y,
unsigned len,
const color_type* colors)
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y, len) + x + x + x;
do
{
p[order_type::R] = colors->r;
p[order_type::G] = colors->g;
p[order_type::B] = colors->b;
++colors;
p += 3;
}
while(--len);
}
//--------------------------------------------------------------------
void copy_color_vspan(int x, int y,
unsigned len,
const color_type* colors)
{
do
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y++, 1) + x + x + x;
p[order_type::R] = colors->r;
p[order_type::G] = colors->g;
p[order_type::B] = colors->b;
++colors;
}
while(--len);
}
//--------------------------------------------------------------------
void blend_color_hspan(int x, int y,
unsigned len,
const color_type* colors,
const int8u* covers,
int8u cover)
{
value_type* p = (value_type*)
m_rbuf->row_ptr(x, y, len) + x + x + x;
if(covers)
{
do
{
copy_or_blend_pix(p, *colors++, *covers++);
p += 3;
}
while(--len);
}
else
{
if(cover == 255)
{
do
{
copy_or_blend_pix(p, *colors++);
p += 3;
}
while(--len);
}
else
{
do
{
copy_or_blend_pix(p, *colors++, cover);
p += 3;
}
while(--len);
}
}
}
//--------------------------------------------------------------------
void blend_color_vspan(int x, int y,
unsigned len,
const color_type* colors,
const int8u* covers,
int8u cover)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -