The XML image resource class. More...

#include "murl_resource_xml_image.h"

Inheritance diagram for Murl::Resource::XmlImage:

Additional Inherited Members

- Public Types inherited from Murl::IFactoryObject< IObject >
using ClassInfoArray = Array< const ClassInfo * >
 Definition of an array of ClassInfo objects.
- Public Member Functions inherited from Murl::Resource::IObject
virtual Bool GetFileDependencies (Array< String > &fileNames) const =0
 Fill a given string array with names of files the resource depends on. More...
- Public Member Functions inherited from Murl::IFactoryObject< IObject >
 ~IFactoryObject () override
 The destructor.
virtual const ClassInfo * GetObjectClassInfo () const=0
 Get the object instance's class info, if present. More...
virtual void ResetObjectProperties ()=0
 Reset the object instance's properties to their default values.
- Public Member Functions inherited from Murl::Resource::IImage
virtual IObjectGetObjectInterface ()=0
 Get the mutable Resource::IObject interface. More...
virtual const IObjectGetObjectInterface () const =0
 Get the constant Resource::IObject interface. More...
- Static Public Member Functions inherited from Murl::IFactoryObject< IObject >
static const PropertyInfoGetPropertyInfo ()
 Get the class' property info struct. More...
static const AttributeInfoGetAttributeInfo ()
 Get the class' attribute info struct. More...
static void ResetProperties (IFactoryObject< IObject > *object)
 Reset an object instance's properties to their default values. More...

Detailed Description

The XML image resource class.

XML image resources can be used as a convenient way to shuffle and mix color channels from a given set of actual input image files to a resulting output image resource, for example to pack as many information into a single texture to save resources and/or shader execution cycles.

An XML image file is recognized by its <Image> root element. The root element accepts the following attributes:

  • sizeX, sizeY: As long as all input images (see below) share the same dimensions, these attributes are both optional, and the resulting output image dimensions are taken from the input images. Otherwise, both attributes must be explicitly set to non-zero values for the output image size.

The only allowed child element of an <Image> element is the <MipLevel> element, which accepts the following attribute:

  • index: The zero-based MIP level index. A value of 0 represents the base level, i.e. the most detailed one. Note: Currently only MIP level 0 is supported.

Within a <MipLevel> element, the first accepted element is the <Source> element, which defines an input image. It accepts the following attributes:

  • id: The ID of the input image by which it is referenced via a <Destination> element below.
  • imageFileName: The actual file name of the input image, relative to the XML image resource file itself.

The second accepted element is the <Destination> element, which defines the actual source for each of the four output image color channels. The following attributes are accepted:

  • destinationComponent: A string value from the IEnums::ColorComponent enumeration specifying the output color channel, either "RED", "GREEN", "BLUE" or "ALPHA".
  • sourceId: The ID of an input image defined via a <Source> element above.
  • sourceComponent: The color component of the referenced source image to extract for this output channel.

Example of an XML image file:

<?xml version="1.0" ?>
<Image sizeX="64" sizeY="64">
<MipLevel index="0">
<!-- Define the input images -->
<Source id="img1" imageFileName="image1.png"/>
<Source id="img2" imageFileName="image2.png"/>
<!-- Reverse RGB channels from img1 and put them into the output image (as BGR) -->
<Destination destinationComponent="RED" sourceId="img1" sourceComponent="BLUE"/>
<Destination destinationComponent="GREEN" sourceId="img1" sourceComponent="GREEN"/>
<Destination destinationComponent="BLUE" sourceId="img1" sourceComponent="RED"/>
<!-- Insert the red channel from img2 into the alpha channel of the output image -->
<Destination destinationComponent="ALPHA" sourceId="img2" sourceComponent="RED"/>

Use the <Resource> tag in a .murlres package's resource.xml file to specify an XML image resource. See Resource::Object.

The documentation for this class was generated from the following file:
  • murl_resource_xml_image.h

Copyright © 2011-2024 Spraylight GmbH.