本文整理汇总了C++中cairo::RefPtr::paint_with_alpha方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::paint_with_alpha方法的具体用法?C++ RefPtr::paint_with_alpha怎么用?C++ RefPtr::paint_with_alpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::paint_with_alpha方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: icon
void NodeRenderer::icon(const Cairo::RefPtr<Cairo::Context>& cr, AssetCache& cache)
{
// path to icon not set
if (s->icon_image.str().size() == 0 || s->icon_width == 0.0 || s->icon_height == 0.0)
return;
cr->save();
Cairo::RefPtr<Cairo::ImageSurface> image = cache.getImage(s->icon_image.str());
double width = s->icon_width < 0 ? image->get_width() : s->icon_width;
double height = s->icon_height < 0 ? image->get_height() : s->icon_height;
double x0 = floor(location.x - width/2.0);
double y0 = floor(location.y - height/2.0);
cr->translate(x0, y0);
cr->scale(width / image->get_width(),
height / image->get_height());
cr->set_source(image, 0, 0);
if (s->icon_opacity < 1.0)
cr->paint_with_alpha(s->icon_opacity);
else
cr->paint();
cr->restore();
}
示例2: window_expose_event
bool Liveplay::window_expose_event(GdkEventExpose *event) {
Cairo::RefPtr<Cairo::Context> cr = Glib::wrap(event->window, true)->create_cairo_context();
Gtk::Allocation a = liveplay_canvas->get_allocation();
Gdk::Region region(a);
region.intersect(Glib::wrap(event->region, true));
Gdk::Cairo::add_region_to_path(cr, region);
cr->clip();
cr->set_operator(Cairo::OPERATOR_SOURCE);
cr->set_source_rgb(0,0,0);
cr->paint();
//gdk_cairo_set_source_window(cr->cobj(), liveplay_canvas->get_window()->gobj(), a.get_x(), a.get_y()); gtk 2.24
gdk_cairo_set_source_pixmap(cr->cobj(), liveplay_canvas->get_window()->gobj(), a.get_x(), a.get_y());
cr->paint_with_alpha(pow(brightness_adj->get_value(),2.2));
return false;
}
示例3: on_draw
bool GtkApplicationIconSublimer::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
if (!this->application_icon)
{
LOG4CXX_DEBUG(logger, "Got no icon..");
return false;
}
Gtk::Allocation allocation = get_allocation();
const int height = allocation.get_height();
Gdk::Cairo::set_source_pixbuf(cr, this->application_icon, 0, (height - this->application_icon->get_height()));
cr->paint_with_alpha(0.2);
return true;
}
示例4: Draw
void CardWidget::Draw(Cairo::RefPtr<Cairo::Context> cr, int x, int y)
{
bool highlight = highlightOnHover && isMouseInArea;
Cairo::RefPtr<Cairo::ImageSurface> image = PrefSlots::getImagesStorage().GetCardImage(card);
cr->save();
cr->translate(x, y);
cr->scale(1.0 * width / image->get_width(), 1.0 * height / image->get_height());
cr->rectangle(0, 0, image->get_width(), image->get_height());
cr->clip();
if( highlight ) {
cr->save();
cr->set_source_rgb(0.1, 0.8, 0.1);
cr->paint();
cr->restore();
}
cr->set_source(image, 0, 0);
cr->paint_with_alpha( highlight ? 0.7 : 1.0 );
cr->restore();
}