SkBlurMaskFilter.h revision 4469938e92d779dff05e745559e67907bbf21e78
18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkBlurMaskFilter_DEFINED 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkBlurMaskFilter_DEFINED 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// we include this since our callers will need to at least be able to ref/unref 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMaskFilter.h" 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkScalar.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 158c3ff17e2cab6f7c798b9f8ff4515c4a3d3fd9d1bsalomon@google.comclass SK_API SkBlurMaskFilter { 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com enum BlurStyle { 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kNormal_BlurStyle, //!< fuzzy inside and outside 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kSolid_BlurStyle, //!< solid inside, fuzzy outside 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kOuter_BlurStyle, //!< nothing inside, fuzzy outside 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kInner_BlurStyle, //!< fuzzy inside, nothing outside 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com kBlurStyleCount 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com }; 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 26038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org enum BlurFlags { 27038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org kNone_BlurFlag = 0x00, 28038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org /** The blur layer's radius is not affected by transforms */ 294868e6b221a4a98e40f977851af5fcf09631ea15senorblanco@chromium.org kIgnoreTransform_BlurFlag = 0x01, 304868e6b221a4a98e40f977851af5fcf09631ea15senorblanco@chromium.org /** Use a smother, higher qulity blur algorithm */ 314868e6b221a4a98e40f977851af5fcf09631ea15senorblanco@chromium.org kHighQuality_BlurFlag = 0x02, 32038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org /** mask for all blur flags */ 3391f489a65d436d36c7fe580af2775cd0cd13c8d2senorblanco@chromium.org kAll_BlurFlag = 0x03 34038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org }; 35038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org 364469938e92d779dff05e745559e67907bbf21e78reed@google.com SK_ATTR_DEPRECATED("use sigma version") 377ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com static SkMaskFilter* Create(SkScalar radius, BlurStyle style, 387ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com uint32_t flags = kNone_BlurFlag); 397ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /** Create a blur maskfilter. 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @param style The BlurStyle to use 427ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0. 43038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org @param flags Flags to use - defaults to none 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @return The new blur maskfilter 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 467ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com static SkMaskFilter* Create(BlurStyle style, SkScalar sigma, 47038aff623d9fd47946cd31685f74cf473f7c84f0senorblanco@chromium.org uint32_t flags = kNone_BlurFlag); 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com /** Create an emboss maskfilter 507bd141dce43ea3405bc60c9c84e6f910b851b079skia.committer@gmail.com @param blurSigma standard deviation of the Gaussian blur to apply 517ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com before applying lighting (e.g. 3) 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @param direction array of 3 scalars [x, y, z] specifying the direction of the light source 538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @param ambient 0...1 amount of ambient light 548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @param specular coefficient for specular highlights (e.g. 8) 558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @return the emboss maskfilter 568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 577ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3], 587ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com SkScalar ambient, SkScalar specular); 597ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com 604469938e92d779dff05e745559e67907bbf21e78reed@google.com SK_ATTR_DEPRECATED("use sigma version") 617ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com static SkMaskFilter* CreateEmboss(const SkScalar direction[3], 627ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com SkScalar ambient, SkScalar specular, 637ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com SkScalar blurRadius); 648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 65a2ca41e3afdd8fad5e0e924dec029f33918e0a67djsollen@google.com SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 667ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com 678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate: 688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkBlurMaskFilter(); // can't be instantiated 698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 72