gfx/skia/trunk/src/core/SkStroke.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/core/SkStroke.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     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 SkStroke_DEFINED
    1.12 +#define SkStroke_DEFINED
    1.13 +
    1.14 +#include "SkPath.h"
    1.15 +#include "SkPoint.h"
    1.16 +#include "SkPaint.h"
    1.17 +
    1.18 +/** \class SkStroke
    1.19 +    SkStroke is the utility class that constructs paths by stroking
    1.20 +    geometries (lines, rects, ovals, roundrects, paths). This is
    1.21 +    invoked when a geometry or text is drawn in a canvas with the
    1.22 +    kStroke_Mask bit set in the paint.
    1.23 +*/
    1.24 +class SkStroke {
    1.25 +public:
    1.26 +    SkStroke();
    1.27 +    SkStroke(const SkPaint&);
    1.28 +    SkStroke(const SkPaint&, SkScalar width);   // width overrides paint.getStrokeWidth()
    1.29 +
    1.30 +    SkPaint::Cap    getCap() const { return (SkPaint::Cap)fCap; }
    1.31 +    void        setCap(SkPaint::Cap);
    1.32 +
    1.33 +    SkPaint::Join   getJoin() const { return (SkPaint::Join)fJoin; }
    1.34 +    void        setJoin(SkPaint::Join);
    1.35 +
    1.36 +    void    setMiterLimit(SkScalar);
    1.37 +    void    setWidth(SkScalar);
    1.38 +
    1.39 +    bool    getDoFill() const { return SkToBool(fDoFill); }
    1.40 +    void    setDoFill(bool doFill) { fDoFill = SkToU8(doFill); }
    1.41 +
    1.42 +    /**
    1.43 +     *  Stroke the specified rect, winding it in the specified direction..
    1.44 +     */
    1.45 +    void    strokeRect(const SkRect& rect, SkPath* result,
    1.46 +                       SkPath::Direction = SkPath::kCW_Direction) const;
    1.47 +    void    strokePath(const SkPath& path, SkPath*) const;
    1.48 +
    1.49 +    ////////////////////////////////////////////////////////////////
    1.50 +
    1.51 +private:
    1.52 +    SkScalar    fWidth, fMiterLimit;
    1.53 +    uint8_t     fCap, fJoin;
    1.54 +    SkBool8     fDoFill;
    1.55 +
    1.56 +    friend class SkPaint;
    1.57 +};
    1.58 +
    1.59 +#endif

mercurial