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 SkEmbossMaskFilter_DEFINED 98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkEmbossMaskFilter_DEFINED 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkMaskFilter.h" 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/** \class SkEmbossMaskFilter 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com This mask filter creates a 3D emboss look, by specifying a light and blur amount. 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/ 176806fe87e0b39e283291c1a1c7d1d864230aa2aatfarina@chromium.orgclass SK_API SkEmbossMaskFilter : public SkMaskFilter { 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com struct Light { 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkScalar fDirection[3]; // x,y,z 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint16_t fPad; 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint8_t fAmbient; 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com uint8_t fSpecular; // exponent, 4.4 right now 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com }; 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 26daaafa6e81860e3dc52660ba019c336f0a43f1e7reed@google.com static SkEmbossMaskFilter* Create(SkScalar blurSigma, const Light& light); 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // overrides from SkMaskFilter 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // This method is not exported to java. 3030711b764be6bbb58caa30a0ac5d1474c894efe7reed@google.com virtual SkMask::Format getFormat() const SK_OVERRIDE; 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // This method is not exported to java. 326b919c353727f72342a20a7aa4ded9c022f5d816mike@reedtribe.org virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&, 3330711b764be6bbb58caa30a0ac5d1474c894efe7reed@google.com SkIPoint* margin) const SK_OVERRIDE; 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 350f10f7bf1fb43ca6346dc220a076773b1f19a367commit-bot@chromium.org SK_TO_STRING_OVERRIDE() 36ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter) 37ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected: 397c9d0f3104408a64d52b84643f116179022d73bdcommit-bot@chromium.org SkEmbossMaskFilter(SkScalar blurSigma, const Light& light); 409fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 41bd0be25074e53a6d1abc284562568c9745191984commit-bot@chromium.org explicit SkEmbossMaskFilter(SkReadBuffer&); 429fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif 43bd0be25074e53a6d1abc284562568c9745191984commit-bot@chromium.org virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 447c9d0f3104408a64d52b84643f116179022d73bdcommit-bot@chromium.org 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate: 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com Light fLight; 477ce661d19c5cf4484305a1b20c44bd111f129847robertphillips@google.com SkScalar fBlurSigma; 48fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com typedef SkMaskFilter INHERITED; 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 53