当前位置: 首页>>代码示例>>C++>>正文


C++ cairo_copy_path函数代码示例

本文整理汇总了C++中cairo_copy_path函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_copy_path函数的具体用法?C++ cairo_copy_path怎么用?C++ cairo_copy_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cairo_copy_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cairocks_map_path_onto

cairo_bool_t cairocks_map_path_onto(cairo_t* cr, cairo_path_t* path) {
	cairo_path_t* cur_path = 0;

	parametrized_path_t param;

	if(cairo_status(cr) || !path) return FALSE;

	cur_path = cairo_copy_path(cr);

	param.path = path;
	param.parametrization = parametrize_path(path);

	cairo_new_path(cr);

	transform_path(
		cur_path,
		(transform_point_func_t)(point_on_path),
		&param
	);

	cairo_append_path(cr, cur_path);

	free(param.parametrization);

	cairo_path_destroy(cur_path);

	return TRUE;
}
开发者ID:RobertoMalatesta,项目名称:cairocks,代码行数:28,代码来源:map-path-onto.c

示例2: m_path

Path::Path(const Path& other)
    : m_path(new CairoPath())
{
    cairo_t* cr = platformPath()->context();
    OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
    cairo_append_path(cr, pathCopy.get());
}
开发者ID:bearmingo,项目名称:UI,代码行数:7,代码来源:PathCairo.cpp

示例3: cairo_copy_path

void Context::copyPath( cinder::Shape2d *resultPath )
{
	resultPath->clear();	
	cairo_path_t *path = cairo_copy_path( mCairo );
	convertCairoToCinderPath( path, resultPath );
	cairo_path_destroy( path );
}
开发者ID:Justinmaurer,项目名称:Cinder,代码行数:7,代码来源:Cairo.cpp

示例4: l_cairo_copy_path

// cairo_public cairo_path_t *
// cairo_copy_path (cairo_t *cr);
static int l_cairo_copy_path(lua_State* L)
{
    cairo_t *cr = get_cairo_t (L, 1);
    cairo_path_t *v = cairo_copy_path (cr);
    lua_pushlightuserdata(L, v);
    return 1;
}
开发者ID:umibps,项目名称:KABURAGI,代码行数:9,代码来源:lcairo-path.c

示例5: cairo_copy_path

String Path::debugString() const
{
    String string = "";
    cairo_path_t* path = cairo_copy_path(platformPath()->m_cr);
    cairo_path_data_t* data;

    if (!path->num_data )
        string = "EMPTY";

    for (int i = 0; i < path->num_data; i += path->data[i].header.length) {
        data = &path->data[i];
        switch (data->header.type) {
        case CAIRO_PATH_MOVE_TO:
            string += String::format("M %.2f,%.2f",
                                      data[1].point.x, data[1].point.y);
            break;
        case CAIRO_PATH_LINE_TO:
            string += String::format("L %.2f,%.2f",
                                      data[1].point.x, data[1].point.y);
            break;
        case CAIRO_PATH_CURVE_TO:
            string += String::format("C %.2f,%.2f,%.2f,%.2f,%.2f,%.2f",
                                      data[1].point.x, data[1].point.y,
                                      data[2].point.x, data[2].point.y,
                                      data[3].point.x, data[3].point.y);
            break;
        case CAIRO_PATH_CLOSE_PATH:
            string += "X";
            break;
        }
    }
    cairo_path_destroy(path);
    return string;
}
开发者ID:acss,项目名称:owb-mirror,代码行数:34,代码来源:PathCairo.cpp

示例6: 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

示例7: shoes_canvas_shape

VALUE
shoes_canvas_shape(int argc, VALUE *argv, VALUE self)
{
  int x;
  double x1, y1, x2, y2;
  cairo_t *shape = NULL;
  cairo_path_t *line = NULL;
  SETUP_SHAPE();

  shape = canvas->shape;
  VALUE attr = shoes_shape_attr(argc, argv, 2, s_left, s_top);
  canvas->shape = cairo_create(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1));
  cairo_move_to(canvas->shape, 0, 0);
  if (rb_block_given_p()) rb_funcall(rb_block_proc(), s_call, 0);

