diff options
author | 2010-02-18 19:32:03 +0000 | |
---|---|---|
committer | 2010-02-18 19:32:03 +0000 | |
commit | 81dc331e65ba5a24d515c11890234dd205408c89 (patch) | |
tree | a927ccc502d9040f7f11163e47924654dd63741c /include | |
parent | 86d4008e894f6ce0b1938ac6b45d4074af85d3b7 (diff) |
update layers
git-svn-id: http://skia.googlecode.com/svn/trunk@502 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/effects/SkAvoidXfermode.h | 8 | ||||
-rw-r--r-- | include/utils/SkLayer.h | 55 |
2 files changed, 42 insertions, 21 deletions
diff --git a/include/effects/SkAvoidXfermode.h b/include/effects/SkAvoidXfermode.h index 2803c07ce1..9af4a4b58e 100644 --- a/include/effects/SkAvoidXfermode.h +++ b/include/effects/SkAvoidXfermode.h @@ -38,13 +38,13 @@ public: Avoid: In this mode, drawing is allowed only on destination pixels that are different from the op-color. - Tolerance near 0: avoid anything close to the op-color - Tolerance near 255: avoid only colors very close to the op-color + Tolerance near 0: avoid any colors even remotely similar to the op-color + Tolerance near 255: avoid only colors nearly identical to the op-color Target: In this mode, drawing only occurs on destination pixels that are similar to the op-color - Tolerance near 0: draw on colors that are very close to op-color - Tolerance near 255: draw on colors that to the op-color + Tolerance near 0: draw only on colors that are nearly identical to the op-color + Tolerance near 255: draw on any colors even remotely similar to the op-color */ SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode); diff --git a/include/utils/SkLayer.h b/include/utils/SkLayer.h index c277ddabed..36eccc7873 100644 --- a/include/utils/SkLayer.h +++ b/include/utils/SkLayer.h @@ -20,6 +20,7 @@ #include "SkRefCnt.h" #include "SkTDArray.h" #include "SkColor.h" +#include "SkMatrix.h" #include "SkPoint.h" #include "SkRect.h" #include "SkSize.h" @@ -60,16 +61,36 @@ public: SkLayer(const SkLayer&); virtual ~SkLayer(); - // setters - - void setSize(SkScalar w, SkScalar h) { m_size.set(w, h); } - void setOpacity(SkScalar opacity) { m_opacity = opacity; } + // deprecated void setTranslation(SkScalar x, SkScalar y) { m_translation.set(x, y); } void setRotation(SkScalar a) { m_angleTransform = a; m_doRotation = true; } void setScale(SkScalar x, SkScalar y) { m_scale.set(x, y); } + SkPoint position() const { return m_position; } + SkPoint translation() const { return m_translation; } + SkSize size() const { return m_size; } + SkRect bounds() const { + SkRect rect; + rect.set(m_position.fX, m_position.fY, + m_position.fX + m_size.width(), + m_position.fY + m_size.height()); + rect.offset(m_translation.fX, m_translation.fY); + return rect; + } + + const SkSize& getSize() const { return m_size; } + void setSize(SkScalar w, SkScalar h) { m_size.set(w, h); } + + SkScalar getOpacity() const { return m_opacity; } + void setOpacity(SkScalar opacity) { m_opacity = opacity; } + + const SkPoint& getPosition() const { return m_position; } void setPosition(SkScalar x, SkScalar y) { m_position.set(x, y); } + + const SkPoint& getAnchorPoint() const { return m_anchorPoint; } void setAnchorPoint(SkScalar x, SkScalar y) { m_anchorPoint.set(x, y); } + virtual void setBackgroundColor(SkColor color) { m_backgroundColor = color; m_backgroundColorSet = true; } + void setFixedPosition(SkLength left, SkLength top, SkLength right, SkLength bottom) { m_fixedLeft = left; m_fixedTop = top; @@ -78,19 +99,11 @@ public: m_isFixed = true; } - // getters + const SkMatrix& getMatrix() const { return fMatrix; } + void setMatrix(const SkMatrix&); - SkPoint position() const { return m_position; } - SkPoint translation() const { return m_translation; } - SkSize size() const { return m_size; } - SkRect bounds() const { - SkRect rect; - rect.set(m_position.fX, m_position.fY, - m_position.fX + m_size.width(), - m_position.fY + m_size.height()); - rect.offset(m_translation.fX, m_translation.fY); - return rect; - } + const SkMatrix& getChildrenMatrix() const { return fChildrenMatrix; } + void setChildrenMatrix(const SkMatrix&); // children @@ -101,7 +114,15 @@ public: // paint method - virtual void paintOn(SkPoint offset, SkSize size, SkScalar scale, SkCanvas*) = 0; + virtual void draw(SkCanvas*, SkScalar opacity, const SkRect* viewPort); + +protected: + virtual void onSetupCanvas(SkCanvas*, SkScalar opacity, const SkRect*); + virtual void onDraw(SkCanvas*, SkScalar opacity, const SkRect* viewPort); + +private: + SkMatrix fMatrix; + SkMatrix fChildrenMatrix; public: |