OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkMatrixConvolutionImageFilter_DEFINED | 8 #ifndef SkMatrixConvolutionImageFilter_DEFINED |
9 #define SkMatrixConvolutionImageFilter_DEFINED | 9 #define SkMatrixConvolutionImageFilter_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 #include "SkScalar.h" | 12 #include "SkScalar.h" |
13 #include "SkSize.h" | 13 #include "SkSize.h" |
14 #include "SkPoint.h" | 14 #include "SkPoint.h" |
15 | 15 |
16 /*! \class SkMatrixConvolutionImageFilter | 16 /*! \class SkMatrixConvolutionImageFilter |
17 Matrix convolution image filter. This filter applies an NxM image | 17 Matrix convolution image filter. This filter applies an NxM image |
18 processing kernel to a given input image. This can be used to produce | 18 processing kernel to a given input image. This can be used to produce |
19 effects such as sharpening, blurring, edge detection, etc. | 19 effects such as sharpening, blurring, edge detection, etc. |
20 */ | 20 */ |
21 | 21 |
22 class SK_API SkMatrixConvolutionImageFilter : public SkImageFilter { | 22 class SK_API SkMatrixConvolutionImageFilter : public SkImageFilter { |
| 23 typedef SkImageFilter INHERITED; |
| 24 |
23 public: | 25 public: |
24 /*! \enum TileMode */ | 26 /*! \enum TileMode */ |
25 enum TileMode { | 27 enum TileMode { |
26 kClamp_TileMode, /*!< Clamp to the image's edge pixels. */ | 28 kClamp_TileMode, /*!< Clamp to the image's edge pixels. */ |
27 kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */ | 29 kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */ |
28 kClampToBlack_TileMode, /*!< Fill with transparent black. */ | 30 kClampToBlack_TileMode, /*!< Fill with transparent black. */ |
29 }; | 31 }; |
30 | 32 |
31 /** Construct a matrix convolution image filter. | 33 /** Construct a matrix convolution image filter. |
32 @param kernelSize The kernel size in pixels, in each dimension (N by M)
. | 34 @param kernelSize The kernel size in pixels, in each dimension (N by M)
. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #endif | 68 #endif |
67 | 69 |
68 private: | 70 private: |
69 SkISize fKernelSize; | 71 SkISize fKernelSize; |
70 SkScalar* fKernel; | 72 SkScalar* fKernel; |
71 SkScalar fGain; | 73 SkScalar fGain; |
72 SkScalar fBias; | 74 SkScalar fBias; |
73 SkIPoint fTarget; | 75 SkIPoint fTarget; |
74 TileMode fTileMode; | 76 TileMode fTileMode; |
75 bool fConvolveAlpha; | 77 bool fConvolveAlpha; |
76 typedef SkImageFilter INHERITED; | |
77 | 78 |
78 template <class PixelFetcher, bool convolveAlpha> | 79 template <class PixelFetcher, bool convolveAlpha> |
79 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); | 80 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); |
80 template <class PixelFetcher> | 81 template <class PixelFetcher> |
81 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); | 82 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); |
82 void filterInteriorPixels(const SkBitmap& src, SkBitmap* result, const SkIRe
ct& rect); | 83 void filterInteriorPixels(const SkBitmap& src, SkBitmap* result, const SkIRe
ct& rect); |
83 void filterBorderPixels(const SkBitmap& src, SkBitmap* result, const SkIRect
& rect); | 84 void filterBorderPixels(const SkBitmap& src, SkBitmap* result, const SkIRect
& rect); |
84 }; | 85 }; |
85 | 86 |
86 #endif | 87 #endif |
OLD | NEW |