本文整理汇总了C++中cairo::RefPtr::pop_group_to_source方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::pop_group_to_source方法的具体用法?C++ RefPtr::pop_group_to_source怎么用?C++ RefPtr::pop_group_to_source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::pop_group_to_source方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_render
void EmblemCellRenderer::do_render(const Cairo::RefPtr<Cairo::Context>& context, int widget, int background_area, Gdk::Rectangle &cell_area, int flags) {
context->translate(cell_area.get_x(), cell_area.get_y());
context->rectangle(0, 0, cell_area.get_width(), cell_area.get_height());
context->clip();
// TODO: Incorporate padding
context->push_group();
if (!this->_icon_name.empty()) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_icon_name, this->_icon_size);
context->set_operator(Cairo::OPERATOR_SOURCE);
// Assumes square icons; may break if we don't get the requested size
int height_offset = int((cell_area.get_height() - pixbuf->get_height())/2);
Gdk::Cairo::set_source_pixbuf(context, pixbuf, 0, height_offset);
context->rectangle(0, height_offset,
pixbuf->get_width(), pixbuf->get_height());
context->fill();
if (this->_tint_color) {
Gdk::RGBA* c = this->_tint_color;
gushort r = c->get_red();
gushort g = c->get_green();
gushort b = c->get_blue();
// Figure out the difference between our tint colour and an
// empirically determined (i.e., guessed) satisfying luma and
// adjust the base colours accordingly
double luma = (r + r + b + g + g + g) / 6.;
double extra_luma = (1.2 - luma) / 3.;
r = std::min(r + extra_luma, 1.);
g = std::min(g + extra_luma, 1.);
b = std::min(b + extra_luma, 1.);
context->set_source_rgba(r, g, b, 0.4);
context->set_operator(Cairo::OPERATOR_ATOP);
context->paint();
}
if (!this->_emblem_name.empty()) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf = this->_get_pixbuf(this->_emblem_name, this->_emblem_size);
int x_offset = this->_icon_size - this->_emblem_size;
context->set_operator(Cairo::OPERATOR_OVER);
Gdk::Cairo::set_source_pixbuf(context, pixbuf, x_offset, 0);
context->rectangle(x_offset, 0,
cell_area.get_width(), this->_emblem_size);
context->fill();
}
}
context->pop_group_to_source();
context->set_operator(Cairo::OPERATOR_OVER);
context->paint();
}