OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2014 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 SkMatrixImageFilter_DEFINED | |
9 #define SkMatrixImageFilter_DEFINED | |
10 | |
11 #include "SkImageFilter.h" | |
12 #include "SkScalar.h" | |
13 #include "SkSize.h" | |
14 #include "SkPoint.h" | |
15 #include "SkPaint.h" | |
16 | |
17 /*! \class SkMatrixImageFilter | |
18 Matrix transformation image filter. This filter draws its source | |
19 input transformed by the given matrix. | |
20 */ | |
21 | |
22 class SK_API SkMatrixImageFilter : public SkImageFilter { | |
23 public: | |
24 /** Construct a 2D transformation image filter. | |
25 * @param transform The matrix to apply when drawing the src bitmap | |
26 * @param filterLevel The quality of filtering to apply when scaling. | |
27 * @param input The input image filter. If NULL, the src bitmap | |
28 * passed to filterImage() is used instead. | |
29 */ | |
30 | |
31 static SkMatrixImageFilter* Create(const SkMatrix& transform, | |
32 SkFilterQuality, | |
33 SkImageFilter* input = NULL); | |
34 #ifdef SK_SUPPORT_LEGACY_FILTERLEVEL_ENUM | |
35 static SkMatrixImageFilter* Create(const SkMatrix& transform, | |
36 SkPaint::FilterLevel level, | |
37 SkImageFilter* input = NULL) { | |
38 return Create(transform, SkFilterQuality(level), input); | |
39 } | |
40 #endif | |
41 virtual ~SkMatrixImageFilter(); | |
42 | |
43 void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; | |
44 | |
45 SK_TO_STRING_OVERRIDE() | |
46 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixImageFilter) | |
47 | |
48 protected: | |
49 SkMatrixImageFilter(const SkMatrix& transform, | |
50 SkFilterQuality, | |
51 SkImageFilter* input); | |
52 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | |
53 | |
54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | |
55 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; | |
56 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, | |
57 SkIRect* dst) const SK_OVERRIDE; | |
58 | |
59 private: | |
60 SkMatrix fTransform; | |
61 SkFilterQuality fFilterQuality; | |
62 typedef SkImageFilter INHERITED; | |
63 }; | |
64 | |
65 #endif | |
OLD | NEW |