QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Static Public Member Functions | List of all members
QgsImageOperation Class Reference

Contains operations and filters which apply to QImages. More...

#include <qgsimageoperation.h>

Classes

class  BrightnessContrastPixelOperation
class  ConvertToArrayPixelOperation
struct  DistanceTransformProperties
 Struct for storing properties of a distance transform operation. More...
class  FlipLineOperation
class  GaussianBlurOperation
class  GrayscalePixelOperation
class  HueSaturationPixelOperation
struct  ImageBlock
class  MultiplyOpacityPixelOperation
struct  ProcessBlockUsingLineOperation
struct  ProcessBlockUsingPixelOperation
class  ShadeFromArrayOperation
class  StackBlurLineOperation

Public Types

enum  FlipType { FlipHorizontal, FlipVertical }
 Flip operation types. More...
enum  GrayscaleMode { GrayscaleLightness, GrayscaleLuminosity, GrayscaleAverage }
 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.
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.
static void convertToGrayscale (QImage &image, const GrayscaleMode mode=GrayscaleLuminosity)
 Convert a QImage to a grayscale image.
static void distanceTransform (QImage &image, const DistanceTransformProperties &properties)
 Performs a distance transform on the source image and shades the result using a color ramp.
static void flipImage (QImage &image, FlipType type)
 Flips an image horizontally or vertically.
static QImage * gaussianBlur (QImage &image, const int radius)
 Performs a gaussian blur on an image.
static void multiplyOpacity (QImage &image, const double factor)
 Multiplies opacity of image pixel values by a factor.
static void overlayColor (QImage &image, const QColor &color)
 Overlays a color onto an image.
static void stackBlur (QImage &image, const int radius, const bool alphaOnly=false)
 Performs a stack blur on an image.

Detailed Description

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.

Note
Added in version 2.7

Definition at line 41 of file qgsimageoperation.h.

Member Enumeration Documentation

Flip operation types.

Enumerator:
FlipHorizontal 
FlipVertical 

Definition at line 57 of file qgsimageoperation.h.

Modes for converting a QImage to grayscale.

Enumerator:
GrayscaleLightness 
GrayscaleLuminosity 
GrayscaleAverage 

Definition at line 48 of file qgsimageoperation.h.

Member Function Documentation

void QgsImageOperation::adjustBrightnessContrast ( QImage &  image,
const int  brightness,
const double  contrast 
)
static

Alter the brightness or contrast of a QImage.

Parameters
imageQImage to alter
brightnessbrightness 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.
contrastcontrast 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 235 of file qgsimageoperation.cpp.

void QgsImageOperation::adjustHueSaturation ( QImage &  image,
const double  saturation,
const QColor &  colorizeColor = QColor(),
const double  colorizeStrength = 1.0 
)
static

Alter the hue or saturation of a QImage.

Parameters
imageQImage to alter
saturationdouble between 0 and 2 inclusive, where 0 = desaturate and 1.0 = no change
colorizeColorcolor to use for colorizing image. Set to an invalid QColor to disable colorization.
colorizeStrengthdouble between 0 and 1, where 0 = no colorization and 1.0 = full colorization

Definition at line 258 of file qgsimageoperation.cpp.

void QgsImageOperation::convertToGrayscale ( QImage &  image,
const GrayscaleMode  mode = GrayscaleLuminosity 
)
static

Convert a QImage to a grayscale image.

Alpha channel is preserved.

Parameters
imageQImage to convert
modemode to use during grayscale conversion

Definition at line 182 of file qgsimageoperation.cpp.

void QgsImageOperation::distanceTransform ( QImage &  image,
const DistanceTransformProperties properties 
)
static

Performs a distance transform on the source image and shades the result using a color ramp.

Parameters
imageQImage to alter
propertiesDistanceTransformProperties object with parameters for the distance transform operation

Definition at line 361 of file qgsimageoperation.cpp.

void QgsImageOperation::flipImage ( QImage &  image,
QgsImageOperation::FlipType  type 
)
static

Flips an image horizontally or vertically.

Parameters
imageQImage to flip
typetype of flip to perform (horizontal or vertical)

Definition at line 762 of file qgsimageoperation.cpp.

QImage * QgsImageOperation::gaussianBlur ( QImage &  image,
const int  radius 
)
static

Performs a gaussian blur on an image.

Gaussian blur is slower but results in a high quality blur.

Parameters
imageQImage to blur
radiusblur radius in pixels
Returns
blurred image
Note
for fastest operation, ensure the source image is ARGB32_Premultiplied

Definition at line 598 of file qgsimageoperation.cpp.

void QgsImageOperation::multiplyOpacity ( QImage &  image,
const double  factor 
)
static

Multiplies opacity of image pixel values by a factor.

Parameters
imageQImage to alter
factorfactor to multiple pixel's opacity by

Definition at line 312 of file qgsimageoperation.cpp.

void QgsImageOperation::overlayColor ( QImage &  image,
const QColor &  color 
)
static

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.

Parameters
imageQImage to alter
colorcolor to overlay (any alpha component of the color is ignored)

Definition at line 346 of file qgsimageoperation.cpp.

void QgsImageOperation::stackBlur ( QImage &  image,
const int  radius,
const bool  alphaOnly = false 
)
static

Performs a stack blur on an image.

Stack blur represents a good balance between speed and blur quality.

Parameters
imageQImage to blur
radiusblur radius in pixels, maximum value of 16
alphaOnlyset to true to blur only the alpha component of the image
Note
for fastest operation, ensure the source image is ARGB32_Premultiplied if alphaOnly is set to false, or ARGB32 if alphaOnly is true

Definition at line 527 of file qgsimageoperation.cpp.


The documentation for this class was generated from the following files: