Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 15baa998 authored by Boudewijn Rempt's avatar Boudewijn Rempt

* Add the beginning of an XYZ colorstrategy. Doesn't render correct, though.

* Add a small python dcop script to test Krita's dcop bindings
* Fix type in rgb_f32

svn path=/trunk/koffice/; revision=444342
parent 78080c8a
......@@ -7,7 +7,10 @@ INCLUDES = -I$(srcdir)/.. \
noinst_LTLIBRARIES = libkiscolor_strategy.la
libkiscolor_strategy_la_SOURCES = kis_strategy_colorspace.cc \
kis_colorspace_registry.cc kis_colorspace_alpha.cc kis_color_conversions.cc
kis_colorspace_registry.cc \
kis_colorspace_alpha.cc \
kis_color_conversions.cc \
kis_colorspace_xyz.cc
libkiscolor_strategy_la_METASOURCES = AUTO
......
......@@ -20,7 +20,7 @@
#include "kis_types.h"
#include "kis_colorspace_registry.h"
#include "kis_colorspace_alpha.h"
#include "kis_colorspace_xyz.h"
KisColorSpaceRegistry *KisColorSpaceRegistry::m_singleton = 0;
......@@ -40,6 +40,7 @@ KisColorSpaceRegistry* KisColorSpaceRegistry::instance()
{
KisColorSpaceRegistry::m_singleton = new KisColorSpaceRegistry();
Q_CHECK_PTR(KisColorSpaceRegistry::m_singleton);
m_singleton->add(new KisColorspaceXYZ());
}
return KisColorSpaceRegistry::m_singleton;
}
......
This diff is collapsed.
/*
* Copyright (c) 2005 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_XYZ_H_
#define KIS__COLORSPACE_XYZ_H_
#include <qcolor.h>
#include "kis_global.h"
#include "kis_strategy_colorspace.h"
#include "kis_pixel.h"
#include "kis_integer_maths.h"
class KisColorspaceXYZ : public KisStrategyColorSpace {
public:
static const Q_UINT16 U16_OPACITY_OPAQUE = UINT16_MAX;
static const Q_UINT16 U16_OPACITY_TRANSPARENT = UINT16_MIN;
struct Pixel {
Q_UINT16 X;
Q_UINT16 Y;
Q_UINT16 Z;
Q_UINT16 alpha;
};
public:
KisColorspaceXYZ();
virtual ~KisColorspaceXYZ();
public:
virtual void nativeColor(const QColor& c, Q_UINT8 *dst, KisProfileSP profile = 0);
virtual void nativeColor(const QColor& c, QUANTUM opacity, Q_UINT8 *dst, KisProfileSP profile = 0);
virtual void getAlpha(const Q_UINT8 *pixel, Q_UINT8 *alpha);
virtual void setAlpha(Q_UINT8 * pixels, Q_UINT8 alpha, Q_INT32 nPixels);
virtual void toQColor(const Q_UINT8 *src, QColor *c, KisProfileSP profile = 0);
virtual void toQColor(const Q_UINT8 *src, QColor *c, QUANTUM *opacity, KisProfileSP profile = 0);
//XXX: KisPixel(RO) does not work with this colourspace as it only handles 8-bit channels.
virtual KisPixelRO toKisPixelRO(const Q_UINT8 *src, KisProfileSP profile = 0)
{ return KisPixelRO (src, src + PIXEL_ALPHA * sizeof(Q_UINT16), this, profile); }
virtual KisPixel toKisPixel(Q_UINT8 *src, KisProfileSP profile = 0)
{ return KisPixel (src, src + PIXEL_ALPHA * sizeof(Q_UINT16), this, profile); }
virtual Q_INT8 difference(const Q_UINT8 *src1, const Q_UINT8 *src2);
virtual void mixColors(const Q_UINT8 **colors, const Q_UINT8 *weights, Q_UINT32 nColors, Q_UINT8 *dst) const;
virtual vKisChannelInfoSP channels() const;
virtual bool hasAlpha() const;
virtual Q_INT32 nChannels() const;
virtual Q_INT32 nColorChannels() const;
virtual Q_INT32 pixelSize() const;
virtual QString channelValueText(const Q_UINT8 *pixel, Q_UINT32 channelIndex) const;
virtual QString normalisedChannelValueText(const Q_UINT8 *pixel, Q_UINT32 channelIndex) const;
virtual QImage convertToQImage(const Q_UINT8 *data, Q_INT32 width, Q_INT32 height,
KisProfileSP srcProfile, KisProfileSP dstProfile,
Q_INT32 renderingIntent = INTENT_PERCEPTUAL,
float exposure = 0.0f);
virtual void adjustBrightnessContrast(const Q_UINT8 *src, Q_UINT8 *dst, Q_INT8 brightness, Q_INT8 contrast, Q_INT32 nPixels) const;
virtual void bitBlt(Q_UINT8 *dst,
Q_INT32 dststride,
const Q_UINT8 *src,
Q_INT32 srcRowStride,
const Q_UINT8 *srcAlphaMask,
Q_INT32 maskRowStride,
QUANTUM opacity,
Q_INT32 rows,
Q_INT32 cols,
const KisCompositeOp& op);
KisCompositeOpList userVisiblecompositeOps() const;
protected:
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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 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_UINT16 opacity);
void compositeCopy(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_UINT16 opacity);
private:
vKisChannelInfoSP m_channels;
cmsHTRANSFORM m_defaultToRGB;
cmsHTRANSFORM m_defaultFromRGB;
static const Q_UINT8 PIXEL_X = 0;
static const Q_UINT8 PIXEL_Y = 2;
static const Q_UINT8 PIXEL_Z = 3;
static const Q_UINT8 PIXEL_ALPHA = 4;
Q_UINT8 * m_qcolordata; // A small buffer for conversion from and to qcolor.
};
#endif // KIS__COLORSPACE_XYZ_H_
......@@ -49,7 +49,7 @@ namespace {
}
KisStrategyColorSpace::KisStrategyColorSpace(const KisID& id, Q_UINT32 cmType, icColorSpaceSignature colorSpaceSignature)
KisStrategyColorSpace::KisStrategyColorSpace(const KisID& id, DWORD cmType, icColorSpaceSignature colorSpaceSignature)
: m_id(id),
m_cmType(cmType),
m_colorSpaceSignature(colorSpaceSignature)
......
......@@ -73,7 +73,7 @@ public:
* @param cmType The littlecms colorstrategy type we wrap.
* @param colorSpaceSignature The icc signature for the colorspace we are.
*/
KisStrategyColorSpace(const KisID & id, Q_UINT32 cmType, icColorSpaceSignature colorSpaceSignature);
KisStrategyColorSpace(const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature);
virtual ~KisStrategyColorSpace();
......@@ -254,7 +254,6 @@ public:
Q_UINT32 numPixels,
Q_INT32 renderingIntent = INTENT_PERCEPTUAL);
//============================== Manipulation fucntions ==========================//
//
// The manipulation functions have default implementations that _convert_ the pixel
......@@ -373,7 +372,7 @@ protected:
private:
KisID m_id;
Q_UINT32 m_cmType; // The colorspace type as defined by littlecms
DWORD m_cmType; // The colorspace type as defined by littlecms
icColorSpaceSignature m_colorSpaceSignature; // The colorspace signature as defined in icm/icc files
typedef QMap<KisProfilePair, cmsHTRANSFORM> TransformMap;
......
from pydcop import *
app = ""
for a in apps():
if (a.startswith("krita")):
app = anyAppCalled(a)
doc = app.KoApplicationIface.getDocuments()[0]
img=doc.currentImage()
dev=img.activeDevice()
dev.setName("A new name")
print dev.pixelSize()
print dev.nChannels()
print dev.readBytes(10, 10, 1, 1)
......@@ -59,7 +59,7 @@ inline float FLOAT_BLEND(float a, float b, float alpha)
#define EPSILON 1e-6
// FIXME: lcsm doesn't support 32-bit float
// FIXME: lcms doesn't support 32-bit float
#define F32_LCMS_TYPE TYPE_BGRA_16
KisStrategyColorSpaceRGBF32::KisStrategyColorSpaceRGBF32() :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment