本文整理汇总了C++中cairo_set_fill_rule函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_set_fill_rule函数的具体用法?C++ cairo_set_fill_rule怎么用?C++ cairo_set_fill_rule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cairo_set_fill_rule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: render
void render() {
draw_fill(ctx, rgba(0,0,0,127));
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, window->width);
cairo_surface_t * surface = cairo_image_surface_create_for_data(ctx->buffer, CAIRO_FORMAT_ARGB32, window->width, window->height, stride);
cairo_t * cr = cairo_create(surface);
cairo_set_line_width (cr, 6);
cairo_rectangle (cr, 12, 12, 232, 70);
cairo_new_sub_path (cr); cairo_arc (cr, 64, 64, 40, 0, 2*M_PI);
cairo_new_sub_path (cr); cairo_arc_negative (cr, 192, 64, 40, 0, -2*M_PI);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgb (cr, 0, 0.7, 0); cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_stroke (cr);
cairo_translate (cr, 0, 128);
cairo_rectangle (cr, 12, 12, 232, 70);
cairo_new_sub_path (cr); cairo_arc (cr, 64, 64, 40, 0, 2*M_PI);
cairo_new_sub_path (cr); cairo_arc_negative (cr, 192, 64, 40, 0, -2*M_PI);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_set_source_rgb (cr, 0, 0, 0.9); cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 0); cairo_stroke (cr);
cairo_surface_flush(surface);
cairo_destroy(cr);
cairo_surface_flush(surface);
cairo_surface_destroy(surface);
}
开发者ID:Atomication,项目名称:toaruos,代码行数:31,代码来源:cairo-demo.c
示例2: draw
/* Fill the same path twice, once with each fill rule */
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_translate (cr, 1, 1);
little_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_fill (cr);
cairo_translate (cr, LITTLE_STAR_SIZE + 1, 0);
little_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
cairo_translate (cr, -(LITTLE_STAR_SIZE + 1), LITTLE_STAR_SIZE + 1);
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
cairo_fill (cr);
cairo_translate (cr, BIG_STAR_SIZE + 1, 0);
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
return CAIRO_TEST_SUCCESS;
}
开发者ID:3oyka,项目名称:cairo2,代码行数:28,代码来源:fill-rule.c
示例3: clip_2
static void clip_2 (cairo_t *cr)
{
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
rounded_rectangle (cr, 50, 50, 100, 100, 15);
rounded_rectangle (cr, 60, 60, 80, 80, 5);
cairo_clip (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING);
}
开发者ID:AZed,项目名称:cairo,代码行数:10,代码来源:clip-mixed-antialias.c
示例4: platformPath
bool Path::contains(const FloatPoint& point, WindRule rule) const
{
if (!isfinite(point.x()) || !isfinite(point.y()))
return false;
cairo_t* cr = platformPath()->context();
cairo_fill_rule_t cur = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, rule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
bool contains = cairo_in_fill(cr, point.x(), point.y());
cairo_set_fill_rule(cr, cur);
return contains;
}
开发者ID:bearmingo,项目名称:UI,代码行数:11,代码来源:PathCairo.cpp
示例5: qDebug
void QCairoPaintEngine::drawPolygon(const QPointF *points, int pointCount, QPaintEngine::PolygonDrawMode mode)
{
if (!cr || !surface) {
qDebug()<<"Cairo Error [QCairoPaintEngine::drawPolygon]: no cairo or no surface!";
return;
}
/*if (cpen.style()==Qt::NoPen) {
qDebug()<<"Cairo Error [QCairoPaintEngine::drawPolygon]: no pen set!";
return;
}*/
if (mode!=QPaintEngine::PolylineMode && cbrush.style()==Qt::NoBrush && cpen.style()==Qt::NoPen) {
qDebug()<<"Cairo Error [QCairoPaintEngine::drawPolygon]: no pen and no brush set!";
return;
}
//updatePen();
//qDebug()<<"drawPolygon n="<<pointCount;
if (pointCount>1) {
cairo_new_path(cr);
cairo_move_to(cr, points[0].x(), points[0].y());
for (int i=1; i<pointCount; i++) {
cairo_line_to(cr, points[i].x(), points[i].y());
}
if (points[0].x()==points[pointCount-1].x() && points[0].y()==points[pointCount-1].y()){
cairo_close_path(cr);
} else if (mode!=QPaintEngine::PolylineMode) {
cairo_close_path(cr);
}
if (mode==QPaintEngine::PolylineMode) {
updatePen();
cairo_stroke(cr);
} else {
switch (mode) {
case QPaintEngine::WindingMode:
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
break;
default:
case QPaintEngine::OddEvenMode:
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
break;
}
updateBrush();
if (cpen.style()!=Qt::NoPen) {
cairo_fill_preserve(cr);
updatePen();
cairo_stroke(cr);
} else cairo_fill(cr);
}
}
}
开发者ID:jkriege2,项目名称:cairoQPaintDevice,代码行数:53,代码来源:qcairopaintengine.cpp
示例6: uiDrawClip
void uiDrawClip(uiDrawContext *c, uiDrawPath *path)
{
runPath(path, c->cr);
switch (pathFillMode(path)) {
case uiDrawFillModeWinding:
cairo_set_fill_rule(c->cr, CAIRO_FILL_RULE_WINDING);
break;
case uiDrawFillModeAlternate:
cairo_set_fill_rule(c->cr, CAIRO_FILL_RULE_EVEN_ODD);
break;
}
cairo_clip(c->cr);
}
开发者ID:08opt,项目名称:libui,代码行数:13,代码来源:draw.c
示例7: platformContext
void GraphicsContext::clip(const FloatRect& rect)
{
if (paintingDisabled())
return;
cairo_t* cr = platformContext()->cr();
cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
cairo_clip(cr);
cairo_set_fill_rule(cr, savedFillRule);
m_data->clip(rect);
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:13,代码来源:GraphicsContextCairo.cpp
示例8: cairo_copy_path
void GraphicsContext::clip(const Path& path)
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr);
cairo_append_path(cr, p);
cairo_path_destroy(p);
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING);
cairo_clip(cr);
cairo_set_fill_rule(cr, savedFillRule);
m_data->clip(path);
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:15,代码来源:GraphicsContextCairo.cpp
示例9: platformContext
void GraphicsContext::clipOut(const IntRect& r)
{
if (paintingDisabled())
return;
cairo_t* cr = platformContext()->cr();
double x1, y1, x2, y2;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
cairo_rectangle(cr, x1, y1, x2 - x1, y2 - y1);
cairo_rectangle(cr, r.x(), r.y(), r.width(), r.height());
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_clip(cr);
cairo_set_fill_rule(cr, savedFillRule);
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:15,代码来源:GraphicsContextCairo.cpp
示例10: box_outline_aa_fill
static cairo_time_t
box_outline_aa_fill (cairo_t *cr, int width, int height, int loops)
{
cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
cairo_paint (cr);
cairo_translate (cr, .5, .5);
cairo_rectangle (cr,
1.0, 1.0,
width - 2, height - 2);
cairo_rectangle (cr,
2.0, 2.0,
width - 4, height - 4);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgb (cr, 0, 1, 0); /* green */
cairo_perf_timer_start ();
cairo_perf_set_thread_aware (cr, FALSE);
while (loops--) {
if (loops == 0)
cairo_perf_set_thread_aware (cr, TRUE);
cairo_fill_preserve (cr);
}
cairo_perf_timer_stop ();
cairo_new_path (cr);
return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:31,代码来源:box-outline.c
示例11: cairo_save
void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool shouldAntialias)
{
if (paintingDisabled())
return;
if (npoints <= 1)
return;
cairo_t* cr = m_data->cr;
cairo_save(cr);
cairo_set_antialias(cr, shouldAntialias ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
cairo_move_to(cr, points[0].x(), points[0].y());
for (size_t i = 1; i < npoints; i++)
cairo_line_to(cr, points[i].x(), points[i].y());
cairo_close_path(cr);
if (fillColor().alpha()) {
setColor(cr, fillColor());
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill_preserve(cr);
}
if (strokeStyle() != NoStroke) {
setColor(cr, strokeColor());
cairo_set_line_width(cr, strokeThickness());
cairo_stroke(cr);
}
cairo_new_path(cr);
cairo_restore(cr);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:32,代码来源:GraphicsContextCairo.cpp
示例12: cairo_save
void GraphicsContext::fillPath()
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
cairo_save(cr);
cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
switch (m_common->state.fillColorSpace) {
case SolidColorSpace:
setColor(cr, fillColor());
cairo_clip(cr);
cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
break;
case PatternColorSpace: {
TransformationMatrix affine;
cairo_set_source(cr, m_common->state.fillPattern->createPlatformPattern(affine));
cairo_clip(cr);
cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
break;
}
case GradientColorSpace:
cairo_pattern_t* pattern = m_common->state.fillGradient->platformGradient();
pattern = applySpreadMethod(pattern, spreadMethod());
cairo_set_source(cr, pattern);
cairo_clip(cr);
cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
break;
}
cairo_restore(cr);
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:32,代码来源:GraphicsContextCairo.cpp
示例13: cairo_clip_extents
void GraphicsContext::clipOut(const Path& path)
{
if (paintingDisabled())
return;
cairo_t* cr = m_data->cr;
double x1, y1, x2, y2;
cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
cairo_rectangle(cr, x1, y1, x2 - x1, y2 - y1);
addPath(path);
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_clip(cr);
cairo_set_fill_rule(cr, savedFillRule);
}
开发者ID:acss,项目名称:owb-mirror,代码行数:16,代码来源:GraphicsContextCairo.cpp
示例14: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
gboolean need_fill = FALSE;
gdouble r,g,b,a;
if (input)
{
gegl_buffer_copy (input, result, output, result);
}
else
{
gegl_buffer_clear (output, result);
}
if (o->opacity > 0.0001 && o->color)
{
gegl_color_get_rgba (o->color, &r,&g,&b,&a);
a *= o->opacity;
if (a>0.001)
need_fill=TRUE;
}
if (need_fill)
{
GStaticMutex mutex = G_STATIC_MUTEX_INIT;
cairo_t *cr;
cairo_surface_t *surface;
guchar *data;
g_static_mutex_lock (&mutex);
data = (void*)gegl_buffer_linear_open (output, result, NULL, babl_format ("B'aG'aR'aA u8"));
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
result->width,
result->height,
result->width * 4);
cr = cairo_create (surface);
cairo_translate (cr, -result->x, -result->y);
if (g_str_equal (o->fill_rule, "evenodd"))
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
gegl_path_cairo_play (o->d, cr);
cairo_set_source_rgba (cr, r,g,b,a);
cairo_fill (cr);
cairo_destroy (cr);
gegl_buffer_linear_close (output, data);
g_static_mutex_unlock (&mutex);
}
return TRUE;
}
开发者ID:kleopatra999,项目名称:gegl-global-matting,代码行数:60,代码来源:vector-fill.c
示例15: begin_render
static void
begin_render(DiaRenderer *self)
{
DiaCairoInteractiveRenderer *renderer = DIA_CAIRO_INTERACTIVE_RENDERER (self);
DiaCairoRenderer *base_renderer = DIA_CAIRO_RENDERER (self);
g_return_if_fail (base_renderer->cr == NULL);
#if GTK_CHECK_VERSION(2,8,0)
base_renderer->cr = gdk_cairo_create(renderer->pixmap);
#else
base_renderer->surface = cairo_image_surface_create (
CAIRO_FORMAT_ARGB32, get_width_pixels (self), get_height_pixels (self));
base_renderer->cr = cairo_create (base_renderer->surface);
#endif
cairo_scale (base_renderer->cr, *renderer->zoom_factor, *renderer->zoom_factor);
cairo_translate (base_renderer->cr, -renderer->visible->left, -renderer->visible->top);
#ifdef HAVE_PANGOCAIRO_H
base_renderer->layout = pango_cairo_create_layout (base_renderer->cr);
#endif
cairo_set_fill_rule (base_renderer->cr, CAIRO_FILL_RULE_EVEN_ODD);
#if 0
/* should we set the background color? Or do nothing at all? */
/* if this is drawn you can see 'clipping in action', outside of the clip it gets yellow ;) */
cairo_set_source_rgba (base_renderer->cr, 1.0, 1.0, .8, 1.0);
cairo_set_operator (base_renderer->cr, CAIRO_OPERATOR_OVER);
cairo_rectangle (base_renderer->cr, 0, 0, renderer->width, renderer->height);
cairo_fill (base_renderer->cr);
#endif
}
开发者ID:krattai,项目名称:monoflow,代码行数:33,代码来源:diacairo-interactive.c
示例16: box_outline_fill
static cairo_perf_ticks_t
box_outline_fill (cairo_t *cr, int width, int height, int loops)
{
cairo_set_source_rgb (cr, 0, 0, 1); /* blue */
cairo_paint (cr);
cairo_rectangle (cr,
1.0, 1.0,
width - 2, height - 2);
cairo_rectangle (cr,
2.0, 2.0,
width - 4, height - 4);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgb (cr, 0, 1, 0); /* green */
cairo_perf_timer_start ();
while (loops--)
cairo_fill_preserve (cr);
cairo_perf_timer_stop ();
cairo_new_path (cr);
return cairo_perf_timer_elapsed ();
}
开发者ID:jaglass,项目名称:WinCairoRequirements,代码行数:26,代码来源:box-outline.c
示例17: GetTransform
void
GeometryGroup::Draw (cairo_t *cr)
{
Transform *transform = GetTransform ();
cairo_matrix_t saved;
cairo_get_matrix (cr, &saved);
if (transform) {
cairo_matrix_t matrix;
transform->GetTransform (&matrix);
cairo_transform (cr, &matrix);
}
GeometryCollection *children = GetChildren ();
Geometry *geometry;
// GeometryGroup is used for Clip (as a Geometry) so Fill (normally setting the fill rule) is never called
cairo_set_fill_rule (cr, convert_fill_rule (GetFillRule ()));
int children_count = children->GetCount ();
for (int i = 0; i < children_count; i++) {
geometry = children->GetValueAt (i)->AsGeometry ();
geometry->Draw (cr);
}
cairo_set_matrix (cr, &saved);
}
开发者ID:kangaroo,项目名称:moon,代码行数:28,代码来源:geometry.cpp
示例18: cairo_reset_clip
void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const
{
cairo_t* cr = context->platformContext();
if (m_clipData.clipData().size() < 1)
return;
cairo_reset_clip(cr);
context->beginPath();
for (unsigned int x = 0; x < m_clipData.clipData().size(); x++) {
ClipData data = m_clipData.clipData()[x];
Path path = data.path;
if (path.isEmpty())
continue;
path.closeSubpath();
if (data.bboxUnits) {
// Make use of the clipping units
AffineTransform transform;
transform.translate(boundingBox.x(), boundingBox.y());
transform.scale(boundingBox.width(), boundingBox.height());
path.transform(transform);
}
cairo_path_t* clipPath = cairo_copy_path(path.platformPath()->m_cr);
cairo_append_path(cr, clipPath);
cairo_set_fill_rule(cr, data.windRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
}
cairo_clip(cr);
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:32,代码来源:SVGResourceClipperCairo.cpp
示例19: cr_set_fill_rule
static VALUE
cr_set_fill_rule (VALUE self, VALUE rule)
{
cairo_set_fill_rule (_SELF, RVAL2CRFILLRULE (rule));
cr_check_status (_SELF);
return self;
}
开发者ID:exvayn,项目名称:cairo-1.8.1-i386,代码行数:7,代码来源:rb_cairo_context.c
示例20: NSA_GET_G2D_PTR
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule
(JNIEnv *env, jobject obj, jint rule)
{
struct graphics2d *gr = NULL;
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
if (gr->debug) printf ("cairo_set_fill_rule %d\n", rule);
g_assert (gr != NULL);
switch ((enum java_awt_geom_path_iterator_winding_rule) rule)
{
case java_awt_geom_path_iterator_WIND_NON_ZERO:
cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_WINDING);
break;
case java_awt_geom_path_iterator_WIND_EVEN_ODD:
cairo_set_fill_rule (gr->cr, CAIRO_FILL_RULE_EVEN_ODD);
break;
}
}
开发者ID:zylin,项目名称:zpugcc,代码行数:17,代码来源:gnu_java_awt_peer_gtk_GdkGraphics2D.c
注:本文中的cairo_set_fill_rule函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论