Sk2DPathEffect.h revision ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976e
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef Sk2DPathEffect_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define Sk2DPathEffect_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkPathEffect.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMatrix.h" 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// This class is not exported to java. 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass Sk2DPathEffect : public SkPathEffect { 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com Sk2DPathEffect(const SkMatrix& mat); 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // overrides 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // This method is not exported to java. 236b919c353727f72342a20a7aa4ded9c022f5d816mike@reedtribe.org virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // overrides from SkFlattenable 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // This method is not exported to java. 276b919c353727f72342a20a7aa4ded9c022f5d816mike@reedtribe.org virtual void flatten(SkFlattenableWriteBuffer&); 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // This method is not exported to java. 306b919c353727f72342a20a7aa4ded9c022f5d816mike@reedtribe.org virtual Factory getFactory(); 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected: 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /** New virtual, to be overridden by subclasses. 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com This is called once from filterPath, and provides the 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uv parameter bounds for the path. Subsequent calls to 368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com next() will receive u and v values within these bounds, 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com and then a call to end() will signal the end of processing. 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void begin(const SkIRect& uvBounds, SkPath* dst); 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void next(const SkPoint& loc, int u, int v, SkPath* dst); 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void end(SkPath* dst); 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /** Low-level virtual called per span of locations in the u-direction. 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com The default implementation calls next() repeatedly with each 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com location. 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual void nextSpan(int u, int v, int ucount, SkPath* dst); 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkMatrix& getMatrix() const { return fMatrix; } 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // protected so that subclasses can call this during unflattening 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com Sk2DPathEffect(SkFlattenableReadBuffer&); 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate: 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkMatrix fMatrix, fInverse; 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // illegal 578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com Sk2DPathEffect(const Sk2DPathEffect&); 588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com Sk2DPathEffect& operator=(const Sk2DPathEffect&); 598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); 618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com friend class Sk2DPathEffectBlitter; 638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com typedef SkPathEffect INHERITED; 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 67