core-ktx / androidx.graphics

Package androidx.graphics

Types

PathSegment

data class PathSegment

A PathSegment is a line segment that represents an approximate fraction of a Path after flattening.

Extensions for External Classes

android.graphics.Bitmap

android.graphics.Canvas

android.graphics.Color

android.graphics.Matrix

android.graphics.Path

android.graphics.Picture

android.graphics.Point

android.graphics.PointF

android.graphics.PorterDuff.Mode

android.graphics.Rect

android.graphics.RectF

android.graphics.Region

android.graphics.Shader

kotlin.Int

kotlin.Long

kotlin.String

Functions

createBitmap

fun createBitmap(width: Int, height: Int, config: Config = Bitmap.Config.ARGB_8888): Bitmap

Returns a mutable bitmap with the specified width and height. A config can be optionally specified. If not, the default config is Bitmap.Config.ARGB_8888.

fun createBitmap(width: Int, height: Int, config: Config = Bitmap.Config.ARGB_8888, hasAlpha: Boolean = true, colorSpace: ColorSpace = ColorSpace.get(ColorSpace.Named.SRGB)): Bitmap

Returns a mutable bitmap with the specified width and height. The config, transparency and color space can optionally be specified. They respectively default to Bitmap.Config.ARGB_8888, true and sRGB.

rotationMatrix

fun rotationMatrix(degrees: Float, px: Float = 0.0f, py: Float = 0.0f): Matrix

Creates a rotation matrix, defined by a rotation angle in degrees around the pivot point located at the coordinates (px, py).

scaleMatrix

fun scaleMatrix(sx: Float = 1.0f, sy: Float = 1.0f): Matrix

Creates a scale matrix with the scale factor sx and sy respectively on the x and y axis.

translationMatrix

fun translationMatrix(tx: Float = 0.0f, ty: Float = 0.0f): Matrix

Creates a translation matrix with the translation amounts tx and ty respectively on the x and y axis.