#if CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR <= 4
  cairo_fill_extents(canvas->shape, &x1, &y1, &x2, &y2);
#else
  cairo_path_extents(canvas->shape, &x1, &y1, &x2, &y2);
#endif
  x = x2 - x1;
  ATTRSET(attr, width, INT2NUM(x));
  x = y2 - y1;
  ATTRSET(attr, height, INT2NUM(x));
  line = cairo_copy_path(canvas->shape);
  canvas->shape = shape;
  return shoes_add_shape(self, s_shape, attr, line);
}
开发者ID:AnthonBerg,项目名称:shoes,代码行数:28,代码来源:canvas.c

示例8: m_path

Path::Path(const Path& other)
    : m_path(new CairoPath())
{
    cairo_t* cr = platformPath()->m_cr;
    cairo_path_t* p = cairo_copy_path(other.platformPath()->m_cr);
    cairo_append_path(cr, p);
    cairo_path_destroy(p);
}
开发者ID:acss,项目名称:owb-mirror,代码行数:8,代码来源:PathCairo.cpp

示例9: pycairo_copy_path

static PyObject *
pycairo_copy_path (PycairoContext *o) {
  cairo_path_t *cp;
  Py_BEGIN_ALLOW_THREADS;
  cp = cairo_copy_path (o->ctx);
  Py_END_ALLOW_THREADS;
  return PycairoPath_FromPath (cp);
}
开发者ID:Distrotech,项目名称:pycairo,代码行数:8,代码来源:context.c

示例10: cr_copy_path

/* Paths */
static VALUE
cr_copy_path (VALUE self)
{
  cairo_path_t *path;

  path = cairo_copy_path (_SELF);
  rb_cairo_check_status (path->status);
  return CRPATH2RVAL (path);
}
开发者ID:exvayn,项目名称:cairo-1.8.1-i386,代码行数:10,代码来源:rb_cairo_context.c

示例11: drawPathShadow

