blob: 5411b12d05148d80507aafd4105f0c8d61813fdf [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2007 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00006 */
7
8#ifndef SkPixelXorXfermode_DEFINED
9#define SkPixelXorXfermode_DEFINED
10
11#include "SkXfermode.h"
12
13/** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst).
14 This transformation does not follow premultiplied conventions, therefore
15 this proc *always* returns an opaque color (alpha == 255). Thus it is
16 not really usefull for operating on blended colors.
17*/
tfarina@chromium.org6806fe82012-10-12 14:41:39 +000018class SK_API SkPixelXorXfermode : public SkXfermode {
reed@android.com8a1c16f2008-12-17 15:59:43 +000019public:
20 SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
21
robertphillips@google.comb83b6b42013-01-22 14:32:09 +000022 SK_DEVELOPER_TO_STRING()
djsollen@google.comba28d032012-03-26 17:57:35 +000023 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
tomhudson@google.com1447c6f2011-04-27 14:09:52 +000024
reed@android.com8a1c16f2008-12-17 15:59:43 +000025protected:
djsollen@google.com54924242012-03-29 15:18:04 +000026 SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
27 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
28
reed@android.com8a1c16f2008-12-17 15:59:43 +000029 // override from SkXfermode
mike@reedtribe.org61490fa2012-12-24 14:38:46 +000030 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
reed@android.com8a1c16f2008-12-17 15:59:43 +000031
32private:
33 SkColor fOpColor;
34
reed@android.com8a1c16f2008-12-17 15:59:43 +000035 typedef SkXfermode INHERITED;
36};
37
38#endif