18#ifndef KIS_F32_BASE_COLORSPACE_H_
19#define KIS_F32_BASE_COLORSPACE_H_
23#include "kis_global.h"
24#include "kis_abstract_colorspace.h"
25#include "kis_integer_maths.h"
31inline float UINT8_TO_FLOAT(uint c)
33 return static_cast<float>(c) / UINT8_MAX;
36inline uint FLOAT_TO_UINT8( float c)
38 return static_cast<uint >(CLAMP( static_cast<int>(c * static_cast<int>(UINT8_MAX) + 0.5),
39 static_cast<int>(UINT8_MIN), static_cast<int>(UINT8_MAX)));
43inline uint FLOAT_TO_UINT16( float c)
45 return static_cast<uint >(CLAMP( static_cast<int>(c * static_cast<int>(UINT16_MAX) + 0.5),
46 static_cast<int>(UINT16_MIN), static_cast<int>(UINT16_MAX)));
49inline float FLOAT_BLEND( float a, float b, float alpha)
51 return (a - b) * alpha + b;
54#define F32_OPACITY_OPAQUE 1.0f
55#define F32_OPACITY_TRANSPARENT 0.0f
61 KisF32BaseColorSpace( const KisID & id, DWORD cmType, icColorSpaceSignature colorSpaceSignature, KisColorSpaceFactoryRegistry * parent, KisProfile *p)
64 m_alphaSize = sizeof(float);
67 virtual TQ_UINT8 getAlpha( const TQ_UINT8 * pixel) const;
68 virtual void setAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels) const;
69 virtual void multiplyAlpha(TQ_UINT8 * pixels, TQ_UINT8 alpha, TQ_INT32 nPixels);
71 virtual void applyAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
72 virtual void applyInverseAlphaU8Mask(TQ_UINT8 * pixels, TQ_UINT8 * alpha, TQ_INT32 nPixels);
74 virtual TQString channelValueText( const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
75 virtual TQString normalisedChannelValueText( const TQ_UINT8 *pixel, TQ_UINT32 channelIndex) const;
77 virtual TQ_UINT8 scaleToU8( const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
78 virtual TQ_UINT16 scaleToU16( const TQ_UINT8 * srcPixel, TQ_INT32 channelPos);
A colorspace strategy is the definition of a certain color model in Chalk.
KisAbstractColorSpace(const KisID &id, DWORD cmType, icColorSpaceSignature colorSpaceSignature, KisColorSpaceFactoryRegistry *parent, KisProfile *profile)
virtual bool hasHighDynamicRange() const Returns true if the colorspace supports channel values outside the (normalised) range 0 to 1.
virtual KisID id() const Chalk definition for use in .kra files and internally: unchanging name + i18n'able description.
|