SkPixelXorXfermode.h revision 61490fa4d20f44e049d8252a9e11d80626b608d2
1/*
2 * Copyright 2007 The Android Open Source Project
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 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*/
18class SK_API SkPixelXorXfermode : public SkXfermode {
19public:
20    SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
21
22    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
23
24protected:
25    SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
26    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
27
28    // override from SkXfermode
29    virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
30
31private:
32    SkColor fOpColor;
33
34    typedef SkXfermode INHERITED;
35};
36
37#endif
38