• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • CairoContext::hasCurrentPoint()

    (PECL cairo >= 0.1.0)

    The hasCurrentPoint purpose

    说明

    面向对象风格(method):

    publicCairoContext::hasCurrentPoint(void): bool

    过程化风格:

    cairo_has_current_point(CairoContext$context): bool

    Returns whether a current point is defined on the current path. See CairoContext::getCurrentPoint() for details on the current point.

    参数

    $context

    A valid CairoContext object.

    返回值

    Whether a current point is defined

    范例

    Example #1 面向对象风格

    <?php
    $s = new CairoImageSurface(CairoFormat::ARGB32, 100, 100);
    $c = new CairoContext($s);
    var_dump($c->hasCurrentPoint());
    $c->moveTo(10, 10);
    var_dump($c->hasCurrentPoint());
    ?>
    

    以上例程会输出:

    bool(false)
    bool(true)
    

    Example #2 过程化风格

    <?php
    $s = cairo_image_surface_create(CAIRO_SURFACE_TYPE_IMAGE, 100, 100);
    $c = cairo_create($s);
    var_dump(cairo_has_current_point($c));
    cairo_move_to($c, 10, 10);
    var_dump(cairo_has_current_point($c));
    ?>
    

    以上例程会输出:

    bool(false)
    bool(true)
    

    参见

    • CairoContext::getCurrentPoint() The getCurrentPoint purpose