内容发布更新时间 : 2025/7/7 18:19:51星期一 下面是文章的全部内容请认真阅读。
x, int y, int len,
const color_type* colors, const cover_type* covers);
void copy_from(const rendering_buffer& from,
const rect* rc=0, int x_to=0, int y_to=0); 实验代码(基于此 处代码)
在on_draw()方法的renb.clear(agg::rgba8(255,255,255));语句后面加上: ? renb.clear(agg::rgba8(255,255,255));
? renb.clip_box(30,30,160,160); // 设置可写区域
得到的图形是:
从from复制一个矩形区域过来,rc指定源区域,x_to,y_to指定目标位置
PixelFormat Renderer
PixelFormat Renderer的作用是以指定的颜色空间来包装原始的Rendering Buffer(见后文),AGG把它归类于底层Renderer。
Rendering Buffer是以字节为单位的,而PixelFormat Renderer则是以像素为单位的。 头文件
#include \#include \ 类型
pixfmt_gray8 pixfmt_rgb24 pixfmt_bgr24 pixfmt_rgba32
pixfmt_bgr24_gamma ... 构造函数
pixfmt_base(rbuf_type& rb);
rb参数为Rendering Buffer类型 类型定义
像素类型
typedef color_type;
需要了解的是在AGG中像素也是一个功能完善的类,常用的有rgba、rgba8、gray8。
rgba里每个颜色分量用double表示,范围从0~1。其它像素类后面的数字代表每个颜色分量占用的位数。大部分像素类都可以从rgba构造。 同时, 像素类还有gradient等牛X的颜色计算方法。
typedef value_type; typedef order_type; 成员方法 unsigned width() unsigned height()
宽高
单个颜色分量的类型
颜色排序方式,我们可以通过里面的枚举值R G B A得到各颜色分量所在位置,常用的有order_rgb,order_bgr,order_rgba。
这是order_rgb的定义: struct order_rgb { enum rgb_e { R=0, G=1, B=2, rgb_tag }; };
color_type pixel(int x, int y);
void copy_pixel(int x, int y, const 取得、设置指定点的颜色
color_type& c);
与原颜色有混合效果,强度由covervoid blend_pixel(int x, int y, const 设置指定点颜色,
指定 color_type& c, int8u cover);
void copy_hline(int x, int y, unsigned
从x,y开始画一条长度为len的线,颜色为c,同样len, const color_type& c);
void copy_vline(int x, int y, unsigned 有blend_版本 len,