You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/chalk/chalkcolor/colorspaces/kis_alpha_colorspace.h

94 lines
3.6 KiB

/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSPACE_ALPHA_H_
#define KIS_COLORSPACE_ALPHA_H_
#include <tqcolor.h>
#include "kis_global.h"
#include "kis_u8_base_colorspace.h"
/**
* The alpha mask is a special color strategy that treats all pixels as
* alpha value with a colour common to the mask. The default color is white.
*/
class KisAlphaColorSpace : public KisU8BaseColorSpace {
public:
KisAlphaColorSpace(KisColorSpaceFactoryRegistry * parent,
KisProfile *p);
virtual ~KisAlphaColorSpace();
public:
virtual bool willDegrade(ColorSpaceIndependence)
{
return false;
};
virtual void fromTQColor(const TQColor& c, TQ_UINT8 *dst, KisProfile * profile = 0);
virtual void fromTQColor(const TQColor& c, TQ_UINT8 opacity, TQ_UINT8 *dst, KisProfile * profile = 0);
virtual void getAlpha(const TQ_UINT8 *pixel, TQ_UINT8 *alpha) const;
virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, KisProfile * profile = 0);
virtual void toTQColor(const TQ_UINT8 *src, TQColor *c, TQ_UINT8 *opacity, KisProfile * profile = 0);
virtual TQ_UINT8 difference(const TQ_UINT8 *src1, const TQ_UINT8 *src2);
virtual void mixColors(const TQ_UINT8 **colors, const TQ_UINT8 *weights, TQ_UINT32 nColors, TQ_UINT8 *dst) const;
virtual TQValueVector<KisChannelInfo *> channels() const;
virtual TQ_UINT32 nChannels() const { return 1; };
virtual TQ_UINT32 nColorChannels() const { return 0; };
virtual TQ_UINT32 pixelSize() const { return 1; };
virtual TQString channelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
virtual TQString normalisedChannelValueText(const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
virtual void convolveColors(TQ_UINT8** colors, TQ_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, TQ_UINT8 *dst, TQ_INT32 factor, TQ_INT32 offset, TQ_INT32 nColors) const;
protected:
/**
* Convert a byte array of srcLen pixels *src to the specified color space
* and put the converted bytes into the prepared byte array *dst.
*
* Returns false if the conversion failed, true if it succeeded
*/
virtual bool convertPixelsTo(const TQ_UINT8 *src,
TQ_UINT8 *dst, KisAbstractColorSpace * dstColorSpace,
TQ_UINT32 numPixels,
TQ_INT32 renderingIntent = INTENT_PERCEPTUAL);
virtual void bitBlt(TQ_UINT8 *dst,
TQ_INT32 dststride,
const TQ_UINT8 *src,
TQ_INT32 srcRowStride,
const TQ_UINT8 *srcAlphaMask,
TQ_INT32 maskRowStride,
TQ_UINT8 opacity,
TQ_INT32 rows,
TQ_INT32 cols,
const KisCompositeOp& op);
KisCompositeOpList userVisiblecompositeOps() const;
};
#endif // KIS_COLORSPACE_ALPHA_H_