2 * Copyright 2006 The Android Open Source Project
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkStroke_DEFINED
9 #define SkStroke_DEFINED
14 #include "SkStrokerPriv.h"
16 // set to 1 to use experimental outset stroking with quads
17 #ifndef QUAD_STROKE_APPROXIMATION
18 #define QUAD_STROKE_APPROXIMATION 0
21 #if QUAD_STROKE_APPROXIMATION && defined(SK_DEBUG)
22 extern bool gDebugStrokerErrorSet;
23 extern SkScalar gDebugStrokerError;
25 extern int gMaxRecursion[];
29 SkStroke is the utility class that constructs paths by stroking
30 geometries (lines, rects, ovals, roundrects, paths). This is
31 invoked when a geometry or text is drawn in a canvas with the
32 kStroke_Mask bit set in the paint.
37 SkStroke(const SkPaint&);
38 SkStroke(const SkPaint&, SkScalar width); // width overrides paint.getStrokeWidth()
40 SkPaint::Cap getCap() const { return (SkPaint::Cap)fCap; }
41 void setCap(SkPaint::Cap);
43 SkPaint::Join getJoin() const { return (SkPaint::Join)fJoin; }
44 void setJoin(SkPaint::Join);
46 #if QUAD_STROKE_APPROXIMATION
47 void setError(SkScalar);
49 void setMiterLimit(SkScalar);
50 void setWidth(SkScalar);
52 bool getDoFill() const { return SkToBool(fDoFill); }
53 void setDoFill(bool doFill) { fDoFill = SkToU8(doFill); }
56 * Stroke the specified rect, winding it in the specified direction..
58 void strokeRect(const SkRect& rect, SkPath* result,
59 SkPath::Direction = SkPath::kCW_Direction) const;
60 void strokePath(const SkPath& path, SkPath*) const;
62 ////////////////////////////////////////////////////////////////
65 #if QUAD_STROKE_APPROXIMATION
68 SkScalar fWidth, fMiterLimit;