Image

class HPS::Image

The Image class contains objects for importing image files and enumerations used when defining images in Visualize.

Public Types

enum Format

Enumerates the various image formats that Visualize supports.

Values:

enumerator RGB

Uncompressed, one unsigned byte per channel, three unsigned bytes per pixel, RGB order.

enumerator RGBA

Uncompressed, one unsigned byte per channel, four unsigned bytes per pixel, RGBA order.

enumerator ARGB

Uncompressed, one unsigned byte per channel, four unsigned bytes per pixel, ARGB order.

enumerator Mapped8

Uncompressed, one unsigned byte per pixel, each unsigned byte is an index into a material palette.

enumerator Grayscale

Uncompressed, one unsigned byte per pixel.

enumerator Bmp

Uncompressed, 1bpp (Mono), 8 bpp (Greyscale), 16 bpp (ARGB/RGB), 24bpp (RGB), 32bpp (ARGB).

enumerator Jpeg

Compressed, JPEG format.

enumerator Png

Compressed, PNG format.

enumerator Targa

Compressed, TARGA Format.

enumerator DXT1

Compressed, DXT1 Format.

enumerator DXT3

Compressed, DXT3 Format.

enumerator DXT5

Compressed, DXT5 Format.

class ExportOptionsKit : public HPS::Kit

The HPS::Image::ExportOptionsKit class contains options that will be used to export image files. Calling HPS::Image::ExportOptionsKit::GetDefault() will return an options kit with values found in this table.

Public Functions

virtual bool Empty() const

Indicates whether this ExportOptionsKit has any values set on it.

Returns

true if no values are set on this ExportOptionsKit, false otherwise.

bool Equals(ExportOptionsKit const &in_kit) const

Check if the source ExportOptionsKit is equivalent to this ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to compare to this ExportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

ExportOptionsKit()

The default constructor creates an empty ExportOptionsKit object.

ExportOptionsKit(ExportOptionsKit &&in_that)

The move constructor creates an ExportOptionsKit by transferring the underlying impl of the rvalue reference to this ExportOptionsKit thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to an ExportOptionsKit to take the impl from.

ExportOptionsKit(ExportOptionsKit const &in_kit)

The copy constructor creates a new ExportOptionsKit object that contains the same settings as the source ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

bool operator!=(ExportOptionsKit const &in_kit) const

Check if the source ExportOptionsKit is not equivalent to this ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to compare to this ExportOptionsKit.

Returns

true if the objects are not equivalent, false otherwise.

