本文整理汇总了C++中cairo::RefPtr::get_clip_extents方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::get_clip_extents方法的具体用法?C++ RefPtr::get_clip_extents怎么用?C++ RefPtr::get_clip_extents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairo::RefPtr
的用法示例。
在下文中一共展示了RefPtr::get_clip_extents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_draw
bool RegionChooser::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) {
double clipx1, clipx2, clipy1, clipy2;
cr->get_clip_extents(clipx1, clipy1, clipx2, clipy2);
#endif
cr->save();
cr->set_line_width(1);
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
const Gdk::Color bg = get_style()->get_bg(Gtk::STATE_NORMAL);
#else
const Gdk::RGBA bg = get_style_context()->get_background_color();
#endif
Gdk::Cairo::set_source_rgba(cr, bg);
cr->paint();
if (clipy2 > h1) {
draw_keyboard(cr, clipx1, clipx2);
}
if (clipy1 < h1 && instrument) {
draw_regions(cr, clipx1, clipx2);
}
cr->restore();
return true;
}
示例2: on_draw
bool TransparentSlider::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
auto window = get_window();
Cairo::RectangleInt window_size;
Cairo::RectangleInt clip;
double x1, y1, x2, y2;
cr->get_clip_extents(x1, y1, x2, y2);
clip.height = _round(y2-y1);
clip.width = _round(x2-x1);
clip.x = _round(x1);
clip.y = _round(y1);
window_size.x = 0;
window_size.y = 0;
window_size.height = window->get_height();
window_size.width = window->get_width();
cr->save();
if (_SUPPORTS_ALPHA) {
cr->set_source_rgba( // transparent
_adjustmentRed->get_value(),
_adjustmentGreen->get_value(),
_adjustmentBlue->get_value(),
_adjustmentAlpha->get_value());
} else {
cr->set_source_rgb( // opaque
_adjustmentRed->get_value(),
_adjustmentGreen->get_value(),
_adjustmentBlue->get_value());
}
cr->set_operator(Cairo::OPERATOR_SOURCE);
if (clip.height==window_size.height && clip.width==window_size.width && clip.x==window_size.x && clip.y==window_size.y) {
} else {
window->invalidate(true);
}
cr->reset_clip();
cr->paint();
cr->restore();
return Gtk::Window::on_draw(cr);
}
示例3: copyCairoClip
static void copyCairoClip(const Cairo::RefPtr<Cairo::Context> &src, const Cairo::RefPtr<Cairo::Context> &dst) {
try {
vector<Cairo::Rectangle> rects;
src->copy_clip_rectangle_list(rects);
for (auto& rect : rects) {
//cout << "clip " << rect.x << "x" << rect.y << "+" << rect.width << "+" << rect.height << endl;
dst->rectangle(rect.x, rect.y, rect.width, rect.height);
}
dst->clip();
} catch (...) {
Cairo::Rectangle rect;
src->get_clip_extents(rect.x, rect.y, rect.width, rect.height);
rect.width -= rect.x;
rect.height -= rect.y;
//cout << "clip " << rect.x << "x" << rect.y << "+" << rect.width << "+" << rect.height << endl;
dst->rectangle(rect.x, rect.y, rect.width, rect.height);
dst->clip();
}
}