static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle drawingStyle)
{
    ShadowBlur& shadow = context->platformContext()->shadowBlur();
    if (shadow.type() == ShadowBlur::NoShadow)
        return;

    // Calculate the extents of the rendered solid paths.
    cairo_t* cairoContext = context->platformContext()->cr();
    OwnPtr<cairo_path_t> path = adoptPtr(cairo_copy_path(cairoContext));

    FloatRect solidFigureExtents;
    double x0 = 0;
    double x1 = 0;
    double y0 = 0;
    double y1 = 0;
    if (drawingStyle & Stroke) {
        cairo_stroke_extents(cairoContext, &x0, &y0, &x1, &y1);
        solidFigureExtents = FloatRect(x0, y0, x1 - x0, y1 - y0);
    }
    if (drawingStyle & Fill) {
        cairo_fill_extents(cairoContext, &x0, &y0, &x1, &y1);
        FloatRect fillExtents(x0, y0, x1 - x0, y1 - y0);
        solidFigureExtents.unite(fillExtents);
    }

    GraphicsContext* shadowContext = shadow.beginShadowLayer(context, solidFigureExtents);
    if (!shadowContext)
        return;

    cairo_t* cairoShadowContext = shadowContext->platformContext()->cr();

    // It's important to copy the context properties to the new shadow
    // context to preserve things such as the fill rule and stroke width.
    copyContextProperties(cairoContext, cairoShadowContext);

    if (drawingStyle & Fill) {
        cairo_save(cairoShadowContext);
        cairo_append_path(cairoShadowContext, path.get());
        shadowContext->platformContext()->prepareForFilling(context->state(), PlatformContextCairo::NoAdjustment);
        cairo_fill(cairoShadowContext);
        cairo_restore(cairoShadowContext);
    }

    if (drawingStyle & Stroke) {
        cairo_append_path(cairoShadowContext, path.get());
        shadowContext->platformContext()->prepareForStroking(context->state(), PlatformContextCairo::DoNotPreserveAlpha);
        cairo_stroke(cairoShadowContext);
    }

    // The original path may still be hanging around on the context and endShadowLayer
    // will take care of properly creating a path to draw the result shadow. We remove the path
    // temporarily and then restore it.
    // See: https://bugs.webkit.org/show_bug.cgi?id=108897
    cairo_new_path(cairoContext);
    shadow.endShadowLayer(context);
    cairo_append_path(cairoContext, path.get());
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:57,代码来源:GraphicsContextCairo.cpp

示例12: drawPathShadow

static inline void drawPathShadow(GraphicsContext* context, PathDrawingStyle drawingStyle)
{
    ShadowBlur& shadow = context->platformContext()->shadowBlur();
    if (shadow.type() == ShadowBlur::NoShadow)
        return;

    // Calculate the extents of the rendered solid paths.
    cairo_t* cairoContext = context->platformContext()->cr();
    OwnPtr<cairo_path_t> path = adoptPtr(cairo_copy_path(cairoContext));

    FloatRect solidFigureExtents;
    double x0 = 0;
    double x1 = 0;
    double y0 = 0;
    double y1 = 0;
    if (drawingStyle & Stroke) {
        cairo_stroke_extents(cairoContext, &x0, &y0, &x1, &y1);
        solidFigureExtents = FloatRect(x0, y0, x1 - x0, y1 - y0);
    }
    if (drawingStyle & Fill) {
        cairo_fill_extents(cairoContext, &x0, &y0, &x1, &y1);
        FloatRect fillExtents(x0, y0, x1 - x0, y1 - y0);
        solidFigureExtents.unite(fillExtents);
    }

    GraphicsContext* shadowContext = shadow.beginShadowLayer(context, solidFigureExtents);
    if (!shadowContext)
        return;

    cairo_t* cairoShadowContext = shadowContext->platformContext()->cr();

    // It's important to copy the context properties to the new shadow
    // context to preserve things such as the fill rule and stroke width.
    copyContextProperties(cairoContext, cairoShadowContext);

    if (drawingStyle & Fill) {
        cairo_save(cairoShadowContext);
        cairo_append_path(cairoShadowContext, path.get());
        shadowContext->platformContext()->prepareForFilling(context->state(), PlatformContextCairo::NoAdjustment);
        cairo_clip(cairoShadowContext);
        cairo_paint(cairoShadowContext);
        cairo_restore(cairoShadowContext);
    }

    if (drawingStyle & Stroke) {
        cairo_append_path(cairoShadowContext, path.get());
        shadowContext->platformContext()->prepareForStroking(context->state(), PlatformContextCairo::DoNotPreserveAlpha);
        cairo_stroke(cairoShadowContext);
    }

    shadow.endShadowLayer(context);

    // ShadowBlur::endShadowLayer destroys the current path on the Cairo context. We restore it here.
    cairo_new_path(cairoContext);
    cairo_append_path(cairoContext, path.get());
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:56,代码来源:GraphicsContextCairo.cpp

示例13: cairo_copy_path

void GraphicsContext::addPath(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);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:10,代码来源:GraphicsContextCairo.cpp

示例14: cr_copy_path

static int
cr_copy_path (lua_State *L) {
    cairo_t **obj = luaL_checkudata(L, 1, OOCAIRO_MT_NAME_CONTEXT);
    cairo_path_t **path = lua_newuserdata(L, sizeof(cairo_path_t *));
    *path = 0;
    luaL_getmetatable(L, OOCAIRO_MT_NAME_PATH);
    lua_setmetatable(L, -2);
    *path = cairo_copy_path(*obj);
    return 1;
}
开发者ID:awesomeWM,项目名称:oocairo,代码行数:10,代码来源:obj_context.c

示例15: clear

Path& Path::operator=(const Path& other)
{
    if (&other == this)
        return *this;

    clear();
    cairo_t* cr = platformPath()->context();
    OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(other.platformPath()->context()));
    cairo_append_path(cr, pathCopy.get());
    return *this;
}
开发者ID:bearmingo,项目名称:UI,代码行数:11,代码来源:PathCairo.cpp


注:本文中的cairo_copy_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。