aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkDrawing.h
blob: 793534759a1f17ce9150ca1ff4eee152f7d6e1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef SkDrawable_DEFINED
#define SkDrawable_DEFINED

#include "SkFlattenable.h"
#include "SkMatrix.h"

class SkCanvas;
struct SkRect;

class SkDrawable : public SkFlattenable {
public:
            SkDrawable();
    virtual ~SkDrawable();

    void getMatrix(SkMatrix*) const;
    void setMatrix(const SkMatrix&);
    void resetMatrix();
        
    void draw(SkCanvas*);
    
    void inval() {}

    SkDrawable* attachChildToFront(SkDrawable* child);
    SkDrawable* attachChildToBack(SkDrawable* child);

    SkDrawable* getParent() const { return fParent; }
    void detachFromParent();
    void detachAllChildren();

    class B2FIter {
    public:
        B2FIter(const SkDrawable* parent);
        SkDrawable* next();
    private:
        SkDrawable* fFirstChild;
        SkDrawable* fChild;
    };
    
protected:
    virtual void onDraw(SkCanvas*) {}
    
private:
    SkMatrix    fMatrix;

    SkDrawable* fParent;
    SkDrawable* fFirstChild;
    SkDrawable* fNextSibling;
    SkDrawable* fPrevSibling;

    typedef SkFlattenable INHERITED;
};

#endif