本文整理汇总了C++中agg::rendering_buffer::row_ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ rendering_buffer::row_ptr方法的具体用法?C++ rendering_buffer::row_ptr怎么用?C++ rendering_buffer::row_ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agg::rendering_buffer
的用法示例。
在下文中一共展示了rendering_buffer::row_ptr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_black_frame
// Draw a black frame around the rendering buffer, assuming it has
// RGB-structure, one byte per color component
//--------------------------------------------------
void draw_black_frame(agg::rendering_buffer& rbuf)
{
unsigned i;
for(i = 0; i < rbuf.height(); ++i)
{
unsigned char* p = rbuf.row_ptr(i);
*p++ = 0; *p++ = 0; *p++ = 0; *p++=0; // 3 black in header
p += (rbuf.width() - 2) * sizeof(pixfmt);
*p++ = 0; *p++ = 0; *p++ = 0; *p++=0; // 3 black in tail
}
memset(rbuf.row_ptr(0), 0, rbuf.width() * sizeof(pixfmt));
memset(rbuf.row_ptr(rbuf.height() - 1), 0, rbuf.width() * sizeof(pixfmt));
}
示例2: write_ppm
bool write_ppm(const agg::rendering_buffer& buffer,
const char* file_name)
{
FILE* fd=fopen(file_name, "wb");
if (fd) {
fprintf(fd,"P6 %d %d 255\n", buffer.width(),buffer.height());
for (size_t y=0; y<buffer.height();y++)
{
const unsigned char* row=buffer.row_ptr(y);
fwrite(row,1,buffer.width()*3,fd);
}
fclose(fd);
return true;
}
return false;
}
示例3: save_image_file
bool save_image_file (agg::rendering_buffer& rbuf, const char *fn)
{
FILE* fd = fopen(fn, "wb");
if(fd == 0) return false;
unsigned w = rbuf.width();
unsigned h = rbuf.height();
fprintf(fd, "P6\n%d %d\n255\n", w, h);
unsigned y;
agg::pod_array<unsigned char> row_buf(w * 3);
unsigned char *tmp_buf = row_buf.data();
for(y = 0; y < rbuf.height(); y++)
{
const unsigned char* src = rbuf.row_ptr(app_flip_y ? h - 1 - y : y);
agg::color_conv_row(tmp_buf, src, w, agg::color_conv_bgr24_to_rgb24());
fwrite(tmp_buf, 1, w * 3, fd);
}
fclose(fd);
return true;
}