blob: a03a2832e48fa8a0c80a061f3a878aaf1647d107 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkEmbossMaskFilter_DEFINED
11#define SkEmbossMaskFilter_DEFINED
12
13#include "SkMaskFilter.h"
14
15/** \class SkEmbossMaskFilter
16
17 This mask filter creates a 3D emboss look, by specifying a light and blur amount.
18*/
19class SkEmbossMaskFilter : public SkMaskFilter {
20public:
21 struct Light {
22 SkScalar fDirection[3]; // x,y,z
23 uint16_t fPad;
24 uint8_t fAmbient;
25 uint8_t fSpecular; // exponent, 4.4 right now
26 };
27
28 SkEmbossMaskFilter(const Light& light, SkScalar blurRadius);
29
30 // overrides from SkMaskFilter
31 // This method is not exported to java.
32 virtual SkMask::Format getFormat();
33 // This method is not exported to java.
mike@reedtribe.org6b919c32011-04-20 11:17:30 +000034 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
35 SkIPoint* margin);
reed@android.com8a1c16f2008-12-17 15:59:43 +000036
37 // overrides from SkFlattenable
reed@android.com8a1c16f2008-12-17 15:59:43 +000038 // This method is not exported to java.
39 virtual void flatten(SkFlattenableWriteBuffer&);
djsollen@google.comba28d032012-03-26 17:57:35 +000040 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
41
reed@android.com8a1c16f2008-12-17 15:59:43 +000042
reed@android.com8a1c16f2008-12-17 15:59:43 +000043protected:
44 SkEmbossMaskFilter(SkFlattenableReadBuffer&);
45
46private:
47 Light fLight;
48 SkScalar fBlurRadius;
reed@android.com8a1c16f2008-12-17 15:59:43 +000049
50 typedef SkMaskFilter INHERITED;
51};
52
53#endif
54