Developer   API   Graphics   ColorFilter

ColorFilter(native)

Manages drawing of color in bitmap file. This object is usually set in Paint object.

Example

var paint = new Paint(); // create color filter for grayscale images var colorFilter = ColorFilter.grayscale(); // apply color filter to the paint object paint.colorFilter = colorFilter; // load bitmap file var bitmap = Bitmap.fromFile("dat://moscrif.jpg"); // draw bitmap converted to grayscale canvas.drawBitmap(bitmap, System.width / 2 - bitmap.width / 2, System.height / 2 - bitmap.height / 2, paint);

Methods

  • grayscale() : ColorFilter
    If this filter is used, bitmap is drawn in grayscale colors.
  • lighting(mul, add) : ColorFilter
    Create 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]. The alpha components of the mul and add arguments are ignored.
API Navigation
Skip Navigation Links.
Expand <span>User Interface</span> User Interface
Expand <span>Core & System</span> Core & System
Collapse <span>Graphics</span> Graphics
Canvas
Paint
Bitmap
Typeface
Path
Matrix
Shader
ColorFilter
MaskFilter
Expand <span>Files and Databases</span> Files and Databases
Expand <span>Crypto</span> Crypto
Expand <span>Native User Interface</span> Native User Interface
Expand <span>Net</span> Net
Expand <span>Media</span> Media
Expand <span>Sensor</span> Sensor
Expand <span>Game Development</span> Game Development