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

    (PECL cairo >= 0.1.0)

    Applies scaling to a matrix

    说明

    面向对象风格(method):

    publicCairoMatrix::scale(float $sx,float $sy): void

    过程化风格:

    cairo_matrix_scale(CairoContext$context,float $sx,float $sy): void

    Applies scaling by sx, sy to the transformation in the matrix. The effect of the new transformation is to first scale the coordinates by sx and sy, then apply the original transformation to the coordinates.

    参数

    $matrix

    Procedural only - CairoMatrix instance

    $sx

    scale factor in the X direction

    $sy

    scale factor in the Y direction

    范例

    Example #1 面向对象风格

    <?php
    /* Apply scaling to a matrix */
    $matrix = new CairoMatrix(1.0, 0.5, 0.0, 1.0, 0.0, 0.0);
    $matrix->scale(0.2, 2.0);
    ?>
    

    Example #2 过程化风格

    <?php
    /* Apply scaling to a matrix */
    $matrix = cairo_matrix_init(1.0, 0.5, 0.0, 1.0, 0.0, 0.0);
    cairo_matrix_scale($matrix, 0.2, 2.0);
    ?>
    

    参见

    • CairoMatrix::initScale() Creates a new scaling matrix