scale method

[This documentation is preliminary and is subject to change.]

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

HTML Canvas 2D Context, Section 3Internet Explorer 9

Syntax

HRESULT retVal = object.scale(x, y);

Standards information

Parameters

  • x [in]
    Type: float

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

  • y [in]
    Type: float

    The vertical scaling factor.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

When you create a CanvasRenderingContext2D object, it has a transformation matrix that identifies the current state. The 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.

 

 

Build date: 1/23/2012