diff options
author | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-27 00:09:42 +0000 |
---|---|---|
committer | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-27 00:09:42 +0000 |
commit | ae2c20f398933a9e86c387dcc465ec0f71065ffc (patch) | |
tree | de668b1411e2ee0b4e49b6d8f8b68183134ac990 /skia/include/SkDrawLooper.h | |
parent | 09911bf300f1a419907a9412154760efd0b7abc3 (diff) | |
download | chromium_src-ae2c20f398933a9e86c387dcc465ec0f71065ffc.zip chromium_src-ae2c20f398933a9e86c387dcc465ec0f71065ffc.tar.gz chromium_src-ae2c20f398933a9e86c387dcc465ec0f71065ffc.tar.bz2 |
Add skia to the repository.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/include/SkDrawLooper.h')
-rw-r--r-- | skia/include/SkDrawLooper.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/skia/include/SkDrawLooper.h b/skia/include/SkDrawLooper.h new file mode 100644 index 0000000..80c11c3 --- /dev/null +++ b/skia/include/SkDrawLooper.h @@ -0,0 +1,41 @@ +#ifndef SkDrawLooper_DEFINED +#define SkDrawLooper_DEFINED + +#include "SkFlattenable.h" + +////////////////// EXPERIMENTAL <reed> ////////////////////////// + +class SkCanvas; +class SkPaint; + +/** \class SkDrawLooper + Subclasses of SkDrawLooper can be attached to a SkPaint. Where they are, + and something is drawn to a canvas with that paint, the looper subclass will + be called, allowing it to modify the canvas and/or paint for that draw call. + More than that, via the next() method, the looper can modify the draw to be + invoked multiple times (hence the name loop-er), allow it to perform effects + like shadows or frame/fills, that require more than one pass. +*/ +class SkDrawLooper : public SkFlattenable { +public: + /** Called right before something is being drawn to the specified canvas + with the specified paint. Subclass that want to modify either parameter + can do so now. + */ + virtual void init(SkCanvas*, SkPaint*) {} + /** Called in a loop (after init()). Each time true is returned, the object + is drawn (possibly with a modified canvas and/or paint). When false is + finally returned, drawing for the object stops. + */ + virtual bool next() { return false; } + /** Called after the looper has finally returned false from next(), allowing + the looper to restore the canvas/paint to their original states. + <reed> is this required, since the subclass knows when it is done??? + <reed> should we pass the canvas/paint here, and/or to the next call + so that subclasses don't need to retain pointers to them during the + loop? + */ + virtual void restore() {} +}; + +#endif |