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

ImageResource is a variant of three types - QImage, CubeTexture and VolumeTexture. More...

Public Types

enum  Type { Type::Invalid, Type::Image, Type::CubeTexture, Type::VolumeTexture }
 This enum describes type stored in a resource. More...
 

Public Member Functions

 ImageResource () Q_DECL_NOEXCEPT
 Constructs a null resource with an invalid type.
 
 ImageResource (const QImage &image)
 Constructs resource with the given image.
 
 ImageResource (const CubeTexture &texture)
 Constructs resource with the given texture.
 
 ImageResource (const VolumeTexture &texture)
 Constructs resource with the given texture.
 
 ImageResource (const ImageResource &other)
 Copy-constructs resource from the given other resource.
 
 ImageResource (ImageResource &&other)
 Move-constructs resource from the given other resource.
 
 ~ImageResource ()
 Destroys ImageResource object.
 
ImageResourceoperator= (const ImageResource &other)
 Assigns other ImageResource to this resource.
 
ImageResourceoperator= (ImageResource &&other)
 Move-assigns other ImageResource to this resource.
 
bool isNull () const Q_DECL_NOEXCEPT
 Returns true if resource doesn't contain any data and it's type is Type::Invalid.
 
Type type () const Q_DECL_NOEXCEPT
 Returns resource type.
 
const QImage & image () const
 Returns an image contained in the resource if it's type is Type::Image, otherwise assert is triggered.
 
void setImage (const QImage &image)
 Sets data of this resource to the given image.
 
const CubeTexturecubeTexture () const
 Returns a CubeTexture contained in the resource if it's type is Type::CubeTexture, otherwise assert is triggered.
 
void setCubeTexture (const CubeTexture &texture)
 Sets data of this resource to the given texture.
 
const VolumeTexturevolumeTexture () const
 Returns a VolumeTexture contained in the resource if it's type is Type::VolumeTexture, otherwise null VolumeTexture is returned.
 
void setVolumeTexture (const VolumeTexture &texture)
 Sets data of this resource to the given texture.
 

Friends

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

Detailed Description

ImageResource is a variant of three types - QImage, CubeTexture and VolumeTexture.

Member Enumeration Documentation

◆ Type

enum ImageResource::Type
strong

This enum describes type stored in a resource.

Enumerator
Invalid 

Resource contains no data.

Image 

Resource contains a QImage.

CubeTexture 

Resource contains a CubeTexture.

VolumeTexture 

Resource contains a VolumeTexture.