Home | History | Annotate | Download | only in animator
      1 
      2 /*
      3  * Copyright 2006 The Android Open Source Project
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 
     10 #ifndef SkPathParts_DEFINED
     11 #define SkPathParts_DEFINED
     12 
     13 #include "SkDisplayable.h"
     14 #include "SkMemberInfo.h"
     15 #include "SkPath.h"
     16 
     17 class SkDrawPath;
     18 class SkDrawMatrix;
     19 
     20 class SkPathPart : public SkDisplayable {
     21 public:
     22     SkPathPart();
     23     virtual bool add() = 0;
     24     virtual void dirty();
     25     virtual SkDisplayable* getParent() const;
     26     virtual bool setParent(SkDisplayable* parent);
     27 #ifdef SK_DEBUG
     28     virtual bool isPathPart() const { return true; }
     29 #endif
     30 protected:
     31     SkDrawPath* fPath;
     32 };
     33 
     34 class SkMoveTo : public SkPathPart {
     35     DECLARE_MEMBER_INFO(MoveTo);
     36     SkMoveTo();
     37     bool add() override;
     38 protected:
     39     SkScalar x;
     40     SkScalar y;
     41 };
     42 
     43 class SkRMoveTo : public SkMoveTo {
     44     DECLARE_MEMBER_INFO(RMoveTo);
     45     bool add() override;
     46 private:
     47     typedef SkMoveTo INHERITED;
     48 };
     49 
     50 class SkLineTo : public SkPathPart {
     51     DECLARE_MEMBER_INFO(LineTo);
     52     SkLineTo();
     53     bool add() override;
     54 protected:
     55     SkScalar x;
     56     SkScalar y;
     57 };
     58 
     59 class SkRLineTo : public SkLineTo {
     60     DECLARE_MEMBER_INFO(RLineTo);
     61     bool add() override;
     62 private:
     63     typedef SkLineTo INHERITED;
     64 };
     65 
     66 class SkQuadTo : public SkPathPart {
     67     DECLARE_MEMBER_INFO(QuadTo);
     68     SkQuadTo();
     69     bool add() override;
     70 protected:
     71     SkScalar x1;
     72     SkScalar y1;
     73     SkScalar x2;
     74     SkScalar y2;
     75 };
     76 
     77 class SkRQuadTo : public SkQuadTo {
     78     DECLARE_MEMBER_INFO(RQuadTo);
     79     bool add() override;
     80 private:
     81     typedef SkQuadTo INHERITED;
     82 };
     83 
     84 class SkCubicTo : public SkPathPart {
     85     DECLARE_MEMBER_INFO(CubicTo);
     86     SkCubicTo();
     87     bool add() override;
     88 protected:
     89     SkScalar x1;
     90     SkScalar y1;
     91     SkScalar x2;
     92     SkScalar y2;
     93     SkScalar x3;
     94     SkScalar y3;
     95 };
     96 
     97 class SkRCubicTo : public SkCubicTo {
     98     DECLARE_MEMBER_INFO(RCubicTo);
     99     bool add() override;
    100 private:
    101     typedef SkCubicTo INHERITED;
    102 };
    103 
    104 class SkClose : public SkPathPart {
    105     DECLARE_EMPTY_MEMBER_INFO(Close);
    106     bool add() override;
    107 };
    108 
    109 class SkAddGeom : public SkPathPart {
    110     DECLARE_PRIVATE_MEMBER_INFO(AddGeom);
    111     SkAddGeom();
    112 protected:
    113     int /*SkPath::Direction*/ direction;
    114 };
    115 
    116 class SkAddRect : public SkAddGeom {
    117     DECLARE_MEMBER_INFO(AddRect);
    118     SkAddRect();
    119     bool add() override;
    120 protected:
    121     SkRect fRect;
    122 private:
    123     typedef SkAddGeom INHERITED;
    124 };
    125 
    126 class SkAddOval : public SkAddRect {
    127     DECLARE_MEMBER_INFO(AddOval);
    128     bool add() override;
    129 private:
    130     typedef SkAddRect INHERITED;
    131 };
    132 
    133 class SkAddCircle : public SkAddGeom {
    134     DECLARE_MEMBER_INFO(AddCircle);
    135     SkAddCircle();
    136     bool add() override;
    137 private:
    138     SkScalar radius;
    139     SkScalar x;
    140     SkScalar y;
    141     typedef SkAddGeom INHERITED;
    142 };
    143 
    144 class SkAddRoundRect : public SkAddRect {
    145     DECLARE_MEMBER_INFO(AddRoundRect);
    146     SkAddRoundRect();
    147     bool add() override;
    148 private:
    149     SkScalar rx;
    150     SkScalar ry;
    151     typedef SkAddRect INHERITED;
    152 };
    153 
    154 class SkAddPath : public SkPathPart {
    155     DECLARE_MEMBER_INFO(AddPath);
    156     SkAddPath();
    157     bool add() override;
    158 private:
    159     typedef SkPathPart INHERITED;
    160     SkDrawMatrix* matrix;
    161     SkDrawPath* path;
    162 };
    163 
    164 #endif // SkPathParts_DEFINED
    165