diff options
author | olpc <olpc@xo-05-26-CC.localdomain> | 2008-12-08 18:10:06 (GMT) |
---|---|---|
committer | olpc <olpc@xo-05-26-CC.localdomain> | 2008-12-08 18:10:06 (GMT) |
commit | 19febbb9de90eaf89f426fb7bfcca21ae4b96cf1 (patch) | |
tree | 9b58c92e5bcf242bfc8777770203353bc1b37aab /src/canvas.h | |
parent | b55f97cfbee59f37fbf37e341c88e5d9f2caa60d (diff) |
Canvas optimizations.
Diffstat (limited to 'src/canvas.h')
-rw-r--r-- | src/canvas.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/canvas.h b/src/canvas.h index 4ed288c..bbed722 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -547,7 +547,7 @@ public: brush.type = BrushType::BRUSHTYPE_HARD; brush.color = Color::create_from_a8r8g8b8(0xff000000 | (255 << (c0 * 8) | ((rand()%255) << (c1 * 8)))); brush.size = width/16; - brush.control = 0; //Brush::BRUSHCONTROL_VARIABLEOPACITY; + brush.control = Brush::BRUSHCONTROL_VARIABLESIZE; brush.opacity = 1.0f; } @@ -846,6 +846,14 @@ public: } } + // Return the color underneath the pos. + Color pickup_color(const Pos& pos) + { + int x = int(max(min(pos.x, float(width)), 0.0f)); + int y = int(max(min(pos.y, float(height)), 0.0f)); + return Color::create_from_a8r8g8b8(image[y*width+x]); + } + //--------------------------------------------------------------------------------------------- // Playback // |