canvas

Contains functions for working with graphics on Android

Constants

VertexMode : map = {TRIANGLES=0, TRIANGLE_STRIP=1, TRIANGLE_FAN=2}

Action : map =

{
  DOWN=0,
  UP=1,
  MOVE=2,
  MULTIPLE=2,
  CANCEL=3,
  OUTSIDE=4,
  POINTER_DOWN=5,
  POINTER_UP=6,
  POINTER_INDEX_SHIFT=8,
  MASK=255,
  POINTER_INDEX_MASK=65280
}

BitmapCompressFormat : map = {JPEG=0, PNG=1, WEBP=2}

EdgeType : map = {BW=0, AA=1}

Cap : map = {BUTT=0, ROUND=1, SQUARE=2}

Style : map = {FILL=0, STROKE=1, FILL_AND_STROKE=2}

BitmapConfig : map = {ALPHA_8=0, RGB_565=1, ARGB_4444=2, ARGB_8888=3}

Join : map = {MITER=0, ROUND=1, BEVEL=2}

Align : map = {LEFT=0, CENTER=1, RIGHT=2}

Functions

createBitmap(...) - createBitmap(bitmap) - creates a copy of the bitmap.

createBitmap(bytes) - creates bitmap from byte array.

createBitmap(w, h) - creates new bitmap with the given size.

createBitmap(w, h, config) - creates new bitmap with the given size and config.

createBitmap(bytes, offset, length) - creates bitmap from byte array starting from offset.

createBitmap(pixels, w, h, config) - creates new bitmap from pixels array.

createBitmap(bitmap, x, y, w, h) - creates new bitmap from the part of the bitmap.

createBitmap(pixels, offset, stride, w, h, config) - creates new bitmap from pixels array starting from offset.

Returns BitmapValue.

Example

use "http"
use "canvas"
g = showcanvas()
imageBytes = download("http://lorempixel.com/image_output/nature-q-c-640-480-10.jpg")
bitmap = createBitmap(imageBytes)
g.drawBitmap(bitmap, 0, 0)

createScaledBitmap(srcBitmap, width, height, filter) - scales bitmap to size and returns new BitmapValue

getScreenBitmap() - returns current screen as bitmap

hidecanvas() - closes canvas screen and releases resources

repaint()

setOnKeyDownEvent()

setOnKeyUpEvent()

setOnLongPressEvent()

setOnTouchEvent()

showcanvas() - shows canvas screen and returns GraphicsValue

Example


use "canvas"

g = showcanvas()

Types


BitmapValue

Functions

compress()

copy()

eraseColor()

extractAlpha()

getAllocationByteCount()

getByteCount()

getDensity()

getGraphics()

getWidth()

getHeight()

getRowBytes()

getPixel()

getPixels()

getScaledWidth()

getScaledHeight()

hasAlpha()

hasMipMap()

isMutable()

isPremultiplied()

isRecycled()

prepareToDraw()

recycle()

setPixel()

setPixels()


GraphicsValue

Functions

ascent()

breakText()

clearShadowLayer()

clipRect()

descent()

drawARGB()

drawArc()

drawBitmap()

drawCircle()

drawColor()

drawLine()

drawOval()

drawPoint()

drawRGB()

drawRect()

drawRoundRect()

drawText()

fillCircle()

fillOval()

fillRect()

fillRoundRect()

getAlpha()

getClipBounds()

getColor()

getDensity()

getFlags()

getFontSpacing()

getHeight()

getSaveCount()

getStrokeCap()

getStrokeJoin()

getStrokeMiter()

getStrokeWidth()

getStyle()

getTextAlign()

getTextBounds()

getTextScaleX()

getTextSize()

getTextSkewX()

getTextWidths()

getTypeface()

getWidth()

isAntiAlias()

isDither()

isFakeBoldText()

isFilterBitmap()

isLinearText()

isOpaque()

isStrikeThruText()

isSubpixelText()

isUnderlineText()

measureText()

quickReject()

reset()

restore()

restoreToCount()

rotate()

save()

saveLayer()

saveLayerAlpha()

scale()

setAlpha()

setAntiAlias()

setBitmap()

setColor()

setDensity()

setDither()

setFakeBoldText()

setFilterBitmap()

setFlags()

setLinearText()

setShadowLayer()

setStrikeThruText()

setStrokeCap()

setStrokeJoin()

setStrokeMiter()

setStrokeWidth()

setStyle()

setSubpixelText()

setTextAlign()

setTextScaleX()

setTextSize()

setTextSkewX()

setTypeface()

setUnderlineText()

skew()

strokeCircle()

strokeOval()

strokeRect()

strokeRoundRect()

translate()

results matching ""

    No results matching ""