michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkStroke_DEFINED michael@0: #define SkStroke_DEFINED michael@0: michael@0: #include "SkPath.h" michael@0: #include "SkPoint.h" michael@0: #include "SkPaint.h" michael@0: michael@0: /** \class SkStroke michael@0: SkStroke is the utility class that constructs paths by stroking michael@0: geometries (lines, rects, ovals, roundrects, paths). This is michael@0: invoked when a geometry or text is drawn in a canvas with the michael@0: kStroke_Mask bit set in the paint. michael@0: */ michael@0: class SkStroke { michael@0: public: michael@0: SkStroke(); michael@0: SkStroke(const SkPaint&); michael@0: SkStroke(const SkPaint&, SkScalar width); // width overrides paint.getStrokeWidth() michael@0: michael@0: SkPaint::Cap getCap() const { return (SkPaint::Cap)fCap; } michael@0: void setCap(SkPaint::Cap); michael@0: michael@0: SkPaint::Join getJoin() const { return (SkPaint::Join)fJoin; } michael@0: void setJoin(SkPaint::Join); michael@0: michael@0: void setMiterLimit(SkScalar); michael@0: void setWidth(SkScalar); michael@0: michael@0: bool getDoFill() const { return SkToBool(fDoFill); } michael@0: void setDoFill(bool doFill) { fDoFill = SkToU8(doFill); } michael@0: michael@0: /** michael@0: * Stroke the specified rect, winding it in the specified direction.. michael@0: */ michael@0: void strokeRect(const SkRect& rect, SkPath* result, michael@0: SkPath::Direction = SkPath::kCW_Direction) const; michael@0: void strokePath(const SkPath& path, SkPath*) const; michael@0: michael@0: //////////////////////////////////////////////////////////////// michael@0: michael@0: private: michael@0: SkScalar fWidth, fMiterLimit; michael@0: uint8_t fCap, fJoin; michael@0: SkBool8 fDoFill; michael@0: michael@0: friend class SkPaint; michael@0: }; michael@0: michael@0: #endif