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.
117 lines
6.6 KiB
117 lines
6.6 KiB
/*
|
|
* Copyright (c) 2002 Patrick Julien <freak@codepimps.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_STRATEGY_COLORSPACE_RGB_H_
|
|
#define KIS_STRATEGY_COLORSPACE_RGB_H_
|
|
|
|
#include "klocale.h"
|
|
|
|
#include "kis_global.h"
|
|
#include "kis_u8_base_colorspace.h"
|
|
#include "koffice_export.h"
|
|
|
|
const Q_UINT8 PIXEL_BLUE = 0;
|
|
const Q_UINT8 PIXEL_GREEN = 1;
|
|
const Q_UINT8 PIXEL_RED = 2;
|
|
const Q_UINT8 PIXEL_ALPHA = 3;
|
|
|
|
class KRITATOOL_EXPORT KisRgbColorSpace : public KisU8BaseColorSpace {
|
|
public:
|
|
KisRgbColorSpace(KisColorSpaceFactoryRegistry * parent, KisProfile *p);
|
|
virtual ~KisRgbColorSpace();
|
|
|
|
virtual bool willDegrade(ColorSpaceIndependence)
|
|
{
|
|
return false;
|
|
};
|
|
|
|
|
|
public:
|
|
void setPixel(Q_UINT8 *pixel, Q_UINT8 red, Q_UINT8 green, Q_UINT8 blue, Q_UINT8 alpha) const;
|
|
void getPixel(const Q_UINT8 *pixel, Q_UINT8 *red, Q_UINT8 *green, Q_UINT8 *blue, Q_UINT8 *alpha) const;
|
|
|
|
virtual void mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const;
|
|
virtual void convolveColors(Q_UINT8** colors, Q_INT32* kernelValues, KisChannelInfo::enumChannelFlags channelFlags, Q_UINT8 *dst, Q_INT32 factor, Q_INT32 offset, Q_INT32 nColors) const;
|
|
virtual void invertColor(Q_UINT8 * src, Q_INT32 nPixels);
|
|
virtual void darken(const Q_UINT8 * src, Q_UINT8 * dst, Q_INT32 shade, bool compensate, double compensation, Q_INT32 nPixels) const;
|
|
virtual Q_UINT8 intensity8(const Q_UINT8 * src) const;
|
|
|
|
virtual QValueVector<KisChannelInfo *> channels() const;
|
|
virtual Q_UINT32 nChannels() const;
|
|
virtual Q_UINT32 nColorChannels() const;
|
|
virtual Q_UINT32 pixelSize() const;
|
|
|
|
virtual QImage convertToQImage(const Q_UINT8 *data, Q_INT32 width, Q_INT32 height,
|
|
KisProfile * dstProfile = 0,
|
|
Q_INT32 renderingIntent = INTENT_PERCEPTUAL,
|
|
float exposure = 0.0f);
|
|
|
|
virtual KisCompositeOpList userVisiblecompositeOps() const;
|
|
|
|
protected:
|
|
|
|
virtual void bitBlt(Q_UINT8 *dst,
|
|
Q_INT32 dstRowStride,
|
|
const Q_UINT8 *src,
|
|
Q_INT32 srcRowStride,
|
|
const Q_UINT8 *srcAlphaMask,
|
|
Q_INT32 maskRowStride,
|
|
Q_UINT8 opacity,
|
|
Q_INT32 rows,
|
|
Q_INT32 cols,
|
|
const KisCompositeOp& op);
|
|
|
|
void compositeOver(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeAlphaDarken(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeMultiply(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeDivide(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeScreen(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeOverlay(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeDodge(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeBurn(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeDarken(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeLighten(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeHue(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeSaturation(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeValue(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeColor(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
void compositeErase(Q_UINT8 *dst, Q_INT32 dstRowStride, const Q_UINT8 *src, Q_INT32 srcRowStride, const Q_UINT8 *mask, Q_INT32 maskRowStride, Q_INT32 rows, Q_INT32 columns, Q_UINT8 opacity);
|
|
};
|
|
|
|
class KisRgbColorSpaceFactory : public KisColorSpaceFactory
|
|
{
|
|
public:
|
|
/**
|
|
* Krita definition for use in .kra files and internally: unchanging name +
|
|
* i18n'able description.
|
|
*/
|
|
virtual KisID id() const { return KisID("RGBA", i18n("RGB (8-bit integer/channel)")); };
|
|
|
|
/**
|
|
* lcms colorspace type definition.
|
|
*/
|
|
virtual Q_UINT32 colorSpaceType() { return TYPE_BGRA_8; };
|
|
|
|
virtual icColorSpaceSignature colorSpaceSignature() { return icSigRgbData; };
|
|
|
|
virtual KisColorSpace *createColorSpace(KisColorSpaceFactoryRegistry * parent, KisProfile * p) { return new KisRgbColorSpace(parent, p); };
|
|
|
|
virtual QString defaultProfile() { return "sRGB built-in - (lcms internal)"; };
|
|
};
|
|
|
|
#endif // KIS_STRATEGY_COLORSPACE_RGB_H_
|