File: qgsimageoperation.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (223 lines) | stat: -rw-r--r-- 7,903 bytes parent folder | download | duplicates (6)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/effects/qgsimageoperation.h                                 *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsImageOperation
{
%Docstring(signature="appended")
Contains operations and filters which apply to QImages

A set of optimised pixel manipulation operations and filters which can
be applied to QImages. All operations only apply to ARGB32 format
images, and it is left up to the calling procedure to ensure that any
passed images are of the correct format.

Operations are written to either modify an image in place or return a
new image, depending on which is faster for the particular operation.
%End

%TypeHeaderCode
#include "qgsimageoperation.h"
%End
  public:

    enum GrayscaleMode /BaseType=IntEnum/
    {
      GrayscaleLightness,
      GrayscaleLuminosity,
      GrayscaleAverage,
      GrayscaleOff
    };

    enum FlipType /BaseType=IntEnum/
    {
      FlipHorizontal,
      FlipVertical
    };

    static void convertToGrayscale( QImage &image, GrayscaleMode mode = GrayscaleLuminosity, QgsFeedback *feedback = 0 );
%Docstring
Convert a QImage to a grayscale image. Alpha channel is preserved.

:param image: QImage to convert
:param mode: mode to use during grayscale conversion
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)
%End

    static void adjustBrightnessContrast( QImage &image, int brightness, double contrast, QgsFeedback *feedback = 0 );
%Docstring
Alter the brightness or contrast of a QImage.

:param image: QImage to alter
:param brightness: brightness value, in the range -255 to 255. A
                   brightness value of 0 indicates no change to
                   brightness, a negative value will darken the image,
                   and a positive value will brighten the image.
:param contrast: contrast value. Must be a positive or zero value. A
                 value of 1.0 indicates no change to the contrast, a
                 value of 0 represents an image with 0 contrast, and a
                 value > 1.0 will increase the contrast of the image.
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)
%End

    static void adjustHueSaturation( QImage &image, double saturation, const QColor &colorizeColor = QColor(),
                                     double colorizeStrength = 1.0, QgsFeedback *feedback = 0 );
%Docstring
Alter the hue or saturation of a QImage.

:param image: QImage to alter
:param saturation: double between 0 and 2 inclusive, where 0 =
                   desaturate and 1.0 = no change
:param colorizeColor: color to use for colorizing image. Set to an
                      invalid QColor to disable colorization.
:param colorizeStrength: double between 0 and 1, where 0 = no
                         colorization and 1.0 = full colorization
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)
%End

    static void multiplyOpacity( QImage &image, double factor, QgsFeedback *feedback = 0 );
%Docstring
Multiplies opacity of image pixel values by a factor.

:param image: QImage to alter
:param factor: factor to multiple pixel's opacity by
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)
%End

    static void overlayColor( QImage &image, const QColor &color );
%Docstring
Overlays a color onto an image. This operation retains the alpha channel
of the original image, but replaces all image pixel colors with the
specified color.

:param image: QImage to alter
:param color: color to overlay (any alpha component of the color is
              ignored)
%End

    struct DistanceTransformProperties
    {

      bool shadeExterior;

      bool useMaxDistance;

      double spread;

      QgsColorRamp *ramp;
    };

    static void distanceTransform( QImage &image, const QgsImageOperation::DistanceTransformProperties &properties, QgsFeedback *feedback = 0 );
%Docstring
Performs a distance transform on the source image and shades the result
using a color ramp.

:param image: QImage to alter
:param properties: DistanceTransformProperties object with parameters
                   for the distance transform operation
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)
%End

    static void stackBlur( QImage &image, int radius, bool alphaOnly = false, QgsFeedback *feedback = 0 );
%Docstring
Performs a stack blur on an image. Stack blur represents a good balance
between speed and blur quality.

:param image: QImage to blur
:param radius: blur radius in pixels, maximum value of 16
:param alphaOnly: set to ``True`` to blur only the alpha component of
                  the image
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)

.. note::

   for fastest operation, ensure the source image is ARGB32_Premultiplied if
   alphaOnly is set to ``False``, or ARGB32 if alphaOnly is ``True``
%End

    static QImage *gaussianBlur( QImage &image, int radius, QgsFeedback *feedback = 0 ) /Factory/;
%Docstring
Performs a gaussian blur on an image. Gaussian blur is slower but
results in a high quality blur.

:param image: QImage to blur
:param radius: blur radius in pixels
:param feedback: optional feedback object for responsive cancellation
                 (since QGIS 3.22)

:return: blurred image

.. note::

   for fastest operation, ensure the source image is ARGB32_Premultiplied
%End

    static void flipImage( QImage &image, FlipType type );
%Docstring
Flips an image horizontally or vertically

:param image: QImage to flip
:param type: type of flip to perform (horizontal or vertical)
%End

    static QRect nonTransparentImageRect( const QImage &image, QSize minSize = QSize(), bool center = false );
%Docstring
Calculates the non-transparent region of an image.

:param image: source image
:param minSize: minimum size for returned region, if desired. If the
                non-transparent region of the image is smaller than this
                minimum size, it will be centered in the returned
                rectangle.
:param center: return rectangle will be centered on the center of the
               original image if set to ``True``

.. seealso:: :py:func:`cropTransparent`
%End

    static QImage cropTransparent( const QImage &image, QSize minSize = QSize(), bool center = false );
%Docstring
Crop any transparent border from around an image.

:param image: source image
:param minSize: minimum size for cropped image, if desired. If the
                cropped image is smaller than the minimum size, it will
                be centered in the returned image.
:param center: cropped image will be centered on the center of the
               original image if set to ``True``
%End

      public:
      public:
      public:
      public:
      public:
      public:
      public:
      public:
      public:
};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/effects/qgsimageoperation.h                                 *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/