Krita Source Code Documentation
Loading...
Searching...
No Matches
KoBgrColorSpaceTraits.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_BGR_COLORSPACE_TRAITS_H_
8#define _KO_BGR_COLORSPACE_TRAITS_H_
9
14template<typename _channels_type_>
15struct KoBgrTraits : public KoColorSpaceTrait<_channels_type_, 4, 3> {
16 typedef _channels_type_ channels_type;
18 static const qint32 red_pos = 2;
19 static const qint32 green_pos = 1;
20 static const qint32 blue_pos = 0;
30
32 inline static channels_type red(const quint8 *data)
33 {
34 const channels_type *d = parent::nativeArray(data);
35 return d[red_pos];
36 }
38 inline static void setRed(quint8 *data, channels_type nv)
39 {
41 d[red_pos] = nv;
42 }
44 inline static channels_type green(const quint8 *data)
45 {
46 const channels_type *d = parent::nativeArray(data);
47 return d[green_pos];
48 }
50 inline static void setGreen(quint8* data, channels_type nv) {
52 d[green_pos] = nv;
53 }
55 inline static channels_type blue(const quint8 *data)
56 {
57 const channels_type *d = parent::nativeArray(data);
58 return d[blue_pos];
59 }
61 inline static void setBlue(quint8* data, channels_type nv) {
63 d[blue_pos] = nv;
64 }
65};
66
67
68struct KoBgrU8Traits : public KoBgrTraits<quint8> {
69};
70
71struct KoBgrU16Traits : public KoBgrTraits<quint16> {
72};
73
74struct KoBgrU32Traits : public KoBgrTraits<quint32> {
75};
76
77#include <KoConfig.h>
78#ifdef HAVE_OPENEXR
79#include <half.h>
80
81struct KoBgrF16Traits : public KoBgrTraits<half> {
82};
83
84#endif
85
86struct KoBgrF32Traits : public KoBgrTraits<float> {
87};
88
89struct KoBgrF64Traits : public KoBgrTraits<double> {
90};
91
92
93#endif
static const qint32 blue_pos
static void setRed(quint8 *data, channels_type nv)
Set the red component.
static const qint32 green_pos
KoColorSpaceTrait< _channels_type_, 4, 3 > parent
static const qint32 red_pos
static void setGreen(quint8 *data, channels_type nv)
Set the green component.
static channels_type blue(const quint8 *data)
_channels_type_ channels_type
static channels_type green(const quint8 *data)
static void setBlue(quint8 *data, channels_type nv)
Set the blue component.
static channels_type red(const quint8 *data)
static const channels_type * nativeArray(const quint8 *a)