Initializes the accelerated surface. IsHardwareAccelerated: This setting should be set to true to benefit from the hardware acceleration. It is ignored by Android versions prior to Honeycomb (3.0, API 11).
Gets whether the view is hardware accelerated. If the view is not hardware accelerated under Android 3 or +, check that you set IsHardwareAccelerated to true in Initialize and that you added SetApplicationAttribute(android:hardwareAccelerated, "true") to the manifest.
Fires automatically the Draw event at regular intervals (in milliseconds). This function will attempt to honor the requested interval, but the actual delay between Draw events may be different, depending on system load and capabilities.
StartRegularUpdateAndDraw (IntervalAsInt)
Fires automatically an Update event and a Draw event at regular intervals (in milliseconds). This function will attempt to honor the requested interval, but the actual delay between events may be different, depending on system load and capabilities.
StopRegularDraw
Stops the timer started with StartRegularDraw or StartRegularUpdateAndDraw.
Computes the matrix corresponding to the current transformation and copies it to the internal matrix.
CameraRestore
Restores the saved state, if any.
CameraRotateX (degAsFloat)
Applies a rotation transform around the X axis. deg: The angle of rotation around the X axis, in degrees
CameraRotateY (degAsFloat)
Applies a rotation transform around the Y axis. deg: The angle of rotation around the Y axis, in degrees
CameraRotateZ (degAsFloat)
Applies a rotation transform around the Z axis. deg: The angle of rotation around the Z axis, in degrees
CameraSave
Saves the camera state. Each Save should be balanced with a call to Restore.
CameraSetLocation (xAsFloat, yAsFloat, zAsFloat)
Sets the location of the camera. The default location is set at 0, 0, -8. x: The x location of the camera y: The y location of the camera z: The z location of the camera minSDK=12
CameraTranslate (xAsFloat, yAsFloat, zAsFloat)
Applies a translation transform on all three axis. x: The distance to translate by on the X axis y: The distance to translate by on the Y axis z: The distance to translate by on the Z axis
ClipPath (PathAsObject)
Clips the drawing area to the given path. The path may be an instance of the Path class or an instance of the AS_Path class. Warning: This does not work if the hardware acceleration is enabled.
ClipRect (RectAsRectWrapper)
Clips the drawing area to the given rectangle.
CreateLayer (LayerRectAsRectWrapper) AsInt
Redirects all subsequent drawings in a separate layer until you call TransferLayer. LayerRect: Rectangular coordinates of the layer.
Draws the specified arc, which will be scaled to fit inside the specified oval. OvalRect: The bounds of oval used to define the shape and size of the arc. StartAngle: Starting angle (in degrees) where the arc begins. SweepAngle: Sweep angle (in degrees) measured clockwise. Wedge: Whether the center of the oval closes the arc to draw a wedge. Filled: Whether the arc will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
Draws the given bitmap. SrcRect: The subset of the bitmap that will be drawn. If Null then the complete bitmap will be drawn. DestRect: The rectangle that the bitmap will be drawn into.
Draws the given bitmap through a mesh. The mesh vertices are evenly distributed across the bitmap. There are MeshWidth+1 vertices across, and MeshHeight+1 vertices down. The Verts array is accessed in row-major order, so that the first MeshWidth+1 vertices are distributed across the top of the bitmap from left to right. MeshWidth: The number of columns in the mesh. Nothing is drawn if this is 0. MeshHeight: The number of rows in the mesh. Nothing is drawn if this is 0. Verts: Array of x,y pairs, specifying where the mesh should be drawn. There must be at least (MeshWidth+1)*(MeshHeight+1)*2+VertOffset values in the array. VertOffset: Number of Verts elements to skip before drawing.
Transforms the given bitmap with the internal matrix and draws it at the specified position. Filter: Filtering affects the sampling of the bitmap when it is transformed. True = best quality.
Draws a circle. x: The x-coordinate of the center of the circle to be drawn. y: The y-coordinate of the center of the circle to be drawn. Radius: The radius of the circle to be drawn. Filled: Whether the circle will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
Draws an oval shape. Rect: The rectangle bounds of the oval to be drawn. Filled: Whether the oval will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
Draws the given path. Path: The path to be drawn. It may be an instance of the Path class or an instance of the AS_Path class. Filled: Whether the shape bounded by the path will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
DrawPoint (xAsFloat, yAsFloat, ColorAsInt)
Draws a point at the specified position and color.
Draws a rectangle. Rect: The coordinates of the rectangle to be drawn. Filled: Whether the rectangle will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
Draws a rectangle with rounded corners. Rect: The coordinates of the round-rect to be drawn. CornerRadius: The radius of the oval used to round the corners. Filled: Whether the round-rect will be filled. StrokeWidth: The stroke width. Relevant when Filled = False. Filter: Whether the edges are smoothed out.
Draws the text. Text: The text to be drawn. x,y: The origin point. Typeface: Typeface (font) to use. TextSize: Size of text. This value is automatically scaled so do not scale it yourself. Align: The alignment related to the origin. One of the ALIGN constants.
Draws the text along the specified path. Warning: This does not work under Honeycomb or ICS if the hardware acceleration is enabled. Text: The text to be drawn. x1,y1: The coordinates of the start point. x2,y2,x3,y3: The coordinates of the intermediate points. x4,y4: The coordinates of the end point. Typeface: Typeface (font) to use. TextSize: Size of text. This value is automatically scaled so do not scale it yourself. Align: The alignment related to the origin. One of the ALIGN constants.
ImportCamera (cAsandroid.graphics.Camera)
Imports a Camera from another library.
ImportMatrix (mAsandroid.graphics.Matrix)
Imports a Matrix from another library.
MatrixPostRotate (degreesAsFloat)
Postconcats the internal matrix with the specified rotation.
Sets the internal matrix to rotate by the specified sine and cosine values, with a pivot point at (px, py). The pivot point is the coordinate that should remain unchanged by the specified transformation.
Restores the canvas state saved with SaveState. Undoes the following functions called after SaveState: RotateCanvas, RotateCanvasAround, ScaleCanvas, SkewCanvas, TranslateCanvas, ClipPath, and ClipRect. The drawings stay unchanged.
RotateCanvas (DegreesAsFloat)
Rotates all subsequent drawings around the canvas center by the specified number of degrees.
Rotates all subsequent drawings around the pivot coordinates by the specified number of degrees.
SaveState
Saves the current state of the canvas. Each SaveState should be balanced with a call to RestoreState.
In this example of rotation, only the rectangle is rotated: AC.SaveState AC.RotateCanvas(45) AC.DrawRect(rctRect, Colors.Red, True, 0, True) AC.RestoreState AC.DrawOval(rctOval, Colors.Blue, True, 0, True)
Changes the transparency, hue and saturation of the given bitmap, and returns the result. The bitmap must be mutable. Alpha: From -1 to 255. -1 = no change, 0 = transparent, 255 = opaque. Hue: From 0 to 360. 0 or 360 = no change. Saturation: 0 = gray-scale, 1 = no change.
Creates a new bitmap scaled from an existing bitmap. If the specified width and height are the same as the current width and height of the source bitmap, the source bitmap is returned and no new bitmap is created. srcBmp: The source bitmap. dstWidth: The new bitmap's desired width. dstHeight: The new bitmap's desired height. filter: True if the source should be filtered.
Creates a new bitmap by removing the outer parts of another one. srcBmp: The source bitmap. x,y: Coordinates of the cropping rectangle. width,height: Size of the cropping rectangle.
Returns a Map containing the dimensions of the given image (keys = "height" and "width"). The image is not loaded in memory. This function does not work with images in the assets folder.
Returns in Pixels() a copy of the data in the bitmap. Each value is a packed int representing a Color. The stride parameter allows the caller to allow for gaps in the returned pixels array between rows. For normal packed results, just pass width for the stride value. Pixels: The array to receive the bitmap's colors offset: The first index to write into Pixels() stride: The number of entries in Pixels() to skip between rows (must be >= bitmap's width). Can be negative. x: The x coordinate of the first pixel to read from the bitmap y: The y coordinate of the first pixel to read from the bitmap width: The number of pixels to read from each row height: The number of rows to read
Loads and rescales a bitmap. dstWidth: The new bitmap's desired width or -1 to keep the original width. dstHeight: The new bitmap's desired height or -1 to keep the original height. Filter: If True, improves the sampling quality.
Adds a patheffect to the current patheffect. This only affects drawing with a style set to STROKE or FILL_AND_STROKE. Effect: One of the PATHEFFECT constants. Value: Value of the effect (for dash effects, it defines the dash size and interval). Combine: If True, the two effects are combined. Otherwise they are just superimposed.
Changes the angles of an arc object. StartAngle: Starting angle (in degrees) where the arc begins. SweepAngle: Sweep angle (in degrees) measured clockwise.
ChangeBitmap (SrcBmpAsBitmapWrapper)
Replaces the bitmap of a bitmap object.
ChangeCircleRadius (RadiusAsFloat)
Changes the radius of a circle object.
ChangePath (PathAsObject)
Changes the path of a path object.
ChangeWidthHeight (WidthAsInt, HeightAsInt)
Changes the width and height of an object (if it has such properties).
Creates an arc object. Width,Height: Size of the oval used to define the shape and size of the arc. StartAngle: Starting angle (in degrees) where the arc begins. SweepAngle: Sweep angle (in degrees) measured clockwise. Wedge: Whether the center of the oval closes the arc to draw a wedge. Filter: Whether the edges are smoothed out.
Creates a bitmap object. SrcRect: The subset of the bitmap that will be drawn. If Null then the complete bitmap will be drawn. Width,Height: Size of the rectangle that the bitmap will be drawn into. Filter: Filtering affects the sampling of bitmaps when they are rescaled. True = best quality.
Creates a line object DeltaX,DeltaY: Offsets from the starting position used to calculate the ending position. Filter: Whether the edges are smoothed out.
Creates a rectangle object with rounded corners. Width,Height: Size of the round-rect to be drawn. CornerRadiusX: The x-radius of the oval used to round the corners. CornerRadiusY: The y-radius of the oval used to round the corners. Filter: Whether the edges are smoothed out.
GetAlphaAsInt
Returns the alpha value of the object color.
GetColorAsInt
Gets the object color.
GetHeightAsInt
Gets the height of an object (if it has such a property).
GetWidthAsInt
Gets the width of an object (if it has such a property).
Adds a colorfilter that multiplies the RGB channels by one color, and then adds a second color, pinning the result for each component to [0..255]. If this function is called after SetPorterDuffColorFilter, SetPorterDuffColorFilter is ignored.
Sets a patheffect. This only affects drawing with a style set to STROKE or FILL_AND_STROKE. Effect: One of the PATHEFFECT constants. Value: Value of the effect (for dash effects, it defines the dash size and interval).
Stamps the contour of the object with the specified shape. This only applies to drawings with a style set to STROKE or FILL_AND_STROKE. Shape: An instance of the Path class or an instance of the AS_Path class. Spacing: Spacing between each stamp of shape. Style: How to transform the shape at each position as it is stamped. One of the PATHEFFECT_STYLE constants.
Adds a colorfilter that uses the specified color and Porter-Duff mode. Warning: some modes may have a different result depending on whether the hardware acceleration is enabled or not. If this function is called after SetLightingColorFilter, SetLightingColorFilter is ignored. PDMode: One of the MODE constants or Null.
Defines whether the object will be filled or stroked, or both. Style: One of the STYLE constants. StrokeWidth: The stroke width. Relevant when Style <> STYLE_FILL.
SetTexture (textureAsAS_Texture) AsAS_Object
Paints the object with the given texture. If this function is called after SetColor, SetColor is ignored.
Adds a transfer-mode in the drawing pipeline that uses the specified Porter-Duff mode. Warning: some modes may have a different result depending on whether the hardware acceleration is enabled or not. PDMode: One of the MODE constants or Null.
Appends the specified arc to the path as a new contour. An automatic LineTo is added to connect the current contour to the start of the arc. OvalRect: The bounds of oval used to define the shape and size of the arc. StartAngle: Starting angle (in degrees) where the arc begins. SweepAngle: Sweep angle (in degrees) measured clockwise.
Close
Closes the current contour. If the current point is not equal to the first point of the contour, a line segment is automatically added.
ComputeBounds (rctBoundsAsRectWrapper)
Computes the bounds of the control points of the path, and writes the answer into rctBounds.
Adds a colorfilter that multiplies the RGB channels by one color, and then adds a second color, pinning the result for each component to [0..255].
SetPath (PathAsObject) AsAS_Text
Sets the path along which the text will be drawn. Warning: Nothing will be drawn under Honeycomb or ICS if the hardware acceleration is enabled. Path: An instance of the Path class or an instance of the AS_Path class.
Defines whether the text will be filled or stroked, or both. Style: One of the STYLE constants. StrokeWidth: The stroke width. Relevant when Style <> STYLE_FILL.
SetTexture (textureAsAS_Texture) AsAS_Text
Paints the text with the given texture. If this function is called after SetColor, SetColor is ignored.
SetUnderline (EnabledAsBoolean) AsAS_Text
Enables or disables underline text. This may not work as expected depending on the OS version and the chosen style.
Creates a texture with a linear gradient. This texture can be repeated or mirrored. X0: The x-coordinate for the start of the gradient line. Y0: The y-coordinate for the start of the gradient line. X1: The x-coordinate for the end of the gradient line. Y1: The y-coordinate for the end of the gradient line. Colors: The colors to be distributed along the gradient line. There must be at least 2 colors in the array. TileMode: one of the TILEMODE constants.
Creates a texture with a radial gradient. This texture can be repeated or mirrored. X: The x-coordinate of the center of the circle. Y: The y-coordinate of the center of the circle. Radius: Must be positive. The radius of the circle for this gradient. Colors: The colors to be distributed between the center and edge of the circle. There must be at least 2 colors in the array. TileMode: one of the TILEMODE constants.
Creates a texture with a sweep gradient. X: The x-coordinate of the center. Y: The y-coordinate of the center. Colors: The colors to be distributed around the center. There must be at least 2 colors in the array.
Creates a texture with the given bitmap. This texture can be repeated or mirrored. Image: a bitmap containing the texture image. ModeX,ModeY: one of the TILEMODE constants for each axis.
Merges two textures of different types (a bitmap and a radial gradient for example). The returned texture cannot be merged with another texture. Tex1,Tex2: the textures to merge. They must be of different types. MergeMode: one of the MERGEMODE constants.