2
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
#ifndef KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
19
#define KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
25
#include "kis_global.h"
26
#include "kis_strategy_colorspace.h"
27
#include "kis_pixel.h"
29
// XXX: move into namespace.
30
const PIXELTYPE PIXEL_GRAY = 0;
31
const PIXELTYPE PIXEL_GRAY_ALPHA = 1;
34
class KisStrategyColorSpaceGrayscale : public KisStrategyColorSpace {
36
KisStrategyColorSpaceGrayscale();
37
virtual ~KisStrategyColorSpaceGrayscale();
41
virtual void nativeColor(const QColor& c, QUANTUM *dst, KisProfileSP profile = 0);
42
virtual void nativeColor(const QColor& c, QUANTUM opacity, QUANTUM *dst, KisProfileSP profile = 0);
44
virtual void toQColor(const QUANTUM *src, QColor *c, KisProfileSP profile = 0);
45
virtual void toQColor(const QUANTUM *src, QColor *c, QUANTUM *opacity, KisProfileSP profile = 0);
47
virtual KisPixelRO toKisPixelRO(const QUANTUM *src, KisProfileSP profile = 0)
48
{ return KisPixelRO (src, src + PIXEL_GRAY_ALPHA, this, profile); }
50
virtual KisPixel toKisPixel(QUANTUM *src, KisProfileSP profile = 0)
51
{ return KisPixel (src, src + PIXEL_GRAY_ALPHA, this, profile); }
53
virtual Q_INT8 difference(const QUANTUM* src1, const QUANTUM* src2);
54
virtual void mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const;
56
virtual vKisChannelInfoSP channels() const;
57
virtual bool alpha() const;
58
virtual Q_INT32 nChannels() const;
59
virtual Q_INT32 nColorChannels() const;
60
virtual Q_INT32 pixelSize() const;
63
virtual QImage convertToQImage(const QUANTUM *data, Q_INT32 width, Q_INT32 height,
64
KisProfileSP srcProfile, KisProfileSP dstProfile,
65
Q_INT32 renderingIntent = INTENT_PERCEPTUAL);
68
virtual void bitBlt(Q_INT32 stride,
76
const KisCompositeOp& op);
78
KisCompositeOpList userVisiblecompositeOps() const;
81
void compositeOver(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
82
void compositeMultiply(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
83
void compositeDivide(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
84
void compositeScreen(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
85
void compositeOverlay(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
86
void compositeDodge(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
87
void compositeBurn(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
88
void compositeDarken(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
89
void compositeLighten(QUANTUM *dst, Q_INT32 dstRowStride, const QUANTUM *src, Q_INT32 srcRowStride, Q_INT32 rows, Q_INT32 columns, QUANTUM opacity);
92
vKisChannelInfoSP m_channels;
95
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_