epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2007 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #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 | */ |
| 20 | class SkPixelXorXfermode : public SkXfermode { |
| 21 | public: |
| 22 | SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {} |
| 23 | |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 24 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode) |
tomhudson@google.com | 1447c6f | 2011-04-27 14:09:52 +0000 | [diff] [blame] | 25 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 26 | protected: |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 27 | SkPixelXorXfermode(SkFlattenableReadBuffer& rb); |
| 28 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 29 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 30 | // override from SkXfermode |
| 31 | virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst); |
| 32 | |
| 33 | private: |
| 34 | SkColor fOpColor; |
| 35 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | typedef SkXfermode INHERITED; |
| 37 | }; |
| 38 | |
| 39 | #endif |