ExportOptionsKit &operator=(ExportOptionsKit &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this ExportOptionsKit thereby avoiding a copy.

Parameters

in_that – An rvalue reference to an ExportOptionsKit to take the impl from.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &operator=(ExportOptionsKit const &in_kit)

Copies the source ExportOptionsKit into this ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to copy.

Returns

A reference to this ExportOptionsKit.

bool operator==(ExportOptionsKit const &in_kit) const

Check if the source ExportOptionsKit is equivalent to this ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to compare to this ExportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

void Set(ExportOptionsKit const &in_kit)

Copies the source ExportOptionsKit into this ExportOptionsKit.

Parameters

in_kit – The source ExportOptionsKit to copy.

ExportOptionsKit &SetFormat(Image::Format in_format)

Sets the format of the image. This must be specified when exporting any image.

See

Export format default value

Parameters

in_format – The format of the image.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &SetSize(unsigned int in_width, unsigned int in_height)

Sets the width and height (in pixels) of the image. If this is not specified , an exception will be thrown on export.

Parameters
  • in_width – The width (in pixels) of the image.

  • in_height – The height (in pixels) of the image.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &SetTransparentBackground(bool in_state)

Sets whether the image background will be transparent. This setting is only valid when exporting a PNG image.

Parameters

in_state – Whether the image background will be transparent.

Returns

A reference to this ExportOptionsKit.

void Show(ExportOptionsKit &out_kit) const

Copies this ExportOptionsKit into the given ExportOptionsKit.

Parameters

out_kit – The ExportOptionsKit to populate with the contents of this ExportOptionsKit.

bool ShowFormat(Image::Format &out_format) const

Shows the format of the image.

Parameters

out_format – The format of the image.

Returns

true if the format is valid, false otherwise.

bool ShowSize(unsigned int &out_width, unsigned int &out_height) const

Shows the width and height (in pixels) of the image.

Parameters
  • out_width – The width (in pixels) of the image.

  • out_height – The height (in pixels) of the image.

Returns

true if the width and height are valid, false otherwise.

bool ShowTransparentBackground(bool &out_state) const

Shows transparent background setting for this image

Parameters

out_state – The transparent background setting for this image.

Returns

true if a background preference was specified, false otherwise.

ExportOptionsKit &UnsetEverything()

Removes all settings from this ExportOptionsKit.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &UnsetFormat()

Removes the format of the image.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &UnsetSize()

Removes the width and height of the image.

Returns

A reference to this ExportOptionsKit.

ExportOptionsKit &UnsetTransparentBackground()

Removes the transparent background setting of the image.

Returns

A reference to this ExportOptionsKit.

virtual ~ExportOptionsKit()

Public Static Functions

static ExportOptionsKit GetDefault()

Creates a ExportOptionsKit which contains the default settings. The returned object will not necessarily have values set for every option, but it will have settings for those options where it is reasonable to have a default.

Returns

A ExportOptionsKit with the default settings.

Public Static Attributes

static const HPS::Type staticType = HPS::Type::ImageExportOptionsKit
class File

The File class provides a function to import and export image files.

Public Static Functions

static void Export(char const *in_file_name, HPS::ImageKit const &in_image_kit)

Performs a synchronous export to an image from the specified ImageKit May throw an exception if a problem occurs during export, or if the image kit provided is incomplete

Parameters
  • in_file_name – Name of image file to which to save the data.

  • in_image_kitImageKit containing the data, size and format of the image to be exported

static void Export(char const *in_file_name, HPS::WindowKey const &in_window, ExportOptionsKit const &in_options)

Performs a synchronous export to an image of the specified window. May throw an IOException if a problem occurs during export.

Parameters
  • in_file_name – Name of image file to which to save the data.

  • in_window – The WindowKey where the screen-shot will be taken

  • in_options – Options to use during export. If the option does not have size defined the size of in_window is used.

static void Export(char const *in_file_name, HPS::WindowKey const &in_window, unsigned int in_width, unsigned int in_height, Format in_format = Format::Png, bool in_transparent_background = false)

Performs a synchronous export to an image of the specified window. May throw an IOException if a problem occurs during export.

Parameters
  • in_file_name – Name of image file to which to save the data.

  • in_window – The WindowKey where the screen-shot will be taken

  • in_width – The width of the exported image, in pixels

  • in_height – The height of the exported image, in pixels

  • in_format – The format of the exported image, defaults to PNG

  • in_transparent_background – Whether to render the background as transparent. Only valid if in_format is PNG. Defaults to false.

static ImageKit Import(char const *in_file_name, ImportOptionsKit const &in_options)

Performs a synchronous import of the specified image file. The function returns an ImageKit with the data from the image file and with the specified options. May throw an IOException if a problem occurs during import.

Parameters
  • in_file_name – Name of image file from which to get the data.

  • in_options – Options to use during import and to set on the ImageKit returned by this function.

Returns

An ImageKit containing the data from the specified file and with the specified options.

class ImportOptionsKit : public HPS::Kit

The ImportOptionsKit class contains options that will be used to import image files and will be set on the ImageKit returned by File::Import.

Public Functions

virtual bool Empty() const

Indicates whether this ImportOptionsKit has any values set on it.

Returns

true if no values are set on this ImportOptionsKit, false otherwise.

bool Equals(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

ImportOptionsKit()

The default constructor creates an empty ImportOptionsKit object.

ImportOptionsKit(ImportOptionsKit &&in_that)

The move constructor creates an ImportOptionsKit by transferring the underlying impl of the rvalue reference to this ImportOptionsKit thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to an ImportOptionsKit to take the impl from.

ImportOptionsKit(ImportOptionsKit const &in_kit)

The copy constructor creates a new ImportOptionsKit object that contains the same settings as the source ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

bool operator!=(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is not equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are not equivalent, false otherwise.

ImportOptionsKit &operator=(ImportOptionsKit &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this ImportOptionsKit thereby avoiding a copy.

Parameters

in_that – An rvalue reference to an ImportOptionsKit to take the impl from.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &operator=(ImportOptionsKit const &in_kit)

Copies the source ImportOptionsKit into this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

Returns

A reference to this ImportOptionsKit.

bool operator==(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

void Set(ImportOptionsKit const &in_kit)

Copies the source ImportOptionsKit into this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

ImportOptionsKit &SetCompressionQuality(float in_quality)

Sets the compression quality for the image. This setting will be copied over to the ImageKit returned from File::Import. It doesn’t need to be set for the import to succeed.

Parameters

in_quality – The compression quality for the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetDownSampling(bool in_state)

Sets whether to down-sample the image. This setting will be copied over to the ImageKit returned from File::Import. It doesn’t need to be set for the import to succeed.

Parameters

in_state – Whether to down-sample the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetFormat(Image::Format in_format)

Sets the format of the image. This must be specified when importing any image.

Parameters

in_format – The format of the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetSize(unsigned int in_width, unsigned int in_height)

Sets the width and height (in pixels) of the image. This does not need to be set when importing image files which contain this information (i.e., Image::Jpeg, Image::Png or Image::Targa). If this is not specified for images files which do not contain this information, an exception will be thrown on import.

Parameters
  • in_width – The width (in pixels) of the image.

  • in_height – The height (in pixels) of the image.

Returns

A reference to this ImportOptionsKit.

void Show(ImportOptionsKit &out_kit) const

Copies this ImportOptionsKit into the given ImportOptionsKit.

Parameters

out_kit – The ImportOptionsKit to populate with the contents of this ImportOptionsKit.

bool ShowCompressionQuality(float &out_quality) const

Shows the compression quality for the image.

Parameters

out_quality – The compression quality for the image.

Returns

true if the compression quality is valid, false otherwise.

bool ShowDownSampling(bool &out_state) const

Shows whether to down-sample the image.

Parameters

out_state – whether to down-sample the image.

Returns

true if the flag is valid, false otherwise.

bool ShowFormat(Image::Format &out_format) const

Shows the format of the image.

Parameters

out_format – The format of the image.

Returns

true if the format is valid, false otherwise.

bool ShowSize(unsigned int &out_width, unsigned int &out_height) const

Shows the width and height (in pixels) of the image.

Parameters
  • out_width – The width (in pixels) of the image.

  • out_height – The height (in pixels) of the image.

Returns

true if the width and height are valid, false otherwise.

ImportOptionsKit &UnsetCompressionQuality()

Removes the compression quality for the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetDownSampling()

Removes whether to down-sample the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetEverything()

Removes all settings from this ImportOptionsKit.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetFormat()

Removes the format of the image.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetSize()

Removes the width and height of the image.

Returns

A reference to this ImportOptionsKit.

virtual ~ImportOptionsKit()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::ImageImportOptionsKit