-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
GmicQtHost.h
102 lines (93 loc) · 3.89 KB
/
GmicQtHost.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/** -*- mode: c++ ; c-basic-offset: 2 -*-
*
* @file GmicQtHost.h
*
* Copyright 2017 Sebastien Fourey
*
* This file is part of G'MIC-Qt, a generic plug-in for raster graphics
* editors, offering hundreds of filters thanks to the underlying G'MIC
* image processing framework.
*
* gmic_qt is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gmic_qt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gmic_qt. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GMIC_QT_HOST_H
#define GMIC_QT_HOST_H
#include <QString>
#include "GmicQt.h"
namespace gmic_library
{
template <typename T> struct gmic_image;
template <typename T> struct gmic_list;
} // namespace gmic_library
namespace GmicQtHost
{
extern const QString ApplicationName;
extern const char * const ApplicationShortname;
extern const bool DarkThemeIsDefault;
/**
* @brief Get the largest width and largest height among all the layers according to the input mode (\see GmicQt.h).
*
* @param[out] width
* @param[out] height
*/
void getLayersExtent(int * width, int * height, GmicQt::InputMode);
/**
* @brief Get a list of (cropped) image layers from host software.
*
* Caution: returned images should contain "entire pixels" with respect to
* to the normalized coordinates. Hence, integer coordinates should be computed
* as (x,y,w,h) with :
* x = static_cast<int>(std::floor(x * input_image_width));
* w = std::min(input_image_width - x,static_cast<int>(1+std::ceil(width * input_image_width)));
*
* @param[out] images list
* @param[out] imageNames Per layer description strings (position, opacity, etc.)
* @param x Top-left corner normalized x coordinate w.r.t. image/extends width (i.e., in [0,1])
* @param y Top-left corner normalized y coordinate w.r.t. image/extends width (i.e., in [0,1])
* @param width Normalized width of the layers w.r.t. image/extends width
* @param height Normalized height of the layers w.r.t. image/extends height
* @param mode Input mode
*/
void getCroppedImages(gmic_library::gmic_list<gmic_pixel_type> & images, //
gmic_library::gmic_list<char> & imageNames, //
double x, //
double y, //
double width, //
double height, //
GmicQt::InputMode mode);
/**
* @brief Send a list of new image layers to the host application according to an output mode (\see GmicQt.h)
*
* @param images List of layers to be sent to the host application. May be modified.
* @param imageNames Layers labels
* @param mode Output mode (\see GmicQt.h)
*/
void outputImages(gmic_library::gmic_list<gmic_pixel_type> & images, const gmic_library::gmic_list<char> & imageNames, GmicQt::OutputMode mode);
/**
* @brief Apply a color profile to a given image
*
* @param [in,out] images An image
*/
void applyColorProfile(gmic_library::gmic_image<gmic_pixel_type> & images);
/**
* @brief Display a message in the host application.
* This function is only used if the plugin is launched using the UserInterfaceMode::Silent mode.
* If a given plugin implementation never calls the latter function, show_message() can do nothing!
*
* @param message A message to be displayed by the host application
*/
void showMessage(const char * message);
} // namespace GmicQtHost
#endif // GMIC_QT_HOST_H