本文整理汇总了C++中DrawingContext::setOperator方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::setOperator方法的具体用法?C++ DrawingContext::setOperator怎么用?C++ DrawingContext::setOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawingContext
的用法示例。
在下文中一共展示了DrawingContext::setOperator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Drawing::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags)
{
if (_root) {
_root->render(ct, area, flags);
}
if (colorMode() == COLORMODE_GRAYSCALE) {
// apply grayscale filter on top of everything
cairo_surface_t *input = ct.rawTarget();
cairo_surface_t *out = ink_cairo_surface_create_identical(input);
ink_cairo_surface_filter(input, out, _grayscale_colormatrix);
Geom::Point origin = ct.targetLogicalBounds().min();
ct.setSource(out, origin[Geom::X], origin[Geom::Y]);
ct.setOperator(CAIRO_OPERATOR_SOURCE);
ct.paint();
ct.setOperator(CAIRO_OPERATOR_OVER);
cairo_surface_destroy(out);
}
}
示例2: set_cairo_blend_operator
void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) {
// All of the blend modes are implemented in Cairo as of 1.10.
// For a detailed description, see:
// http://cairographics.org/operators/
switch (blend_mode) {
case SP_CSS_BLEND_MULTIPLY:
dc.setOperator(CAIRO_OPERATOR_MULTIPLY);
break;
case SP_CSS_BLEND_SCREEN:
dc.setOperator(CAIRO_OPERATOR_SCREEN);
break;
case SP_CSS_BLEND_DARKEN:
dc.setOperator(CAIRO_OPERATOR_DARKEN);
break;
case SP_CSS_BLEND_LIGHTEN:
dc.setOperator(CAIRO_OPERATOR_LIGHTEN);
break;
case SP_CSS_BLEND_OVERLAY:
dc.setOperator(CAIRO_OPERATOR_OVERLAY);
break;
case SP_CSS_BLEND_COLORDODGE:
dc.setOperator(CAIRO_OPERATOR_COLOR_DODGE);
break;
case SP_CSS_BLEND_COLORBURN:
dc.setOperator(CAIRO_OPERATOR_COLOR_BURN);
break;
case SP_CSS_BLEND_HARDLIGHT:
dc.setOperator(CAIRO_OPERATOR_HARD_LIGHT);
break;
case SP_CSS_BLEND_SOFTLIGHT:
dc.setOperator(CAIRO_OPERATOR_SOFT_LIGHT);
break;
case SP_CSS_BLEND_DIFFERENCE:
dc.setOperator(CAIRO_OPERATOR_DIFFERENCE);
break;
case SP_CSS_BLEND_EXCLUSION:
dc.setOperator(CAIRO_OPERATOR_EXCLUSION);
break;
case SP_CSS_BLEND_HUE:
dc.setOperator(CAIRO_OPERATOR_HSL_HUE);
break;
case SP_CSS_BLEND_SATURATION:
dc.setOperator(CAIRO_OPERATOR_HSL_SATURATION);
break;
case SP_CSS_BLEND_COLOR:
dc.setOperator(CAIRO_OPERATOR_HSL_COLOR);
break;
case SP_CSS_BLEND_LUMINOSITY:
dc.setOperator(CAIRO_OPERATOR_HSL_LUMINOSITY);
break;
case SP_CSS_BLEND_NORMAL:
default:
dc.setOperator(CAIRO_OPERATOR_OVER);
break;
}
}