Image Formats NG
Public Types | Public Member Functions | Properties | Friends | List of all members
ImageOptions Class Reference

This class describes the different options supported by ImageIO. More...

Public Types

enum  Option {
  ClipRect, ScaledSize, ScaledClipRect, InputQuality,
  BackgroundColor , CompressionRatio, Gamma, Quality
}
 This enum describes possible options. More...
 

Public Member Functions

 ImageOptions ()
 Creates an empty ImageOptions() object.
 
 ImageOptions (const ImageOptions &other)
 Copy-constructs an ImageOptions object.
 
 ImageOptions (ImageOptions &&other)
 Move-constructs an ImageOptions object.
 
 ~ImageOptions ()
 Destroys the ImageOptions object.
 
ImageOptionsoperator= (const ImageOptions &other)
 Assigns other ImageOptions to this result.
 
ImageOptionsoperator= (ImageOptions &&other)
 Move-assigns other ImageOptions to this result.
 
bool isEmpty () const
 Returns true if no options are set.
 
bool contains (Option option) const
 Returns true if the given option is set.
 
void remove (Option option)
 Unsets the value for the given option.
 
int inputQuality (int defaultValue=100) const
 Returns the value of the InputQuality option if it is set or the defaultValue otherwise.
 
int compression (int defaultValue=0) const
 Returns the value of the CompressionRatio option if it is set or the defaultValue otherwise.
 
float gamma (float defaultValue=0.0) const
 Returns the value of the Gamma option if it is set or the defaultValue otherwise.
 
void swap (ImageOptions &other) Q_DECL_NOEXCEPT
 Swaps other options with this options. More...
 

Properties

QRect clipRect
 The clip rect, or ROI (Region Of Interest). More...
 
QSize scaledSize
 The scaled size of the image. More...
 
QRect scaledCliptRect
 The scaled clip rect (or ROI, Region Of Interest) of the image. More...
 
int inputQuality
 The input quality level of the image. More...
 
QColor backgroundColor
 Certain image formats allow the background color to be specified. More...
 
bool skipMipmaps
 If handler supports this option, it can be used to skip reading mipmaps. More...
 
int compression
 The compression ratio of the image data. More...
 
float gamma
 The gamma level of the image. More...
 
int quality
 The quality level of the image. More...
 

Friends

bool IMAGEFORMATSNG_EXPORT operator== (const ImageOptions &lhs, const ImageOptions &rhs)
 Returns true if the lhs options and the rhs options have the same contents; otherwise returns false.
 
bool IMAGEFORMATSNG_EXPORT operator!= (const ImageOptions &lhs, const ImageOptions &rhs)
 Returns true if the lhs options and the rhs options have different contents; otherwise returns false.
 

Detailed Description

This class describes the different options supported by ImageIO.

Some options are used to modify how the image is read, and others are used to toggle the way in which an image should be written.

Member Enumeration Documentation

◆ Option

This enum describes possible options.

Enumerator
ClipRect 
See also
ImageOptions::clipRect
ScaledSize 
See also
ImageOptions::scaledSize
ScaledClipRect 
See also
ImageOptions::scaledCliptRect
InputQuality 
See also
ImageOptions::inputQuality
BackgroundColor 
See also
ImageOptions::backgroundColor
CompressionRatio 
See also
ImageOptions::compression
Gamma 
See also
ImageOptions::gamma
Quality 
See also
ImageOptions::quality

Member Function Documentation

◆ swap()

void ImageOptions::swap ( ImageOptions other)
inline

Swaps other options with this options.

This operation is very fast and never fails.

Property Documentation

◆ backgroundColor

QColor ImageOptions::backgroundColor
readwrite

Certain image formats allow the background color to be specified.

A handler that supports BackgroundColor initializes the background color to this option when reading an image.

◆ clipRect

QRect ImageOptions::clipRect
readwrite

The clip rect, or ROI (Region Of Interest).

A handler that supports this option is expected to only read the provided QRect area from the original image in read(), before any other transformation is applied. If the handler does not support this option, ImageIO will perform the clipping after the image has been read.

◆ compression

ImageOptions::compression
readwrite

The compression ratio of the image data.

A handler that supports this option is expected to set its compression rate depending on the value of this option when writing.

◆ gamma

ImageOptions::gamma
readwrite

The gamma level of the image.

A handler that supports this option is expected to set the image gamma level depending on the value of this option when writing.

◆ inputQuality

ImageOptions::inputQuality
readwrite

The input quality level of the image.

This option can be used to speed up reading of the image in a cost of quality. If handler supports this option, it can use use faster transforming/scaling/decompression algorithms when reading image.

This value should be in range [0..100].

◆ quality

ImageOptions::quality
readwrite

The quality level of the image.

A handler that supports this option is expected to set the image quality level depending on the value of this option when writing.

◆ scaledCliptRect

QRect ImageOptions::scaledCliptRect
readwrite

The scaled clip rect (or ROI, Region Of Interest) of the image.

A handler that supports this option is expected to apply the provided clip rect (a QRect), after applying any scaling (ScaleSize) or regular clipping (ClipRect). If the handler does not support this option, ImageIO will apply the scaled clip rect after the image has been read.

◆ scaledSize

QSize ImageOptions::scaledSize
readwrite

The scaled size of the image.

A handler that supports this option is expected to scale the image to the provided size (a QSize), after applying any clip rect transformation (ClipRect). If the handler does not support this option, ImageIO will perform the scaling after the image has been read.

◆ skipMipmaps

bool ImageOptions::skipMipmaps
readwrite

If handler supports this option, it can be used to skip reading mipmaps.

Default value is false.