本文整理汇总了C++中agg::rendering_buffer类的典型用法代码示例。如果您正苦于以下问题:C++ rendering_buffer类的具体用法?C++ rendering_buffer怎么用?C++ rendering_buffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rendering_buffer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:siryang,项目名称:toolkits,代码行数:16,代码来源:agg_frame.cpp
示例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;
}
开发者ID:Dushistov,项目名称:libosmscout,代码行数:21,代码来源:Tiler.cpp
示例3: attach_buffer_to_BBitmap
static void
attach_buffer_to_BBitmap(agg::rendering_buffer& buffer, BBitmap* bitmap, bool flipY)
{
uint8* bits = (uint8*)bitmap->Bits();
uint32 width = bitmap->Bounds().IntegerWidth() + 1;
uint32 height = bitmap->Bounds().IntegerHeight() + 1;
int32 bpr = bitmap->BytesPerRow();
if (flipY) {
// XXX: why don't I have to do this?!?
// bits += bpr * (height - 1);
bpr = -bpr;
}
buffer.attach(bits, width, height, bpr);
}
开发者ID:Rodeo314,项目名称:vasFMC,代码行数:14,代码来源:agg_platform_support.cpp
示例4: switch
// _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;
}
}
开发者ID:mmanley,项目名称:Antares,代码行数:37,代码来源:Painter.cpp
示例5: 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;
}
开发者ID:franko,项目名称:agg-intro,代码行数:24,代码来源:main.cpp
示例6: generate_alpha_mask
void generate_alpha_mask(int cx, int cy)
{
delete [] m_alpha_buf;
m_alpha_buf = new unsigned char[cx * cy];
g_alpha_mask_rbuf.attach(m_alpha_buf, cx, cy, cx);
typedef agg::renderer_base<agg::pixfmt_gray8> ren_base;
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
agg::pixfmt_gray8 pixf(g_alpha_mask_rbuf);
ren_base rb(pixf);
renderer r(rb);
agg::scanline_p8 sl;
rb.clear(agg::gray8(0));
agg::ellipse ell;
int i;
for(i = 0; i < 10; i++)
{
ell.init(rand() % cx,
rand() % cy,
rand() % 100 + 20,
rand() % 100 + 20,
100);
g_rasterizer.add_path(ell);
r.color(agg::gray8(rand() & 0xFF, rand() & 0xFF));
agg::render_scanlines(g_rasterizer, sl, r);
}
}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:32,代码来源:alpha_mask.cpp
示例7: runtime_error
impl(int width, int height)
: width(width), height(height)
, simperclock(0.01)
, m_fman(m_feng), m_curves(m_fman.path_adaptor()), m_contour(m_curves)
{
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
throw std::runtime_error(SDL_GetError());
screen = SDL_SetVideoMode(width, height, 0, SDL_ANYFORMAT|SDL_HWSURFACE);
if(!screen) {
SDL_Quit();
throw runtime_error(string("Unable to set screen: ") + SDL_GetError());
}
window = intrusive_ptr<SDL_Surface>(
SDL_CreateRGBSurface(SDL_SWSURFACE, screen->w, screen->h,
screen->format->BitsPerPixel,
rmask, gmask, bmask, amask)
, false);
if (!window)
SDL_Quit();
runtime_error (string("Unable to set window: ") + SDL_GetError());
rbwindow.attach((unsigned char*)window->pixels, window->w
, window->h, window->pitch);
SDL_WM_SetCaption("EOSimulator", 0);
}
开发者ID:martindafonte,项目名称:eosim-fing2014,代码行数:25,代码来源:display.cpp
示例8: rb
template<class VertexSource> void generate_alpha_mask(VertexSource& vs)
{
unsigned cx = (unsigned)width();
unsigned cy = (unsigned)height();
delete [] m_alpha_buf;
m_alpha_buf = new unsigned char[cx * cy];
m_alpha_mask_rbuf.attach(m_alpha_buf, cx, cy, cx);
typedef agg::renderer_base<agg::pixfmt_gray8> ren_base;
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
agg::pixfmt_gray8 pixf(m_alpha_mask_rbuf);
ren_base rb(pixf);
renderer ren(rb);
start_timer();
if(m_operation.cur_item() == 0)
{
rb.clear(agg::gray8(0));
ren.color(agg::gray8(255));
}
else
{
rb.clear(agg::gray8(255));
ren.color(agg::gray8(0));
}
m_ras.add_path(vs);
agg::render_scanlines(m_ras, m_sl, ren);
double t1 = elapsed_time();
char buf[100];
sprintf(buf, "Generate AlphaMask: %.3fms", t1);
draw_text(250, 20, buf);
}
开发者ID:GordonSmith,项目名称:agg,代码行数:35,代码来源:alpha_mask3.cpp
示例9: PrepareBufferMemory
void CAggMemoryDC::PrepareBufferMemory(CDC& dc)
{
CreateCompatibleDC(dc);
if(CreateAggBitmap(m_rcUpdate.Width(), m_rcUpdate.Height(), &m_buf))
{
m_oldhbmp=(HBITMAP)::SelectObject(m_hDC, m_hbmp);
#if defined(__16BIT_COLOR555__) || defined(__16BIT_COLOR565__)
int stride=((m_rcUpdate.Width()*2+3)/4)*4;
#else
int stride=((m_rcUpdate.Width()*4+3)/4)*4;
#endif
m_rbuf.attach(
(unsigned char*)m_buf,
m_rcUpdate.Width(),
m_rcUpdate.Height(),
-stride); // Use negative stride for Y-axis going down.
FillSolidRect(0,0,m_rcUpdate.Width(),m_rcUpdate.Height(),GetSysColor(COLOR_WINDOW));
}
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:23,代码来源:AggMemoryDC.cpp
示例10: generate_pattern
//------------------------------------------------------------------------
void generate_pattern()
{
unsigned size = unsigned(m_pattern_size.value());
create_star(m_pattern_size.value() / 2.0,
m_pattern_size.value() / 2.0,
m_pattern_size.value() / 2.5,
m_pattern_size.value() / 6.0,
6,
m_pattern_angle.value());
agg::conv_smooth_poly1_curve<agg::path_storage> smooth(m_ps);
agg::conv_stroke<agg::conv_smooth_poly1_curve<agg::path_storage> > stroke(smooth);
smooth.smooth_value(1.0);
smooth.approximation_scale(4.0);
stroke.width(m_pattern_size.value() / 15.0);
delete [] m_pattern;
m_pattern = new agg::int8u[size * size * pixfmt::pix_width];
m_pattern_rbuf.attach(m_pattern, size, size, size * pixfmt::pix_width);
pixfmt pixf(m_pattern_rbuf);
agg::renderer_base<pixfmt> rb(pixf);
agg::renderer_scanline_aa_solid<agg::renderer_base<pixfmt> > rs(rb);
rb.clear(agg::rgba_pre(0.4, 0.0, 0.1, m_pattern_alpha.value())); // Pattern background color
m_ras.add_path(smooth);
rs.color(agg::srgba8(110,130,50));
agg::render_scanlines(m_ras, m_sl, rs);
m_ras.add_path(stroke);
rs.color(agg::srgba8(0,50,80));
agg::render_scanlines(m_ras, m_sl, rs);
}
开发者ID:Bashakov,项目名称:agg,代码行数:37,代码来源:pattern_fill.cpp
示例11: roadmap_canvas_agg_configure
void roadmap_canvas_agg_configure (unsigned char *buf, int width, int height, int stride) {
roadmap_log( ROADMAP_ERROR, "roadmap_canvas_agg_configure, height =%d width=%d",height, width);
agg_rbuf.attach(buf, width, height, stride);
agg_renb.attach(agg_pixf);
agg_renb.reset_clipping(true);
ras.clip_box(0, 0, agg_renb.width() - 1, agg_renb.height() - 1);
agg::glyph_rendering gren = agg::glyph_ren_outline;
agg::glyph_rendering image_gren = agg::glyph_ren_agg_gray8;
roadmap_config_declare
("preferences", &RoadMapConfigFont, "font.ttf", NULL);
roadmap_config_declare
("preferences", &RoadMapConfigFontNormal, "font_normal.ttf", NULL);
char *font_file = roadmap_path_join(roadmap_path_user(),
roadmap_config_get (&RoadMapConfigFont));
if ((width) && (height))
roadmap_screen_set_screen_type( width, height );
if (!RoadMapCanvasFontLoaded) {
if(m_feng.load_font(font_file, 0, gren) &&
m_image_feng.load_font(font_file, 0, image_gren)) {
m_feng.hinting(true);
if ( roadmap_screen_is_hd_screen() )
{
m_feng.height(22);
m_feng.width(22);
}
else
{
#ifdef _WIN32
m_feng.height(12);
m_feng.width(12);
#else
m_feng.height(15);
m_feng.width(15);
#endif
}
m_feng.flip_y(true);
m_image_feng.hinting(true);
m_image_feng.flip_y(true);
RoadMapCanvasFontLoaded = 1;
} else {
RoadMapCanvasFontLoaded = -1;
char message[300];
snprintf(message, sizeof(message), "Can't load font: %s\n", font_file);
roadmap_messagebox("Error", message);
}
}
RoadMapCanvasFontLoaded = 1;
roadmap_path_free(font_file);
font_file = roadmap_path_join(roadmap_path_user(),
roadmap_config_get (&RoadMapConfigFontNormal));
if(m_feng_nor.load_font(font_file, 0, gren) &&
m_image_feng_nor.load_font(font_file, 0, image_gren)) {
m_feng_nor.hinting(true);
if ( roadmap_screen_is_hd_screen() )
{
m_feng_nor.height(22);
m_feng_nor.width(22);
}
else
{
#ifdef _WIN32
m_feng_nor.height(12);
m_feng_nor.width(12);
#else
m_feng_nor.height(15);
m_feng_nor.width(15);
#endif
}
m_feng_nor.flip_y(true);
m_image_feng_nor.hinting(true);
m_image_feng_nor.flip_y(true);
RoadMapCanvasNormalFontLoaded = 1;
}
}
开发者ID:GitPicz,项目名称:waze,代码行数:95,代码来源:roadmap_canvas.cpp
示例12: on_resize
virtual void on_resize(int sx, int sy)
{
m_gray8_buf.resize(sx * sy);
m_gray8_rbuf.attach(m_gray8_buf.data(), sx, sy, sx);
}
开发者ID:Rodeo314,项目名称:vasFMC,代码行数:5,代码来源:blend_color.cpp
注:本文中的agg::rendering_buffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论