Compartir a través de


scale method

Scales the current context by the specified horizontal (x) and vertical (y) factors.

 

Syntax

object.scale(x, y);

Parameters

  • x [in]
    Type: number

    The horizontal scaling factor, where 1 equals unity or 100% scale.

  • y [in]
    Type: number

    The vertical scaling factor.

Return value

This method does not return a value.

Standards information

Remarks

When you create a CanvasRenderingContext2D object, it has a transformation matrix that identifies the current state. The ICanvasRenderingContext2D::scale method modifies the transformation by multiplying the matrix by the specified factor. For example, context.scale(1,.5) halves the vertical (or y-axis) values that are used in context and leaves the horizontal (or x-axis) values the same. Similarly, context.scale(2,2) doubles the size of the graphics.