gfx/skia/trunk/include/effects/Sk2DPathEffect.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/effects/Sk2DPathEffect.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,125 @@
     1.4 +/*
     1.5 + * Copyright 2006 The Android Open Source Project
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef Sk2DPathEffect_DEFINED
    1.12 +#define Sk2DPathEffect_DEFINED
    1.13 +
    1.14 +#include "SkPath.h"
    1.15 +#include "SkPathEffect.h"
    1.16 +#include "SkMatrix.h"
    1.17 +
    1.18 +class SK_API Sk2DPathEffect : public SkPathEffect {
    1.19 +public:
    1.20 +    static Sk2DPathEffect* Create(const SkMatrix& mat) {
    1.21 +        return SkNEW_ARGS(Sk2DPathEffect, (mat));
    1.22 +    }
    1.23 +
    1.24 +    virtual bool filterPath(SkPath*, const SkPath&,
    1.25 +                            SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    1.26 +
    1.27 +    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
    1.28 +
    1.29 +protected:
    1.30 +    /** New virtual, to be overridden by subclasses.
    1.31 +        This is called once from filterPath, and provides the
    1.32 +        uv parameter bounds for the path. Subsequent calls to
    1.33 +        next() will receive u and v values within these bounds,
    1.34 +        and then a call to end() will signal the end of processing.
    1.35 +    */
    1.36 +    virtual void begin(const SkIRect& uvBounds, SkPath* dst) const;
    1.37 +    virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const;
    1.38 +    virtual void end(SkPath* dst) const;
    1.39 +
    1.40 +    /** Low-level virtual called per span of locations in the u-direction.
    1.41 +        The default implementation calls next() repeatedly with each
    1.42 +        location.
    1.43 +    */
    1.44 +    virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
    1.45 +
    1.46 +    const SkMatrix& getMatrix() const { return fMatrix; }
    1.47 +
    1.48 +    // protected so that subclasses can call this during unflattening
    1.49 +    Sk2DPathEffect(SkReadBuffer&);
    1.50 +    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    1.51 +
    1.52 +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    1.53 +public:
    1.54 +#endif
    1.55 +    Sk2DPathEffect(const SkMatrix& mat);
    1.56 +
    1.57 +private:
    1.58 +    SkMatrix    fMatrix, fInverse;
    1.59 +    bool        fMatrixIsInvertible;
    1.60 +
    1.61 +    // illegal
    1.62 +    Sk2DPathEffect(const Sk2DPathEffect&);
    1.63 +    Sk2DPathEffect& operator=(const Sk2DPathEffect&);
    1.64 +
    1.65 +    friend class Sk2DPathEffectBlitter;
    1.66 +    typedef SkPathEffect INHERITED;
    1.67 +};
    1.68 +
    1.69 +class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
    1.70 +public:
    1.71 +    static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
    1.72 +        return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
    1.73 +    }
    1.74 +
    1.75 +    virtual bool filterPath(SkPath* dst, const SkPath& src,
    1.76 +                            SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    1.77 +
    1.78 +    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
    1.79 +
    1.80 +protected:
    1.81 +    virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
    1.82 +
    1.83 +    SkLine2DPathEffect(SkReadBuffer&);
    1.84 +
    1.85 +    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    1.86 +
    1.87 +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    1.88 +public:
    1.89 +#endif
    1.90 +    SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
    1.91 +    : Sk2DPathEffect(matrix), fWidth(width) {}
    1.92 +
    1.93 +private:
    1.94 +    SkScalar fWidth;
    1.95 +
    1.96 +    typedef Sk2DPathEffect INHERITED;
    1.97 +};
    1.98 +
    1.99 +class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
   1.100 +public:
   1.101 +    /**
   1.102 +     *  Stamp the specified path to fill the shape, using the matrix to define
   1.103 +     *  the latice.
   1.104 +     */
   1.105 +    static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
   1.106 +        return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
   1.107 +    }
   1.108 +
   1.109 +    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
   1.110 +
   1.111 +protected:
   1.112 +    SkPath2DPathEffect(SkReadBuffer& buffer);
   1.113 +    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
   1.114 +
   1.115 +    virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
   1.116 +
   1.117 +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
   1.118 +public:
   1.119 +#endif
   1.120 +    SkPath2DPathEffect(const SkMatrix&, const SkPath&);
   1.121 +
   1.122 +private:
   1.123 +    SkPath  fPath;
   1.124 +
   1.125 +    typedef Sk2DPathEffect INHERITED;
   1.126 +};
   1.127 +
   1.128 +#endif

mercurial