Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkColorFilterImageFilter.h
1 /*
2  * Copyright 2012 The Android Open Source Project
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 SkColorFilterImageFilter_DEFINED
9 #define SkColorFilterImageFilter_DEFINED
10 
11 #include "SkImageFilter.h"
12 
13 class SkColorFilter;
14 
15 class SK_API SkColorFilterImageFilter : public SkImageFilter {
16 public:
19  const CropRect* cropRect = NULL);
20 
21  SK_TO_STRING_OVERRIDE()
22  SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
23 
24 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
25  static SkImageFilter* Create(SkColorFilter* cf,
26  SkImageFilter* input = NULL,
27  const CropRect* cropRect = NULL) {
28  return Make(sk_ref_sp<SkColorFilter>(cf),
29  sk_ref_sp<SkImageFilter>(input),
30  cropRect).release();
31  }
32 #endif
33 
34 protected:
35  void flatten(SkWriteBuffer&) const override;
36  sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
37  SkIPoint* offset) const override;
38  bool onIsColorFilterNode(SkColorFilter**) const override;
39  bool onCanHandleComplexCTM() const override { return true; }
40  bool affectsTransparentBlack() const override;
41 
42 private:
45  const CropRect* cropRect);
46 
47  sk_sp<SkColorFilter> fColorFilter;
48 
49  typedef SkImageFilter INHERITED;
50 };
51 
52 #endif
T *SK_WARN_UNUSED_RESULT release()
Return the bare pointer, and set the internal object pointer to nullptr.
Definition: SkRefCnt.h:363
Definition: SkImageFilter.h:55
ColorFilters are optional objects in the drawing pipeline.
Definition: SkColorFilter.h:29
void flatten(SkWriteBuffer &) const override
Override this if your subclass needs to record data that it will need to recreate itself from its Cre...
virtual sk_sp< SkSpecialImage > onFilterImage(SkSpecialImage *src, const Context &, SkIPoint *offset) const =0
This is the virtual which should be overridden by the derived class to perform image filtering...
Definition: SkColorFilterImageFilter.h:15
virtual bool onIsColorFilterNode(SkColorFilter **) const
Return true (and return a ref'd colorfilter) if this node in the DAG is just a colorfilter w/o CropRe...
Definition: SkImageFilter.h:343
Base class for image filters.
Definition: SkImageFilter.h:35
bool onCanHandleComplexCTM() const override
Override this to describe the behavior of your subclass - as a leaf node.
Definition: SkColorFilterImageFilter.h:39
Definition: SkWriteBuffer.h:26
Definition: SkImageFilter.h:37
SkIPoint holds two 32 bit integer coordinates.
Definition: SkPoint.h:40