Home | History | Annotate | Download | only in animator
      1 /* libs/graphics/animator/SkDrawGradient.h
      2 **
      3 ** Copyright 2006, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 #ifndef SkDrawGradient_DEFINED
     19 #define SkDrawGradient_DEFINED
     20 
     21 #include "SkDrawColor.h"
     22 #include "SkDrawShader.h"
     23 #include "SkIntArray.h"
     24 
     25 class SkUnitMapper;
     26 
     27 class SkGradient : public SkDrawShader {
     28     DECLARE_PRIVATE_MEMBER_INFO(Gradient);
     29     SkGradient();
     30     virtual ~SkGradient();
     31     virtual bool add(SkAnimateMaker& , SkDisplayable* child);
     32 #ifdef SK_DUMP_ENABLED
     33     virtual void dumpRest(SkAnimateMaker*);
     34 #endif
     35     virtual void onEndElement(SkAnimateMaker& );
     36 protected:
     37     SkTDScalarArray offsets;
     38     SkString unitMapper;
     39     SkTDColorArray fColors;
     40     SkTDDrawColorArray fDrawColors;
     41     SkUnitMapper* fUnitMapper;
     42     int addPrelude();
     43 private:
     44     typedef SkDrawShader INHERITED;
     45 };
     46 
     47 class SkLinearGradient : public SkGradient {
     48     DECLARE_MEMBER_INFO(LinearGradient);
     49     SkLinearGradient();
     50     virtual void onEndElement(SkAnimateMaker& );
     51 #ifdef SK_DUMP_ENABLED
     52     virtual void dump(SkAnimateMaker*);
     53 #endif
     54     virtual SkShader* getShader();
     55 protected:
     56     SkTDScalarArray points;
     57 private:
     58     typedef SkGradient INHERITED;
     59 };
     60 
     61 class SkRadialGradient : public SkGradient {
     62     DECLARE_MEMBER_INFO(RadialGradient);
     63     SkRadialGradient();
     64 #ifdef SK_DUMP_ENABLED
     65     virtual void dump(SkAnimateMaker*);
     66 #endif
     67     virtual SkShader* getShader();
     68 protected:
     69     SkPoint center;
     70     SkScalar radius;
     71 private:
     72     typedef SkGradient INHERITED;
     73 };
     74 
     75 #endif // SkDrawGradient_DEFINED
     76 
     77