180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2007 The Android Open Source Project
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkPixelXorXfermode_DEFINED
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkPixelXorXfermode_DEFINED
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkXfermode.h"
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst).
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    This transformation does not follow premultiplied conventions, therefore
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    this proc *always* returns an opaque color (alpha == 255). Thus it is
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    not really usefull for operating on blended colors.
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru*/
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SK_API SkPixelXorXfermode : public SkXfermode {
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
22d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger    SK_DEVELOPER_TO_STRING()
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // override from SkXfermode
30d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger    virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkColor fOpColor;
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkXfermode INHERITED;
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
39