本文整理汇总了C++中agg::trans_affine::is_identity方法的典型用法代码示例。如果您正苦于以下问题:C++ trans_affine::is_identity方法的具体用法?C++ trans_affine::is_identity怎么用?C++ trans_affine::is_identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agg::trans_affine
的用法示例。
在下文中一共展示了trans_affine::is_identity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_image
void cairo_context::add_image(agg::trans_affine const& tr, image_rgba8 const& data, double opacity)
{
cairo_pattern pattern(data);
if (!tr.is_identity())
{
double m[6];
tr.store_to(m);
cairo_matrix_t cairo_matrix;
cairo_matrix_init(&cairo_matrix,m[0],m[1],m[2],m[3],m[4],m[5]);
cairo_matrix_invert(&cairo_matrix);
pattern.set_matrix(cairo_matrix);
}
cairo_save(cairo_.get());
cairo_set_source(cairo_.get(), const_cast<cairo_pattern_t*>(pattern.pattern()));
cairo_paint_with_alpha(cairo_.get(), opacity);
cairo_restore(cairo_.get());
check_object_status_and_throw_exception(*this);
}
示例2: buf
void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity, composite_mode_e comp_op)
{
if (marker.is_vector())
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
ras_ptr->reset();
box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
coord<double,2> c = bbox.center();
// center the svg marker on '0,0'
agg::trans_affine mtx = agg::trans_affine_translation(-c.x,-c.y);
// apply symbol transformation to get to map space
mtx *= tr;
mtx *= agg::trans_affine_scaling(scale_factor_*(1.0/step));
// render the marker at the center of the marker box
mtx.translate(pos.x, pos.y);
using namespace mapnik::svg;
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
svg_path_adapter svg_path(stl_storage);
svg_renderer_agg<svg_path_adapter,
agg::pod_bvector<path_attributes>,
renderer,
mapnik::pixfmt_gray32> svg_renderer(svg_path,
(*marker.get_vector_data())->attributes());
svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox);
}
else
{
image_data_32 const& data = **marker.get_bitmap_data();
double width = data.width();
double height = data.height();
double cx = 0.5 * width;
double cy = 0.5 * height;
if (step == 1 && (std::fabs(1.0 - scale_factor_) < 0.001 && tr.is_identity()))
{
// TODO - support opacity
pixmap_.set_rectangle(feature.id(), data,
boost::math::iround(pos.x - cx),
boost::math::iround(pos.y - cy));
}
else
{
// TODO - remove support for step != or add support for agg scaling with opacity
double ratio = (1.0/step);
image_data_32 target(ratio * data.width(), ratio * data.height());
mapnik::scale_image_agg<image_data_32>(target,data, SCALING_NEAR,
scale_factor_, 0.0, 0.0, 1.0, ratio);
pixmap_.set_rectangle(feature.id(), target,
boost::math::iround(pos.x - cx),
boost::math::iround(pos.y - cy));
}
}
pixmap_.add_feature(feature);
}
示例3: buf
void agg_renderer<T0,T1>::render_marker(pixel_position const& pos,
marker const& marker,
agg::trans_affine const& tr,
double opacity,
composite_mode_e comp_op)
{
using color_type = agg::rgba8;
using order_type = agg::order_rgba;
using blender_type = agg::comp_op_adaptor_rgba_pre<color_type, order_type>; // comp blender
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
using renderer_base = agg::renderer_base<pixfmt_comp_type>;
using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;
using svg_attribute_type = agg::pod_bvector<mapnik::svg::path_attributes>;
ras_ptr->reset();
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
{
ras_ptr->gamma(agg::gamma_power());
gamma_method_ = GAMMA_POWER;
gamma_ = 1.0;
}
agg::scanline_u8 sl;
agg::rendering_buffer buf(current_buffer_->raw_data(),
current_buffer_->width(),
current_buffer_->height(),
current_buffer_->width() * 4);
pixfmt_comp_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(comp_op));
renderer_base renb(pixf);
if (marker.is_vector())
{
box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
coord<double,2> c = bbox.center();
// center the svg marker on '0,0'
agg::trans_affine mtx = agg::trans_affine_translation(-c.x,-c.y);
// apply symbol transformation to get to map space
mtx *= tr;
mtx *= agg::trans_affine_scaling(common_.scale_factor_);
// render the marker at the center of the marker box
mtx.translate(pos.x, pos.y);
using namespace mapnik::svg;
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
svg_path_adapter svg_path(stl_storage);
svg_renderer_agg<svg_path_adapter,
svg_attribute_type,
renderer_type,
pixfmt_comp_type> svg_renderer(svg_path,
(*marker.get_vector_data())->attributes());
svg_renderer.render(*ras_ptr, sl, renb, mtx, opacity, bbox);
}
else
{
double width = (*marker.get_bitmap_data())->width();
double height = (*marker.get_bitmap_data())->height();
if (std::fabs(1.0 - common_.scale_factor_) < 0.001 && tr.is_identity())
{
double cx = 0.5 * width;
double cy = 0.5 * height;
composite(current_buffer_->data(), **marker.get_bitmap_data(),
comp_op, opacity,
boost::math::iround(pos.x - cx),
boost::math::iround(pos.y - cy),
false);
}
else
{
double p[8];
double x0 = pos.x - 0.5 * width;
double y0 = pos.y - 0.5 * height;
p[0] = x0; p[1] = y0;
p[2] = x0 + width; p[3] = y0;
p[4] = x0 + width; p[5] = y0 + height;
p[6] = x0; p[7] = y0 + height;
agg::trans_affine marker_tr;
marker_tr *= agg::trans_affine_translation(-pos.x,-pos.y);
marker_tr *= tr;
marker_tr *= agg::trans_affine_scaling(common_.scale_factor_);
marker_tr *= agg::trans_affine_translation(pos.x,pos.y);
marker_tr.transform(&p[0], &p[1]);
marker_tr.transform(&p[2], &p[3]);
marker_tr.transform(&p[4], &p[5]);
marker_tr.transform(&p[6], &p[7]);
ras_ptr->move_to_d(p[0],p[1]);
ras_ptr->line_to_d(p[2],p[3]);
ras_ptr->line_to_d(p[4],p[5]);
ras_ptr->line_to_d(p[6],p[7]);
agg::span_allocator<color_type> sa;
agg::image_filter_bilinear filter_kernel;
agg::image_filter_lut filter(filter_kernel, false);
image_data_32 const& src = **marker.get_bitmap_data();
//.........这里部分代码省略.........