blob: e991108c921b8d4f26fb53e1140aa0c400c1b027 [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 2007 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 SkPixelXorXfermode_DEFINED
11#define SkPixelXorXfermode_DEFINED
12
13#include "SkXfermode.h"
14
15/** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst).
16 This transformation does not follow premultiplied conventions, therefore
17 this proc *always* returns an opaque color (alpha == 255). Thus it is
18 not really usefull for operating on blended colors.
19*/
20class SkPixelXorXfermode : public SkXfermode {
21public:
22 SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
23
djsollen@google.comba28d032012-03-26 17:57:35 +000024 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
tomhudson@google.com1447c6f2011-04-27 14:09:52 +000025
reed@android.com8a1c16f2008-12-17 15:59:43 +000026protected:
djsollen@google.com54924242012-03-29 15:18:04 +000027 SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
28 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
29
reed@android.com8a1c16f2008-12-17 15:59:43 +000030 // override from SkXfermode
31 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst);
32
33private:
34 SkColor fOpColor;
35
reed@android.com8a1c16f2008-12-17 15:59:43 +000036 typedef SkXfermode INHERITED;
37};
38
39#endif