reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef SkBlurMaskFilter_DEFINED |
| 18 | #define SkBlurMaskFilter_DEFINED |
| 19 | |
| 20 | // we include this since our callers will need to at least be able to ref/unref |
| 21 | #include "SkMaskFilter.h" |
| 22 | #include "SkScalar.h" |
| 23 | |
| 24 | class SkBlurMaskFilter { |
| 25 | public: |
| 26 | enum BlurStyle { |
| 27 | kNormal_BlurStyle, //!< fuzzy inside and outside |
| 28 | kSolid_BlurStyle, //!< solid inside, fuzzy outside |
| 29 | kOuter_BlurStyle, //!< nothing inside, fuzzy outside |
| 30 | kInner_BlurStyle, //!< fuzzy inside, nothing outside |
| 31 | |
| 32 | kBlurStyleCount |
| 33 | }; |
| 34 | |
| 35 | /** Create a blur maskfilter. |
| 36 | @param radius The radius to extend the blur from the original mask. Must be > 0. |
| 37 | @param style The BlurStyle to use |
| 38 | @return The new blur maskfilter |
| 39 | */ |
| 40 | static SkMaskFilter* Create(SkScalar radius, BlurStyle style); |
| 41 | |
| 42 | /** Create an emboss maskfilter |
| 43 | @param direction array of 3 scalars [x, y, z] specifying the direction of the light source |
| 44 | @param ambient 0...1 amount of ambient light |
| 45 | @param specular coefficient for specular highlights (e.g. 8) |
| 46 | @param blurRadius amount to blur before applying lighting (e.g. 3) |
| 47 | @return the emboss maskfilter |
| 48 | */ |
| 49 | static SkMaskFilter* CreateEmboss( const SkScalar direction[3], |
| 50 | SkScalar ambient, SkScalar specular, |
| 51 | SkScalar blurRadius); |
| 52 | |
| 53 | private: |
| 54 | SkBlurMaskFilter(); // can't be instantiated |
| 55 | }; |
| 56 | |
| 57 | #endif |
| 58 | |