Public Member Functions | Static Public Member Functions | List of all members
Canvas Class Reference

Inherits ScriptObject.

Public Member Functions

 Canvas (Integer _width, Integer _height)
 
Integer getWidth ()
 
Integer getHeight ()
 
 clear (Integer rgba)
 
Color getColor (Integer x, Integer y)
 
 setColor (Integer x, Integer y, Color color)
 
Integer getPixel (Integer x, Integer y)
 
 setPixel (Integer x, Integer y, Integer rgba)
 
 saveImage (String path, String mimetype)
 

Static Public Member Functions

static Canvas loadImage (String path, String mimetype)
 

Detailed Description

A 2D canvas for drawing.

Constructor & Destructor Documentation

◆ Canvas()

Canvas ( Integer  _width,
Integer  _height 
)

Creates a new canvas frame buffer.

Member Function Documentation

◆ clear()

clear ( Integer  rgba)

Clears the canvas.

◆ getColor()

Color getColor ( Integer  x,
Integer  y 
)

Returns the RGBA color of the specified pixel.

◆ getHeight()

Integer getHeight ( )

Returns the height of the canvas.

◆ getPixel()

Integer getPixel ( Integer  x,
Integer  y 
)

Returns the RGBA color of the specified pixel.

◆ getWidth()

Integer getWidth ( )

Returns the width of the canvas.

◆ loadImage()

static Canvas loadImage ( String  path,
String  mimetype 
)
static

Loads the specified picture into a new Canvas.

Parameters
pathThe path of the source file.
mimetypeThe MIME type of the image (must be "image/png").

◆ saveImage()

saveImage ( String  path,
String  mimetype 
)

Exports the canvas to the specified path.

Parameters
pathThe path of the destination file.
mimetypeThe MIME type of the image (must be "image/png").

◆ setColor()

setColor ( Integer  x,
Integer  y,
Color  color 
)

Returns the RGBA color of the specified pixel.

◆ setPixel()

setPixel ( Integer  x,
Integer  y,
Integer  rgba 
)

Sets the RGBA color of the specified pixel.



Generated by Autodesk, Inc. 19 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.