Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: include/effects/SkLumaXfermode.h

Issue 22918012: Add luminance mask transfer modes. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix VS builds (no named variadic macro params support) Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkLumaXfermode_DEFINED
9 #define SkLumaXfermode_DEFINED
10
11 #include "SkXfermode.h"
12
13 /**
14 * Luminance mask transfer, as defined in
15 * http://www.w3.org/TR/SVG/masking.html#Masking
16 * http://www.w3.org/TR/css-masking/#MaskValues
17 *
18 * The luminance-to-alpha function is applied before performing a standard
19 * SrcIn or DstIn xfer:
reed1 2013/08/22 18:35:51 Is this list (srcin, dstin) complete, or just e.g.
f(malita) 2013/08/22 19:25:52 It is complete with regard to SVG/CSS masking supp
20 *
21 * luma(C) = (0.2125 * C.r + 0.7154 * C.g + 0.0721 * C.b) * C.a
reed1 2013/08/22 18:35:51 Can you document what happens to the resulting r,g
f(malita) 2013/08/22 19:25:52 Will do.
22 *
23 * The only supported submodes are SrcIn and DstIn.
24 */
25 class SK_API SkLumaMaskXfermode : public SkXfermode {
26 public:
27 static SkXfermode* Create(SkXfermode::Mode);
reed1 2013/08/22 18:35:51 Should you support another Create that takes SkXfe
f(malita) 2013/08/22 19:25:52 This ties into the decision to support arbitrary t
28
29 virtual SkPMColor xferColor(SkPMColor, SkPMColor) const SK_OVERRIDE;
30 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
31 const SkAlpha aa[]) const SK_OVERRIDE;
32
33 SK_DEVELOPER_TO_STRING()
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaMaskXfermode)
35
36 #if SK_SUPPORT_GPU
37 virtual bool asNewEffectOrCoeff(GrContext*, GrEffectRef**, Coeff*, Coeff*,
38 GrTexture*) const SK_OVERRIDE;
39 #endif
40
41 protected:
42 SkLumaMaskXfermode(SkFlattenableReadBuffer&);
43 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
44
45 private:
46 SkLumaMaskXfermode(SkXfermode::Mode);
47
48 const SkXfermode::Mode fMode;
49
50 typedef SkXfermode INHERITED;
51 };
52
53 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698