Krita Source Code Documentation
Loading...
Searching...
No Matches
KoYcbcrColorSpaceTraits.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_YCbCr_COLORSPACE_TRAITS_H_
8#define _KO_YCbCr_COLORSPACE_TRAITS_H_
9
14template<typename _channels_type_>
15struct KoYCbCrTraits : public KoColorSpaceTrait<_channels_type_, 4, 3> {
16
17 typedef _channels_type_ channels_type;
19
20 static const qint32 Y_pos = 0;
21 static const qint32 Cb_pos = 1;
22 static const qint32 Cr_pos = 2;
23
33
35 inline static channels_type Y(quint8* data) {
37 return d[Y_pos];
38 }
40 inline static void setY(quint8* data, channels_type nv) {
42 d[Y_pos] = nv;
43 }
45 inline static channels_type Cb(quint8* data) {
47 return d[Cb_pos];
48 }
50 inline static void setCb(quint8* data, channels_type nv) {
52 d[Cb_pos] = nv;
53 }
55 inline static channels_type Cr(quint8* data) {
57 return d[Cr_pos];
58 }
60 inline static void setCr(quint8* data, channels_type nv) {
62 d[Cr_pos] = nv;
63 }
64};
65
66struct KoYCbCrU8Traits : public KoYCbCrTraits<quint8> {
67};
68
69struct KoYCbCrU16Traits : public KoYCbCrTraits<quint16> {
70};
71
72#include <KoConfig.h>
73#ifdef HAVE_OPENEXR
74#include <half.h>
75
76struct KoYCbCrF16Traits : public KoYCbCrTraits<half> {
77};
78
79#endif
80
81struct KoYCbCrF32Traits : public KoYCbCrTraits<float> {
82};
83
84struct KoYCbCrF64Traits : public KoYCbCrTraits<double> {
85};
86
87
88#endif
static const channels_type * nativeArray(const quint8 *a)
static channels_type Cb(quint8 *data)
static const qint32 Y_pos
static const qint32 Cr_pos
static channels_type Cr(quint8 *data)
static const qint32 Cb_pos
static void setCr(quint8 *data, channels_type nv)
Set the Cr component.
KoColorSpaceTrait< _channels_type_, 4, 3 > parent
static void setCb(quint8 *data, channels_type nv)
Set the Cb component.
static void setY(quint8 *data, channels_type nv)
Set the Y component.
_channels_type_ channels_type
static channels_type Y(quint8 *data)