Krita Source Code Documentation
Loading...
Searching...
No Matches
KoRgbColorSpaceTraits.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2007 Cyrille Berger <cberger@cberger.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef _KO_RGB_COLORSPACE_TRAITS_H_
8#define _KO_RGB_COLORSPACE_TRAITS_H_
9
14template<typename _channels_type_>
15struct KoRgbTraits : public KoColorSpaceTrait<_channels_type_, 4, 3> {
16 typedef _channels_type_ channels_type;
18 static const qint32 red_pos = 0;
19 static const qint32 green_pos = 1;
20 static const qint32 blue_pos = 2;
30
32 inline static channels_type red(quint8* data) {
34 return d[red_pos];
35 }
37 inline static void setRed(quint8* data, channels_type nv) {
39 d[red_pos] = nv;
40 }
42 inline static channels_type green(quint8* data) {
44 return d[green_pos];
45 }
47 inline static void setGreen(quint8* data, channels_type nv) {
49 d[green_pos] = nv;
50 }
52 inline static channels_type blue(quint8* data) {
54 return d[blue_pos];
55 }
57 inline static void setBlue(quint8* data, channels_type nv) {
59 d[blue_pos] = nv;
60 }
61};
62
63struct KoRgbU8Traits : public KoRgbTraits<quint8> {
64};
65
66struct KoRgbU16Traits : public KoRgbTraits<quint16> {
67};
68
69struct KoRgbU32Traits : public KoRgbTraits<quint32> {
70};
71
72
73#include <KoConfig.h>
74#ifdef HAVE_OPENEXR
75#include <half.h>
76
77struct KoRgbF16Traits : public KoRgbTraits<half> {
78};
79
80#endif
81
82struct KoRgbF32Traits : public KoRgbTraits<float> {
83};
84
85struct KoRgbF64Traits : public KoRgbTraits<double> {
86};
87
88
89#endif
static const channels_type * nativeArray(const quint8 *a)
_channels_type_ channels_type
static channels_type red(quint8 *data)
KoColorSpaceTrait< _channels_type_, 4, 3 > parent
static const qint32 red_pos
static void setRed(quint8 *data, channels_type nv)
Set the red component.
static const qint32 green_pos
static channels_type green(quint8 *data)
static channels_type blue(quint8 *data)
static void setBlue(quint8 *data, channels_type nv)
Set the blue component.
static void setGreen(quint8 *data, channels_type nv)
Set the green component.
static const qint32 blue_pos