QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Contains operations and filters which apply to QImages. More...
#include <qgsimageoperation.h>
Classes | |
struct | DistanceTransformProperties |
Struct for storing properties of a distance transform operation. More... | |
Public Types | |
enum | FlipType { FlipHorizontal, FlipVertical } |
Flip operation types. More... | |
enum | GrayscaleMode { GrayscaleLightness, GrayscaleLuminosity, GrayscaleAverage, GrayscaleOff } |
Modes for converting a QImage to grayscale. More... | |
Static Public Member Functions | |
static void | adjustBrightnessContrast (QImage &image, const int brightness, const double contrast) |
Alter the brightness or contrast of a QImage. More... | |
static void | adjustHueSaturation (QImage &image, const double saturation, const QColor &colorizeColor=QColor(), const double colorizeStrength=1.0) |
Alter the hue or saturation of a QImage. More... | |
static void | convertToGrayscale (QImage &image, const GrayscaleMode mode=GrayscaleLuminosity) |
Convert a QImage to a grayscale image. More... | |
static QImage | cropTransparent (const QImage &image, QSize minSize=QSize(), bool center=false) |
Crop any transparent border from around an image. More... | |
static void | distanceTransform (QImage &image, const DistanceTransformProperties &properties) |
Performs a distance transform on the source image and shades the result using a color ramp. More... | |
static void | flipImage (QImage &image, FlipType type) |
Flips an image horizontally or vertically. More... | |
static QImage * | gaussianBlur (QImage &image, const int radius) |
Performs a gaussian blur on an image. More... | |
static void | multiplyOpacity (QImage &image, const double factor) |
Multiplies opacity of image pixel values by a factor. More... | |
static QRect | nonTransparentImageRect (const QImage &image, QSize minSize=QSize(), bool center=false) |
Calculates the non-transparent region of an image. More... | |
static void | overlayColor (QImage &image, const QColor &color) |
Overlays a color onto an image. More... | |
static void | stackBlur (QImage &image, const int radius, const bool alphaOnly=false) |
Performs a stack blur on an image. More... | |
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.
Definition at line 41 of file qgsimageoperation.h.
Flip operation types.
Enumerator | |
---|---|
FlipHorizontal | flip the image horizontally |
FlipVertical | flip the image vertically |
Definition at line 58 of file qgsimageoperation.h.
Modes for converting a QImage to grayscale.
Definition at line 48 of file qgsimageoperation.h.
|
static |
Alter the brightness or contrast of a QImage.
image | QImage to alter |
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. |
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. |
Definition at line 246 of file qgsimageoperation.cpp.
|
static |
Alter the hue or saturation of a QImage.
image | QImage to alter |
saturation | double between 0 and 2 inclusive, where 0 = desaturate and 1.0 = no change |
colorizeColor | color to use for colorizing image. Set to an invalid QColor to disable colorization. |
colorizeStrength | double between 0 and 1, where 0 = no colorization and 1.0 = full colorization |
Definition at line 269 of file qgsimageoperation.cpp.
|
static |
Convert a QImage to a grayscale image.
Alpha channel is preserved.
image | QImage to convert |
mode | mode to use during grayscale conversion |
Definition at line 186 of file qgsimageoperation.cpp.
|
static |
Crop any transparent border from around an image.
image | source image |
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. |
center | cropped image will be centered on the center of the original image if set to true |
Definition at line 849 of file qgsimageoperation.cpp.
|
static |
Performs a distance transform on the source image and shades the result using a color ramp.
image | QImage to alter |
properties | DistanceTransformProperties object with parameters for the distance transform operation |
Definition at line 372 of file qgsimageoperation.cpp.
|
static |
Flips an image horizontally or vertically.
image | QImage to flip |
type | type of flip to perform (horizontal or vertical) |
Definition at line 794 of file qgsimageoperation.cpp.
Performs a gaussian blur on an image.
Gaussian blur is slower but results in a high quality blur.
image | QImage to blur |
radius | blur radius in pixels |
Definition at line 630 of file qgsimageoperation.cpp.
|
static |
Multiplies opacity of image pixel values by a factor.
image | QImage to alter |
factor | factor to multiple pixel's opacity by |
Definition at line 323 of file qgsimageoperation.cpp.
|
static |
Calculates the non-transparent region of an image.
image | source image |
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. |
center | return rectangle will be centered on the center of the original image if set to true |
Definition at line 800 of file qgsimageoperation.cpp.
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.
image | QImage to alter |
color | color to overlay (any alpha component of the color is ignored) |
Definition at line 357 of file qgsimageoperation.cpp.
|
static |
Performs a stack blur on an image.
Stack blur represents a good balance between speed and blur quality.
image | QImage to blur |
radius | blur radius in pixels, maximum value of 16 |
alphaOnly | set to true to blur only the alpha component of the image |
Definition at line 559 of file qgsimageoperation.cpp.