本文整理汇总了C++中agg::rendering_buffer::height方法的典型用法代码示例。如果您正苦于以下问题:C++ rendering_buffer::height方法的具体用法?C++ rendering_buffer::height怎么用?C++ rendering_buffer::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agg::rendering_buffer
的用法示例。
在下文中一共展示了rendering_buffer::height方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例4: temp
// _DrawBitmap
void
Painter::_DrawBitmap(const agg::rendering_buffer& srcBuffer, color_space format,
BRect actualBitmapRect, BRect bitmapRect, BRect viewRect) const
{
switch (format) {
case B_RGB32:
case B_RGBA32:
_DrawBitmap32(srcBuffer, actualBitmapRect, bitmapRect, viewRect);
break;
default:
fprintf(stderr, "Painter::_DrawBitmap() - non-native colorspace: %d\n", format);
#ifdef __ANTARES__
// TODO: this is only a temporary implementation,
// to really handle other colorspaces, one would
// rather do the conversion with much less overhead,
// for example in the nn filter (hm), or in the
// scanline generator
BBitmap temp(actualBitmapRect, 0, B_RGB32);
status_t err = temp.ImportBits(srcBuffer.buf(),
srcBuffer.height() * srcBuffer.stride(),
srcBuffer.stride(),
0, format);
if (err >= B_OK) {
agg::rendering_buffer convertedBuffer;
convertedBuffer.attach((uint8*)temp.Bits(),
(uint32)actualBitmapRect.IntegerWidth() + 1,
(uint32)actualBitmapRect.IntegerHeight() + 1,
temp.BytesPerRow());
_DrawBitmap32(convertedBuffer, actualBitmapRect, bitmapRect, viewRect);
} else {
fprintf(stderr, "Painter::_DrawBitmap() - colorspace conversion failed: %s\n", strerror(err));
}
#endif // __ANTARES__
break;
}
}