Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_canvas_pixelcache

Plugin, ACE table, Discussion thread
Dependence: canvas plugin


Introduction
Read pixels from canvas, modify, then write back to canvas..

Usage
Sample capx

Cache all
Call "
Action:Cache all" to cache current color of pixels, then pick color by these expressions which are the same with
canvas plugin.
  • Expression:redAt
  • Expression:greenAt
  • Expression:blueAt
  • Expression:alphaAt
  • Expression:rgbaAt , which return a string
The content of this pixel cache will not been changed until call "Action:Cache all".
Cache an area
Call "
Action:Cache area" could cache at an area.  Expressions of picking color will return 0, or "black" if pixel does not been cached.
Get boundaries of cached area by these expressions
  • Expression:LeftX
  • Expression:RightX
  • Expression:TopY
  • Expression:BottomY

Compare with color picking in canvas plugin
Picking colors in canvas plugin is slowly since each picking expression will copy image data again. This behavior saves image data into an array then pick from it.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About