blob: ad7f767e495421b7e6c41265566f086d3520d7a9 [file] [log] [blame]
robertphillips@google.com941ee932012-06-05 12:55:05 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkStippleMaskFilter_DEFINED
9#define SkStippleMaskFilter_DEFINED
10
11#include "SkMaskFilter.h"
12
13/**
tfarina@chromium.org6806fe82012-10-12 14:41:39 +000014 * Simple MaskFilter that creates a screen door stipple pattern.
robertphillips@google.com941ee932012-06-05 12:55:05 +000015 */
tfarina@chromium.org6806fe82012-10-12 14:41:39 +000016class SK_API SkStippleMaskFilter : public SkMaskFilter {
robertphillips@google.com941ee932012-06-05 12:55:05 +000017public:
commit-bot@chromium.org7c9d0f32014-02-21 10:13:32 +000018 static SkStippleMaskFilter* Create() {
19 return SkNEW(SkStippleMaskFilter);
robertphillips@google.com0090ec72012-06-05 13:12:53 +000020 }
21
robertphillips@google.com941ee932012-06-05 12:55:05 +000022 virtual bool filterMask(SkMask* dst, const SkMask& src,
23 const SkMatrix& matrix,
reed@google.com30711b72012-12-18 19:18:39 +000024 SkIPoint* margin) const SK_OVERRIDE;
robertphillips@google.com941ee932012-06-05 12:55:05 +000025
26 // getFormat is from SkMaskFilter
reed@google.com30711b72012-12-18 19:18:39 +000027 virtual SkMask::Format getFormat() const SK_OVERRIDE {
robertphillips@google.com941ee932012-06-05 12:55:05 +000028 return SkMask::kA8_Format;
29 }
30
robertphillips@google.com0bd80fa2013-03-18 17:53:38 +000031 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
robertphillips@google.com941ee932012-06-05 12:55:05 +000032 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStippleMaskFilter);
33
34protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000035 SkStippleMaskFilter(SkReadBuffer& buffer)
robertphillips@google.com0090ec72012-06-05 13:12:53 +000036 : SkMaskFilter(buffer) {
robertphillips@google.com941ee932012-06-05 12:55:05 +000037 }
38
commit-bot@chromium.org7c9d0f32014-02-21 10:13:32 +000039#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
40public:
41#endif
42 SkStippleMaskFilter() : INHERITED() {
43 }
44
robertphillips@google.com941ee932012-06-05 12:55:05 +000045private:
46 typedef SkMaskFilter INHERITED;
47};
48
robertphillips@google.com0090ec72012-06-05 13:12:53 +000049#endif // SkStippleMaskFilter_DEFINED