Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAutoLevels.h
Go to the documentation of this file.
1/*
2 * This file is part of Krita
3 *
4 * SPDX-FileCopyrightText: 2021 Deif Lou <ginoba@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#ifndef KIS_AUTO_LEVELS_H
10#define KIS_AUTO_LEVELS_H
11
12#include <QVector>
13
14#include <KoColor.h>
15#include <kis_paint_device.h>
16#include <KisLevelsCurve.h>
17#include <kritaimage_export.h>
18
19class KisHistogram;
20
25namespace KisAutoLevels
26{
27
35
44
52struct KRITAIMAGE_EXPORT ChannelHistogram
53{
54 KisHistogram *histogram{nullptr};
55 int channel{0};
56};
57
64QPair<qreal, qreal> KRITAIMAGE_EXPORT getInputBlackAndWhitePoints(ChannelHistogram histogram,
65 qreal shadowsClipping,
66 qreal highlightsClipping);
67
73QPair<KoColor, KoColor> KRITAIMAGE_EXPORT getDarkestAndWhitestColors(const KisPaintDeviceSP device,
74 qreal shadowsClipping,
75 qreal highlightsClipping);
76
96qreal KRITAIMAGE_EXPORT getGamma(qreal blackPoint,
97 qreal whitePoint,
98 qreal inputIntensity,
99 qreal outputIntensity);
100
128QVector<KisLevelsCurve> KRITAIMAGE_EXPORT adjustMonochromaticContrast(ChannelHistogram lightnessHistogram,
129 QVector<ChannelHistogram> &channelsHistograms,
130 qreal shadowsClipping,
131 qreal highlightsClipping,
132 qreal maximumInputBlackAndWhiteOffset,
133 MidtonesAdjustmentMethod midtonesAdjustmentMethod,
134 qreal midtonesAdjustmentAmount,
135 const QVector<qreal> &outputBlackPoints,
136 const QVector<qreal> &outputWhitePoints,
137 const QVector<qreal> &outputMidtones);
138
166 qreal shadowsClipping,
167 qreal highlightsClipping,
168 qreal maximumInputBlackAndWhiteOffset,
169 MidtonesAdjustmentMethod midtonesAdjustmentMethod,
170 qreal midtonesAdjustmentAmount,
171 const QVector<qreal> &outputBlackPoints,
172 const QVector<qreal> &outputWhitePoints,
173 const QVector<qreal> &outputMidtones);
174
175}
176
177#endif
This namespace contains functions to compute the levels adjustment parameters automatically from a hi...
QPair< KoColor, KoColor > getDarkestAndWhitestColors(const KisPaintDeviceSP device, qreal shadowsClipping, qreal highlightsClipping)
Finds the darkest and whitest colors in the device having into account the clipping.
QVector< KisLevelsCurve > adjustMonochromaticContrast(ChannelHistogram lightnessHistogram, QVector< ChannelHistogram > &channelsHistograms, qreal shadowsClipping, qreal highlightsClipping, qreal maximumInputBlackAndWhiteOffset, MidtonesAdjustmentMethod midtonesAdjustmentMethod, qreal midtonesAdjustmentAmount, const QVector< qreal > &outputBlackPoints, const QVector< qreal > &outputWhitePoints, const QVector< qreal > &outputMidtones)
Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and whit...
QVector< KisLevelsCurve > adjustPerChannelContrast(QVector< ChannelHistogram > &channelsHistograms, qreal shadowsClipping, qreal highlightsClipping, qreal maximumInputBlackAndWhiteOffset, MidtonesAdjustmentMethod midtonesAdjustmentMethod, qreal midtonesAdjustmentAmount, const QVector< qreal > &outputBlackPoints, const QVector< qreal > &outputWhitePoints, const QVector< qreal > &outputMidtones)
Creates a KisLevelsCurve for every channel in "channelsHistograms". Computes the input black and whit...
MidtonesAdjustmentMethod
The different methods to enhance the mid tones.
@ MidtonesAdjustmentMethod_None
@ MidtonesAdjustmentMethod_UseMedian
@ MidtonesAdjustmentMethod_UseMean
qreal getGamma(qreal blackPoint, qreal whitePoint, qreal inputIntensity, qreal outputIntensity)
Computes a gamma value that "moves" the input midpoint towards the output midpoint.
QPair< qreal, qreal > getInputBlackAndWhitePoints(ChannelHistogram histogram, qreal shadowsClipping, qreal highlightsClipping)
Takes a reference histogram (luma, lightness) and computes the black and white points to maximize the...
ShadowsAndHighlightsAdjustmentMethod
The different methods to enhance the contrast.
@ ShadowsAndHighlightsAdjustmentMethod_PerChannelContrast
@ ShadowsAndHighlightsAdjustmentMethod_MonochromaticContrast
Convenience class that associates a KisHistogram and a channel index. This is useful because setting ...