|
Awesome Portable Rendering Interface Library
This library provides a universal rendering API and does not require to write code that is used in only one API (e.g. OpenGL, DirectX, SDL, ...)
|
Defines a generic image data source. More...
#include <Image.h>
Classes | |
| class | FileFormat |
| Creates the default parameters for the given Format. More... | |
| class | Format |
| Gets the BPP. More... | |
Public Types | |
| typedef hmap< hstr, hstr > | SaveParameters |
| Required typedef due to macro expansions. | |
Public Member Functions | |
| virtual | ~Image () |
| Destructor. | |
| int | getBpp () const |
| Gets the byte-per-pixel value. More... | |
| int | getByteSize () const |
| Gets the size of the image data in bytes. More... | |
| bool | isValid () const |
| Checks if the image is a valid image data construct with appropriate meta data. More... | |
| bool | clear () |
| Clears the entire image and sets all image data to zeroes. More... | |
| Color | getPixel (int x, int y) const |
| Gets the color of a specific pixel. More... | |
| bool | setPixel (int x, int y, const Color &color) |
| Sets the color of a specific pixel. More... | |
| Color | getInterpolatedPixel (float x, float y) const |
| Gets the linearly interpolated color between two pixels. More... | |
| bool | fillRect (int x, int y, int w, int h, const april::Color &color) |
| Fills a rectangle area with one color. More... | |
| bool | blitRect (int x, int y, int w, int h, const april::Color &color) |
| Blits a rectangle area with one color. More... | |
| bool | copyPixelData (unsigned char **output, Format format) const |
| Copies the image data into a buffer. More... | |
| bool | write (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Writes image data directly onto the image. More... | |
| bool | writeStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated. More... | |
| bool | blit (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char alpha=255) |
| Does an image data block transfer onto the image. More... | |
| bool | blitStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char alpha=255) |
| Does a stretched image data block transfer onto the image. More... | |
| bool | rotateHue (int x, int y, int w, int h, float degrees) |
| Rotates the pixel hue of a rectangle area on the image. More... | |
| bool | saturate (int x, int y, int w, int h, float factor) |
| Changes the saturation level of pixels of a rectangle area on the image. More... | |
| bool | invert (int x, int y, int w, int h) |
| Inverts the pixel colors of a rectangle area on the image. More... | |
| bool | insertAlphaMap (unsigned char *srcData, Format srcFormat, unsigned char median, int ambiguity) |
| Inserts image data as alpha channel into this image. More... | |
| bool | dilate (unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Dilates the image. More... | |
| Image * | extractRed () const |
| Extracts the red color channel of the image. More... | |
| Image * | extractGreen () const |
| Extracts the greeb color channel of the image. More... | |
| Image * | extractBlue () const |
| Extracts the blue color channel of the image. More... | |
| Image * | extractAlpha () const |
| Extracts the alpha channel of the image. More... | |
| Image * | extractColor (int index) const |
| Extracts the color channel at the given index of the image. More... | |
| Color | getPixel (cgvec2i position) const |
| Gets the color of a specific pixel. More... | |
| bool | setPixel (cgvec2i position, const Color &color) |
| Sets the color of a specific pixel. More... | |
| Color | getInterpolatedPixel (cgvec2f position) const |
| Gets the linearly interpolated color between two pixels. More... | |
| bool | fillRect (cgrecti rect, const Color &color) |
| Fills a rectangle area with one color. More... | |
| bool | blitRect (cgrecti rect, const Color &color) |
| Blits a rectangle area with one color. More... | |
| bool | copyPixelData (unsigned char **output) const |
| Copies the image data into a buffer. More... | |
| bool | write (int sx, int sy, int sw, int sh, int dx, int dy, Image *other) |
| Writes image data directly onto the image. More... | |
| bool | write (cgrecti srcRect, cgvec2i destPosition, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Writes image data directly onto the image. More... | |
| bool | write (cgrecti srcRect, cgvec2i destPosition, Image *other) |
| Writes image data directly onto the image. More... | |
| bool | writeStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, Image *other) |
| Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated. More... | |
| bool | writeStretch (cgrecti srcRect, cgrecti destRect, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated. More... | |
| bool | writeStretch (cgrecti srcRect, cgrecti destRect, Image *other) |
| Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated. More... | |
| bool | blit (int sx, int sy, int sw, int sh, int dx, int dy, Image *other, unsigned char alpha=255) |
| Does an image data block transfer onto the image. More... | |
| bool | blit (cgrecti srcRect, cgvec2i destPosition, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char alpha=255) |
| Does an image data block transfer onto the image. More... | |
| bool | blit (cgrecti srcRect, cgvec2i destPosition, Image *other, unsigned char alpha=255) |
| Does an image data block transfer onto the image. More... | |
| bool | blitStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, Image *other, unsigned char alpha=255) |
| Does a stretched image data block transfer onto the image. More... | |
| bool | blitStretch (cgrecti srcRect, cgrecti destRect, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char alpha=255) |
| Does a stretched image data block transfer onto the image. More... | |
| bool | blitStretch (cgrecti srcRect, cgrecti destRect, Image *other, unsigned char alpha=255) |
| Does a stretched image data block transfer onto the image. More... | |
| bool | rotateHue (cgrecti rect, float degrees) |
| Rotates the pixel hue of a rectangle area on the image. More... | |
| bool | saturate (cgrecti rect, float factor) |
| Changes the saturation level of pixels of a rectangle area on the image. More... | |
| bool | invert (cgrecti rect) |
| Inverts the pixel colors of a rectangle area on the image. More... | |
| bool | insertAlphaMap (unsigned char *srcData, Format srcFormat) |
| Inserts image data as alpha channel into this image. More... | |
| bool | insertAlphaMap (Image *image, unsigned char median, int ambiguity) |
| Inserts image data as alpha channel into this image. More... | |
| bool | insertAlphaMap (Image *image) |
| Inserts image data as alpha channel into this image. More... | |
| bool | dilate (Image *image) |
| Dilates the image. More... | |
Static Public Member Functions | |
| static Image * | createFromResource (chstr filename) |
| Creates an Image object from a resource file. More... | |
| static Image * | createFromResource (chstr filename, Format format) |
| Creates an Image object from a resource file. More... | |
| static Image * | createFromFile (chstr filename) |
| Creates an Image object from a file. More... | |
| static Image * | createFromFile (chstr filename, Format format) |
| Creates an Image object from a file. More... | |
| static Image * | createFromStream (hsbase &stream, chstr logicalExtension) |
| Creates an Image object from a data stream. More... | |
| static Image * | createFromStream (hsbase &stream, chstr logicalExtension, Format format) |
| Creates an Image object from a data stream. More... | |
| static Image * | create (int w, int h, unsigned char *data, Format format) |
| Creates an Image object from a raw image data. More... | |
| static Image * | create (int w, int h, const Color &color, Format format) |
| Creates an Image object filled with a single color. More... | |
| static Image * | create (Image *other) |
| Creates a deep copy of the Image object. More... | |
| static bool | save (Image *image, chstr filename, FileFormat format, SaveParameters parameters=SaveParameters(), chstr customExtension="") |
| Saves the image data in a certain file format. More... | |
| static Image * | readMetaDataFromResource (chstr filename) |
| Creates an Image without image data, but with meta-data from a resource file. More... | |
| static Image * | readMetaDataFromFile (chstr filename) |
| Creates an Image without image data, but with meta-data from a file. More... | |
| static Image * | readMetaDataFromStream (hsbase &stream, chstr logicalExtension) |
| Creates an Image without image data, but with meta-data from a data stream. More... | |
| static Color | getPixel (int x, int y, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Gets the color of a specific pixel in raw image data. More... | |
| static bool | setPixel (int x, int y, const Color &color, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Sets the color of a specific pixel in raw image data. More... | |
| static Color | getInterpolatedPixel (float x, float y, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Gets the linearly interpolated color between two pixels in raw image data. More... | |
| static bool | fillRect (int x, int y, int w, int h, const Color &color, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Fills a rectangle area with one color in raw image data. More... | |
| static bool | blitRect (int x, int y, int w, int h, const Color &color, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Blits a rectangle area with one color in raw image data. More... | |
| static bool | write (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Writes image data directly onto raw image data. More... | |
| static bool | writeStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Writes image data directly onto the raw image data while trying to stretch the pixels. Stretched pixels will be linearly interpolated. More... | |
| static bool | blit (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat, unsigned char alpha=255) |
| Does an image data block transfer onto the raw image data. More... | |
| static bool | blitStretch (int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat, unsigned char alpha=255) |
| Does a stretched image data block transfer onto the raw image data. More... | |
| static bool | rotateHue (int x, int y, int w, int h, float degrees, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Rotates the pixel hue of a rectangle area on the raw image data. More... | |
| static bool | saturate (int x, int y, int w, int h, float factor, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Changes the saturation level of pixels of a rectangle area on the raw image data. More... | |
| static bool | invert (int x, int y, int w, int h, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat) |
| Inverts the pixel colors of a rectangle area on the raw image data. More... | |
| static bool | insertAlphaMap (int w, int h, unsigned char *srcData, Format srcFormat, unsigned char *destData, Format destFormat, unsigned char median, int ambiguity) |
| Inserts raw image data as alpha channel into other raw image data. More... | |
| static bool | dilate (unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat) |
| Dilates the raw image data. More... | |
| static bool | convertToFormat (int w, int h, unsigned char *srcData, Format srcFormat, unsigned char **destData, Format destFormat, bool preventCopy=true) |
| Converts raw image data from one format into another. More... | |
| static bool | needsConversion (Format srcFormat, Format destFormat, bool preventCopy=true) |
| Checks if an image format conversion is needed. More... | |
| static bool | checkRect (int x, int y, int destWidth, int destHeight) |
| Checks if the coordinates are out of bounds. More... | |
| static bool | checkRect (int x, int y, int w, int h, int destWidth, int destHeight) |
| Checks if the rect is out of bounds. More... | |
| static bool | correctRect (int &x, int &y, int &w, int &h, int dataWidth, int dataHeight) |
| Corrects rectangle to stay in bounds of the image data. More... | |
| static bool | correctRect (int &sx, int &sy, int &sw, int &sh, int srcWidth, int srcHeight, int &dx, int &dy, int destWidth, int destHeight) |
| Corrects the source rectangle and destination coordinates to stay in bounds of the source and destination image data. More... | |
| static bool | correctRect (int &sx, int &sy, int &sw, int &sh, int srcWidth, int srcHeight, int &dx, int &dy, int &dw, int &dh, int destWidth, int destHeight) |
| Corrects source and destination rectangles to stay in bounds of the source and destination image data. More... | |
| static void | registerCustomLoader (chstr extension, Image *(*loadFunction)(hsbase &), Image *(*metaDataLoadfunction)(hsbase &)) |
| Registers a custom image loader for custom image formats. More... | |
| static void | registerCustomSaver (chstr extension, bool(*saveFunction)(hsbase &, Image *, SaveParameters), SaveParameters(*defaultParametersFunction)()=NULL) |
| Registers a custom image saver for custom image formats. More... | |
Public Attributes | |
| unsigned char * | data |
| The raw image data. | |
| int | w |
| Width of the image in pixels. | |
| int | h |
| Height of the image in pixels. | |
| Format | format |
| Pixel format of the image data. | |
| int | internalFormat |
| Internal format identifier. More... | |
| int | compressedSize |
| The byte size of the image data when handling compressed formats (e.g. FORMAT_PALETTE). | |
Protected Member Functions | |
| Image () | |
| Basic constructor. | |
| Image (const Image &other) | |
| Copy constructor. More... | |
Static Protected Member Functions | |
| static Image * | _loadPng (hsbase &stream, int size) |
| Loads and decodes PNG file data. More... | |
| static Image * | _loadPng (hsbase &stream) |
| Loads and decodes PNG file data. More... | |
| static Image * | _loadJpg (hsbase &stream, int size) |
| Loads and decodes JPG file data. More... | |
| static Image * | _loadJpg (hsbase &stream) |
| Loads and decodes JPG file data. More... | |
| static Image * | _loadJpt (hsbase &stream) |
| Loads and decodes JPT file data. More... | |
| static Image * | _loadPvr (hsbase &stream) |
| Loads and decodes PVR file data. More... | |
| static Image * | _loadEtcx (hsbase &stream, int size) |
| Loads and decodes ETCX file data. More... | |
| static Image * | _loadEtcx (hsbase &stream) |
| Loads and decodes ETCX file data. More... | |
| static Image * | _loadPvrz (hsbase &stream, int size) |
| Loads and decodes PVRZ file data. More... | |
| static Image * | _loadPvrz (hsbase &stream) |
| Loads and decodes PVRZ file data. More... | |
| static bool | _savePng (hsbase &stream, Image *image, SaveParameters parameters) |
| Saves image data into a stream encoded as PNG file. More... | |
| static bool | _saveJpeg (hsbase &stream, Image *image, SaveParameters parameters) |
| Saves image data into a stream encoded as JPEG file. More... | |
| static Image * | _readMetaDataPng (hsbase &stream, int size) |
| Loads and decodes meta data from PNG file data. More... | |
| static Image * | _readMetaDataPng (hsbase &stream) |
| Loads and decodes meta data from PNG file data. More... | |
| static Image * | _readMetaDataJpg (hsbase &stream, int size) |
| Loads and decodes meta data from JPG file data. More... | |
| static Image * | _readMetaDataJpg (hsbase &stream) |
| Loads and decodes meta data from JPG file data. More... | |
| static Image * | _readMetaDataJpt (hsbase &stream) |
| Loads and decodes meta data from JPT file data. More... | |
| static Image * | _readMetaDataPvr (hsbase &stream) |
| Loads and decodes meta data from PVR file data. More... | |
| static Image * | _readMetaDataEtcx (hsbase &stream, int size) |
| Loads and decodes meta data from ETCX file data. More... | |
| static Image * | _readMetaDataEtcx (hsbase &stream) |
| Loads and decodes meta data from ETCX file data. More... | |
| static Image * | _readMetaDataPvrz (hsbase &stream, int size) |
| Loads and decodes meta data from PVRZ file data. More... | |
| static Image * | _readMetaDataPvrz (hsbase &stream) |
| Loads and decodes meta data from PVRZ file data. More... | |
| static bool | _convertFrom1Bpp (int w, int h, unsigned char *srcData, Format srcFormat, unsigned char **destData, Format destFormat) |
| Converts raw image data from a source pixel format with 1 byte-per-pixel to a raw image data destination. More... | |
| static bool | _convertFrom3Bpp (int w, int h, unsigned char *srcData, Format srcFormat, unsigned char **destData, Format destFormat) |
| Converts raw image data from a source pixel format with 3 byte-per-pixel to a raw image data destination. More... | |
| static bool | _convertFrom4Bpp (int w, int h, unsigned char *srcData, Format srcFormat, unsigned char **destData, Format destFormat) |
| Converts raw image data from a source pixel format with 4 byte-per-pixel to a raw image data destination. More... | |
| static bool | _blitFrom1Bpp (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat, unsigned char alpha) |
| Executes a raw image data block transfer from a source pixel format with 1 byte-per-pixel to a raw image data destination. More... | |
| static bool | _blitFrom3Bpp (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat, unsigned char alpha) |
| Executes a raw image data block transfer from a source pixel format with 3 byte-per-pixel to a raw image data destination. More... | |
| static bool | _blitFrom4Bpp (int sx, int sy, int sw, int sh, int dx, int dy, unsigned char *srcData, int srcWidth, int srcHeight, Format srcFormat, unsigned char *destData, int destWidth, int destHeight, Format destFormat, unsigned char alpha) |
| Executes a raw image data block transfer from a source pixel format with 4 byte-per-pixel to a raw image data destination. More... | |
Static Protected Attributes | |
| static hmap< hstr, Image *(*)(hsbase &)> | customLoaders |
| Custom image format loaders. | |
| static hmap< hstr, Image *(*)(hsbase &)> | customMetaDataLoaders |
| Custom image format meta data loaders. | |
| static hmap< hstr, bool(*)(hsbase &, Image *, SaveParameters)> | customSavers |
| Custom image format savers. | |
| static hmap< hstr, SaveParameters(*)()> | customSaverDefaultParameters |
| Custom image format saver default parameters. | |
Defines a generic image data source.
|
protected |
Copy constructor.
| [in] | other | Other Image object. |
|
staticprotected |
Executes a raw image data block transfer from a source pixel format with 1 byte-per-pixel to a raw image data destination.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
staticprotected |
Executes a raw image data block transfer from a source pixel format with 3 byte-per-pixel to a raw image data destination.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
staticprotected |
Executes a raw image data block transfer from a source pixel format with 4 byte-per-pixel to a raw image data destination.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
staticprotected |
Converts raw image data from a source pixel format with 1 byte-per-pixel to a raw image data destination.
| [in] | w | Width of the data to convert. |
| [in] | h | Height of the data to convert. |
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
|
staticprotected |
Converts raw image data from a source pixel format with 3 byte-per-pixel to a raw image data destination.
| [in] | w | Width of the data to convert. |
| [in] | h | Height of the data to convert. |
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
|
staticprotected |
Converts raw image data from a source pixel format with 4 byte-per-pixel to a raw image data destination.
| [in] | w | Width of the data to convert. |
| [in] | h | Height of the data to convert. |
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
|
staticprotected |
Loads and decodes ETCX file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes ETCX file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes JPG file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes JPG file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes JPT file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes PNG file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes PNG file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes PVR file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes PVRZ file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes PVRZ file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from ETCX file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes meta data from ETCX file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from JPG file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes meta data from JPG file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from JPT file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from PNG file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes meta data from PNG file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from PVR file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
Loads and decodes meta data from PVRZ file data.
| [in] | stream | The encoded image data stream. |
| [in] | size | The size within the data stream that actually belongs to this encoded file. |
|
staticprotected |
Loads and decodes meta data from PVRZ file data.
| [in] | stream | The encoded image data stream. |
|
staticprotected |
|
staticprotected |
| bool april::Image::blit | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does an image data block transfer onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blit | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| Image * | other, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does an image data block transfer onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | other | The source Image. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blit | ( | cgrecti | srcRect, |
| cgvec2i | destPosition, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does an image data block transfer onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destPosition | Destination coordinates. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blit | ( | cgrecti | srcRect, |
| cgvec2i | destPosition, | ||
| Image * | other, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does an image data block transfer onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destPosition | Destination coordinates. |
| [in] | other | The source Image. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
static |
Does an image data block transfer onto the raw image data.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blitRect | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| const april::Color & | color | ||
| ) |
Blits a rectangle area with one color.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | w | Width of the area. |
| [in] | h | Height of the area. |
| [in] | color | The Color used for blitting. |
| bool april::Image::blitRect | ( | cgrecti | rect, |
| const Color & | color | ||
| ) |
Blits a rectangle area with one color.
| [in] | rect | The rectangle area. |
| [in] | color | The Color used for blitting. |
|
static |
Blits a rectangle area with one color in raw image data.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | w | Width of the area. |
| [in] | h | Height of the area. |
| [in] | color | The Color used for blitting. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| bool april::Image::blitStretch | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| int | dw, | ||
| int | dh, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does a stretched image data block transfer onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blitStretch | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| int | dw, | ||
| int | dh, | ||
| Image * | other, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does a stretched image data block transfer onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | other | The source Image. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blitStretch | ( | cgrecti | srcRect, |
| cgrecti | destRect, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does a stretched image data block transfer onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destRect | Destination rectangle. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
| bool april::Image::blitStretch | ( | cgrecti | srcRect, |
| cgrecti | destRect, | ||
| Image * | other, | ||
| unsigned char | alpha = 255 |
||
| ) |
Does a stretched image data block transfer onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destRect | Destination rectangle. |
| [in] | other | The source Image. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
static |
Does a stretched image data block transfer onto the raw image data.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | alpha | Alpha multiplier on the entire source image. |
|
static |
Checks if the coordinates are out of bounds.
| [in] | x | Position X-coordinate. |
| [in] | y | Position Y-coordinate. |
| [in] | destWidth | Destination image data width. |
| [in] | destHeight | Destination image data height. |
|
static |
Checks if the rect is out of bounds.
| [in] | x | Rectangle X-coordinate. |
| [in] | y | Rectangle Y-coordinate. |
| [in] | w | Rectangle width. |
| [in] | h | Rectangle height. |
| [in] | destWidth | Destination image data width. |
| [in] | destHeight | Destination image data height. |
| bool april::Image::clear | ( | ) |
Clears the entire image and sets all image data to zeroes.
|
static |
Converts raw image data from one format into another.
| [in] | w | Width of the raw image data. |
| [in] | h | Height of the raw image data. |
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | preventCopy | If true, it will make a copy even if source and destination formats are the same. |
| bool april::Image::copyPixelData | ( | unsigned char ** | output, |
| Format | format | ||
| ) | const |
Copies the image data into a buffer.
| [out] | output | The output buffer. |
| [in] | format | In what format the output should be done. |
| bool april::Image::copyPixelData | ( | unsigned char ** | output | ) | const |
Copies the image data into a buffer.
| [out] | output | The output buffer. |
|
static |
Corrects rectangle to stay in bounds of the image data.
| [in,out] | x | Rectangle X-coordinate. |
| [in,out] | y | Rectangle Y-coordinate. |
| [in,out] | w | Rectangle width. |
| [in,out] | h | Rectangle height. |
| [in] | dataWidth | Image data width. |
| [in] | dataHeight | Image data height. |
|
static |
Corrects the source rectangle and destination coordinates to stay in bounds of the source and destination image data.
| [in,out] | sx | Source rectangle X-coordinate. |
| [in,out] | sy | Source rectangle Y-coordinate. |
| [in,out] | sw | Source rectangle width. |
| [in,out] | sh | Source rectangle height. |
| [in] | srcWidth | Source image data width. |
| [in] | srcHeight | Source image data height. |
| [in,out] | dx | Destination position X-coordinate. |
| [in,out] | dy | Destination position Y-coordinate. |
| [in] | destWidth | Destination image data width. |
| [in] | destHeight | Destination image data height. |
|
static |
Corrects source and destination rectangles to stay in bounds of the source and destination image data.
| [in,out] | sx | Source rectangle X-coordinate. |
| [in,out] | sy | Source rectangle Y-coordinate. |
| [in,out] | sw | Source rectangle width. |
| [in,out] | sh | Source rectangle height. |
| [in] | srcWidth | Source image data width. |
| [in] | srcHeight | Source image data height. |
| [in,out] | dx | Destination rectangle X-coordinate. |
| [in,out] | dy | Destination rectangle Y-coordinate. |
| [in,out] | dw | Destination rectangle width. |
| [in,out] | dh | Destination rectangle height. |
| [in] | destWidth | Destination image data width. |
| [in] | destHeight | Destination image data height. |
|
static |
|
static |
|
static |
Creates an Image object from a data stream.
| [in] | stream | Data stream containing the compressed image data. |
| [in] | logicalExtension | The logical extension of the loaded stream so the method knows what data is contained in the stream. |
|
static |
Creates an Image object from a data stream.
| [in] | stream | Data stream containing the compressed image data. |
| [in] | logicalExtension | The logical extension of the loaded stream so the method knows what data is contained in the stream. |
| [in] | format | Convert to a certain pixel format during load. |
| bool april::Image::dilate | ( | unsigned char * | srcData, |
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat | ||
| ) |
Dilates the image.
| [in] | srcData | The constructing image's raw image data. |
| [in] | srcWidth | The width of the constructing image's raw image data. |
| [in] | srcHeight | The height of the constructing image's raw image data. |
| [in] | srcFormat | The pixel format of the constructing image's raw image data. |
| bool april::Image::dilate | ( | Image * | image | ) |
Dilates the image.
| [in] | image | The source Image. |
|
static |
Dilates the raw image data.
| [in] | srcData | The constructing image's raw image data. |
| [in] | srcWidth | The width of the constructing image's raw image data. |
| [in] | srcHeight | The height of the constructing image's raw image data. |
| [in] | srcFormat | The pixel format of the constructing image's raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| Image* april::Image::extractAlpha | ( | ) | const |
Extracts the alpha channel of the image.
| Image* april::Image::extractBlue | ( | ) | const |
Extracts the blue color channel of the image.
| Image* april::Image::extractColor | ( | int | index | ) | const |
Extracts the color channel at the given index of the image.
| [in] | index | Index of the color channel. |
| Image* april::Image::extractGreen | ( | ) | const |
Extracts the greeb color channel of the image.
| Image* april::Image::extractRed | ( | ) | const |
Extracts the red color channel of the image.
| bool april::Image::fillRect | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| const april::Color & | color | ||
| ) |
Fills a rectangle area with one color.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | w | Width of the area. |
| [in] | h | Height of the area. |
| [in] | color | The Color used for filling. |
| bool april::Image::fillRect | ( | cgrecti | rect, |
| const Color & | color | ||
| ) |
Fills a rectangle area with one color.
| [in] | rect | The rectangle area. |
| [in] | color | The Color used for filling. |
|
static |
Fills a rectangle area with one color in raw image data.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | w | Width of the area. |
| [in] | h | Height of the area. |
| [in] | color | The Color used for filling. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| int april::Image::getBpp | ( | ) | const |
Gets the byte-per-pixel value.
| int april::Image::getByteSize | ( | ) | const |
Gets the size of the image data in bytes.
| Color april::Image::getInterpolatedPixel | ( | float | x, |
| float | y | ||
| ) | const |
Gets the linearly interpolated color between two pixels.
| [in] | x | Decimal X-coordinate. |
| [in] | y | Decimal Y-coordinate. |
| Color april::Image::getInterpolatedPixel | ( | cgvec2f | position | ) | const |
Gets the linearly interpolated color between two pixels.
| [in] | position | Pixel coordinate. |
|
static |
Gets the linearly interpolated color between two pixels in raw image data.
| [in] | x | Decimal X-coordinate. |
| [in] | y | Decimal Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| Color april::Image::getPixel | ( | int | x, |
| int | y | ||
| ) | const |
Gets the color of a specific pixel.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| Color april::Image::getPixel | ( | cgvec2i | position | ) | const |
Gets the color of a specific pixel.
| [in] | position | Pixel coordinate. |
|
static |
Gets the color of a specific pixel in raw image data.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::insertAlphaMap | ( | unsigned char * | srcData, |
| Format | srcFormat, | ||
| unsigned char | median, | ||
| int | ambiguity | ||
| ) |
Inserts image data as alpha channel into this image.
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | median | The median value for insertion. |
| [in] | ambiguity | How "hard" the alpha channel transition should be. |
| bool april::Image::insertAlphaMap | ( | unsigned char * | srcData, |
| Format | srcFormat | ||
| ) |
Inserts image data as alpha channel into this image.
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::insertAlphaMap | ( | Image * | image, |
| unsigned char | median, | ||
| int | ambiguity | ||
| ) |
Inserts image data as alpha channel into this image.
| [in] | image | The source Image. |
| [in] | median | The median value for insertion. |
| [in] | ambiguity | How "hard" the alpha channel transition should be. |
| bool april::Image::insertAlphaMap | ( | Image * | image | ) |
Inserts image data as alpha channel into this image.
| [in] | image | The source Image. |
|
static |
Inserts raw image data as alpha channel into other raw image data.
| [in] | w | Width of the raw image data. |
| [in] | h | Height of the raw image data. |
| [in] | srcData | The source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | median | The median value for insertion. |
| [in] | ambiguity | How "hard" the alpha channel transition should be. |
| bool april::Image::invert | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h | ||
| ) |
Inverts the pixel colors of a rectangle area on the image.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| bool april::Image::invert | ( | cgrecti | rect | ) |
Inverts the pixel colors of a rectangle area on the image.
| [in] | rect | Rectangle area. |
|
static |
Inverts the pixel colors of a rectangle area on the raw image data.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::isValid | ( | ) | const |
Checks if the image is a valid image data construct with appropriate meta data.
|
static |
Checks if an image format conversion is needed.
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| [in] | preventCopy | If true, it will return false if source and destination formats are the same. |
|
static |
|
static |
|
static |
Creates an Image without image data, but with meta-data from a data stream.
| [in] | stream | Data stream containing the compressed image data. |
| [in] | logicalExtension | The logical extension of the loaded stream so the method knows what data is contained in the stream. |
|
static |
Registers a custom image loader for custom image formats.
| [in] | extension | Filename extension. |
| [in] | loadFunction | The function pointer to use for loading the Image. |
| [in] | metaDataLoadfunction | The function pointer to use for loading the Image meta-data. |
|
static |
Registers a custom image saver for custom image formats.
| [in] | extension | Filename extension. |
| [in] | saveFunction | The function pointer to use for loading the Image. |
| [in] | defaultParametersFunction | The function pointer to use for setting up the default save parameters. |
| bool april::Image::rotateHue | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| float | degrees | ||
| ) |
Rotates the pixel hue of a rectangle area on the image.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| [in] | degrees | By how many degrees the the should be rotated. |
| bool april::Image::rotateHue | ( | cgrecti | rect, |
| float | degrees | ||
| ) |
Rotates the pixel hue of a rectangle area on the image.
| [in] | rect | Rectangle area. |
| [in] | degrees | By how many degrees the the should be rotated. |
|
static |
Rotates the pixel hue of a rectangle area on the raw image data.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | degrees | By how many degrees the the should be rotated. |
| bool april::Image::saturate | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| float | factor | ||
| ) |
Changes the saturation level of pixels of a rectangle area on the image.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| [in] | factor | The saturation multiplier factor. |
| bool april::Image::saturate | ( | cgrecti | rect, |
| float | factor | ||
| ) |
Changes the saturation level of pixels of a rectangle area on the image.
| [in] | rect | Rectangle area. |
| [in] | factor | The saturation multiplier factor. |
|
static |
Changes the saturation level of pixels of a rectangle area on the raw image data.
| [in] | x | X-coordinate of the area to change. |
| [in] | y | Y-coordinate of the area to change. |
| [in] | w | Width of the area to change. |
| [in] | h | Height of the area to change. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in] | factor | The saturation multiplier factor. |
|
static |
Saves the image data in a certain file format.
| [in] | image | The Image to be saved. |
| [in] | filename | The filename. |
| [in] | format | The file format of the file. |
| [in] | parameters | Special parameters that can be adjusted in the saving Format. |
| [in] | customExtension | Used when format is Custom to determine which custom format should be saved. |
| bool april::Image::setPixel | ( | int | x, |
| int | y, | ||
| const Color & | color | ||
| ) |
Sets the color of a specific pixel.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | color | The new Color of the pixel. |
| bool april::Image::setPixel | ( | cgvec2i | position, |
| const Color & | color | ||
| ) |
Sets the color of a specific pixel.
| [in] | position | Pixel coordinate. |
| [in] | color | The new Color of the pixel. |
|
static |
Sets the color of a specific pixel in raw image data.
| [in] | x | X-coordinate. |
| [in] | y | Y-coordinate. |
| [in] | color | The new Color of the pixel. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| bool april::Image::write | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat | ||
| ) |
Writes image data directly onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::write | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| Image * | other | ||
| ) |
Writes image data directly onto the image.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | other | The source Image. |
| bool april::Image::write | ( | cgrecti | srcRect, |
| cgvec2i | destPosition, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat | ||
| ) |
Writes image data directly onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destPosition | Destination coordinates. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::write | ( | cgrecti | srcRect, |
| cgvec2i | destPosition, | ||
| Image * | other | ||
| ) |
Writes image data directly onto the image.
| [in] | srcRect | Source data rectangle. |
| [in] | destPosition | Destination coordinates. |
| [in] | other | The source Image. |
|
static |
Writes image data directly onto raw image data.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| bool april::Image::writeStretch | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| int | dw, | ||
| int | dh, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat | ||
| ) |
Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::writeStretch | ( | int | sx, |
| int | sy, | ||
| int | sw, | ||
| int | sh, | ||
| int | dx, | ||
| int | dy, | ||
| int | dw, | ||
| int | dh, | ||
| Image * | other | ||
| ) |
Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | other | The source Image. |
| bool april::Image::writeStretch | ( | cgrecti | srcRect, |
| cgrecti | destRect, | ||
| unsigned char * | srcData, | ||
| int | srcWidth, | ||
| int | srcHeight, | ||
| Format | srcFormat | ||
| ) |
Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated.
| [in] | srcRect | Source data rectangle. |
| [in] | destRect | Destination rectangle. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| bool april::Image::writeStretch | ( | cgrecti | srcRect, |
| cgrecti | destRect, | ||
| Image * | other | ||
| ) |
Writes image data directly onto the image while trying to stretch the pixels. Stretched pixels will be linearly interpolated.
| [in] | srcRect | Source data rectangle. |
| [in] | destRect | Destination rectangle. |
| [in] | other | The source Image. |
|
static |
Writes image data directly onto the raw image data while trying to stretch the pixels. Stretched pixels will be linearly interpolated.
| [in] | sx | Source data X-coordinate. |
| [in] | sy | Source data Y-coordinate. |
| [in] | sw | Width of the area on the source to be copied. |
| [in] | sh | Height of the area on the source to be copied. |
| [in] | dx | Destination X-coordinate. |
| [in] | dy | Destination Y-coordinate. |
| [in] | dw | Width of the destination area. |
| [in] | dh | Height of the destination area. |
| [in] | srcData | The source raw image data. |
| [in] | srcWidth | The width of source raw image data. |
| [in] | srcHeight | The height of source raw image data. |
| [in] | srcFormat | The pixel format of source raw image data. |
| [in,out] | destData | The destination raw image data. |
| [in] | destWidth | The width of destination raw image data. |
| [in] | destHeight | The height of destination raw image data. |
| [in] | destFormat | The pixel format of destination raw image data. |
| int april::Image::internalFormat |
Internal format identifier.


WITNESS LIST Agriculture & Livestock Committee March 25, 2003-8:00A HB 777 For: Brown, Travis (Public Citizen) Cleveland, Wayne (Texas Grain Sorghum Association) On: Combs, Susan (Texas Department of Agriculture) Registering, but not testifying: For: Mayberry, Warren (Texas Farm Bureau) Sklar, Shane (Independent Cattlemen's Association) Turner, Robert (Texas Sheep & Goat Raisers Assn) HB 1046 Registering, but not testifying: For: Chapman, Carol (Self) On: Latimer, Jr., Greg (Office of the Texas State Chemist) Supak, James (Office of the Texas State Chemist) HB 1148 For: Cowan, John (Texas Association of Dairymen) Against: Battle, Jackson (City of Waco) Brown, Travis (Public Citizen) Henry, Stuart (Self) On: Bergeron, Stephanie (Texas Commission on Environmental Quality (TCEQ)) Registering, but not testifying: For: Horton, Ken (Texas Pork Producers Association) Howe, Billy (Texas Farm Bureau) Terrell, James (Select Milk Producers) Wilson, Ross (Texas Cattle Feeders Association) Against: Kramer, Ken (Lone Star Chapter, Sierra Club) Wojnowski, Matthew (City of Temple) HB 1324 For: Brady, Zach (Texas & Southwestern Cattle Raisers Association) Harris, Sue (Self) Hicks, Steve (Self) Luecke, Jodi (Self) Smarthwaite, Lex (American Paint Horse Association) Ward, Don (Self and Livestock Marketing Association of Texas) Against: Barry, Susan (Self) Bias, James (Self) Caldwell, Jana (Self and Daniel & Ruth Reeves-Erath Co.;Jill Davis & Jo Eisenrich-Tarrant Co.; Carol Chapman-Galveston Co.;) Caldwell, Jana (Self and Jerry Finch-Habitat for Horses-Houston) Coller, Anne (The Fund for Animals) Dickey, Pat (Self) Dickey, William (Self) Enyart, Pat (Self) Gilleland, Ellis (Self and "Texas Animals") Gregoric, Michael (Self) Hendrix, Susan (Self and Society for Animal Protection Legislation) Holeyfield, Pam (Self and horsebroker) Holloway, Cile (Self and Texas Humane Legislation Network) Moore, Brandy (Self) Nash, Mary (Self) Nordyke, Patt (Self and Texas Federation of Humane Societies) Sabatucci, Jay (The Humane Society of the United States) Starr, Anna (Orange Show Foundation) Trimble, Robert "Skip" (Self and Breeder's Cup Ltd; Fasig-TiptonCo.,; Thoroughbred Foundation) Vickers, Laura (Self) Young, Tracy (Self and Kelly Young (wife); Pennell Hopkins-Humane Office for Pa. SPCA) On: Diamond, Ann (Tarrant County DA's Office) Registering, but not testifying: For: Copeland, Chris (Texas Veterinary Medical Association) Grimm, James (Texas Poultry Federation) Mayberry, Warren (Texas Farm Bureau) Singleton, Pauline (Self and Greater Houston Horse Council) Sklar, Shane (Independent Cattlemen's Association) Turner, Robert (Texas Sheep & Goat Raisers Association) Vane, Mark (Texas Thoroughbred Association) Weems, Jim (Self) Westbrook, Steve (Self) Wilson, Ross (Texas Cattle Feeders Association) Against: Anderson, Regina (Self) Backo, Amy (Self) Beck, Lisa (Self) Bishop, Lynn (Self) Caramante, Julie (Self) Caramante, Landyn (Self) Chapman, Carol (Self) Cummings, Laurie (Self) Davis, Leslie (Self) Finch, Jerry (Self) Goodwillie, Lalla (Self) Gore, Kathy (Self) Gregory, William (Self) Hagen, Brynn (Self) Hancock, Faye (Self) Hilder, Julia (Self) Luckenbach, John (Self) Lundstedt, David (Self) McMahon, Jr., F. Hagen (Self) Muenzer, Kappy (Self and Citizens for Animal Protection, Houston, TX) Poarch, Mad (Madelyn) (Self) Rebold, Jeanette (Self) Rogers, Kim (Self) Sanderlin, Patricia (Self) Schedler, A. J. (Self) Turner, Randall (Self) Wier DeFord, Marion (Self) Wilson, Dorothy (Self) On: Coats, Max (Texas Animal Health Commission) HB 1357 Against: Brown, Travis (Public Citizen) Henry, Stuart (Self) Kramer, Ken (Lone Star Chapter, Sierra Club) On: Sidnell, Jennifer (Texas Commission on Environmental Quality (TCEQ)) Registering, but not testifying: For: Cowan, John (Texas Association Dairymen) Terrell, James (Select Milk Producers, Inc.) Against: Battle, Jackson (City of Waco) Mitchell, Kathy (Consumer's Union) Wojnowski, Matthew (City of Temple) HB 1358 Against: Battle, Jackson (City of Waco) Brown, Travis (Public Citizen) Kramer, Ken (Lone Star Chapter, Sierra Club) On: Bergeron, Stephanie (Texas Commission on Environmental Quality (TCEQ)) Registering, but not testifying: For: Terrell, James (Select Milk Producers, Inc.) Against: Mitchell, Kathy (Consumer's Union) Wojnowski, Matthew (City of Temple) On: Cowan, John (Texas Association of Dairymen) HB 1398 For: Leamons, Charles (Texas Seed Trade Association) On: Kostroun, David (Texas Department of Agriculture) HB 1452 Registering, but not testifying: For: Beck, Regan (Texas Farm Bureau) Turner, Robert (Texas Sheep & Goat Raisers Association) On: Nunley, Gary (Texas Wildlife Damage Management Service - Texas A&M University System) Tham, Phil (Texas Department of Agriculture)


First level, highest ranking
Second level heading
Third level heading
Fourth level heading
Fifth level heading
Sixth level heading
link
emphasized text
important text
new line
An inline element does not start on a new line and only takes up as much width as necessary.
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
defines a hyperlink to a location on the same page or any other page on the Web
Google ita
link to external website
link to another page on the same domain
link to an external resource
link to another place in the same page
link to another page in a specific place
link to an email address
link to a javascript function
link to a telephone number
- item
- item
- item
- item
- item1
- item2
- item3
- item4
represents an image in the document. Example of self-closing tag, like

bold text
emphasized text
italic text
smaller text

important text
subscripted text
superscripted text
inserted text

marked/highlighted text

-

,

<form>

content
title


Description
This command work with an immediately preceding if, orif or for command. ITs body is executed only if the body of the previous command was not executed.
Command Syntax
'@x:else'
No attributes, options or body are permitted.
A @x:else command must directly follow a @x:if, @x:orif or @x:for command.
Execution Semantics
If the body of the previous command was executed, then the result of executing the @x:else command is null. If the body of the previous command was not executed, then the result of the @x:else command is the result of executing its body.
Examples
@x:if i < j {
"less"
} @x:orif i > j {
"greater"
} @x:else {
"equal"
}
@use library:iterator;
@x:for i := First[Filter[iter,p]] {
"found:"; i
} @x:else {
"not found"
}


DEEP IMPACT RATING: 6.5 / 10 --> So-so
Review Date: June 11, 1998 Director: Mimi Leder Writers: Bruce Joel Rubin and Michael Tolkin Producers: David Brown and Richard D. Zanuck Actors: Morgan Freeman as President Beck Téa Leoni as Jenny Lerner Robert Duvall as Spurgeon "Fish" Tanner Elijah Wood as Leo Biederman Genre: Drama / Science-Fiction Year of Release: 1998
Mimi Leder's follow-up to the Dreamworks studio's first ever cinematic feature, THE PEACEMAKER (5.5/10), leads the twin set of comet movies set to hit the theatres in the summer of 1998. ARMAGEDDON with Bruce Willis will follow this early-riser in late July.
PLOT: A gigantic comet is set to strike Earth within the next year. A sextet of qualified personnel are sent into space to blow the comet up before it smashes into ground zero and annihilates all of mankind. Meanwhile, all of the inhabitants of dear planet Earth must begin to deal with the not-too-unrealistic approach of Doomsday. Panic and suspense ensues.
CRITIQUE: Mostly interesting, flawed, piece about the circumstances that would follow an end of the world scenario such as this. The special effects are great (especially near the end of the film), but overall the film plays more like a drama than any kind of special effect or science-fiction extravaganza. For the most part, I didn't really "get into" the characters' personal lives, as they would have liked us to, but I must admit that these characters are a little more developed than your basic summer special-effect blockbuster (Mrs. JoBlo on the other hand, heartily felt for the characters, as displayed by her excessive unleashing of tears through most of the second half of this flick.)
The actors in the movie were also pretty good, with Freeman and Duvall showing up with the strongest performances. Leoni didn't really impress me in her role as the feisty, yet sensitive, reporter, but the crew of the "Messiah" (the spaceship sent up to destroy the comet) were genuinely tough and believable. Of course, I hold a special place in my heart for John Favreau, who wrote and starred in my favourite picture of 1996, SWINGERS (8.5/10).
All in all, if you're in the mood for a decent time at the movie theatre, with some great special effects (when needed), I would suggest you go see this film but without too many high expectations. If you're into character development and believable personalities, I recommend you skip this sucker and go straight to your nearest video store for the latest in your "wear-care-and-tear" movies. The movie does run close to two hours, but you won't really feel it, because it does move at quite a rapid pace. Overall, a decent improvement for Ms. Leder from the dismal PEACEMAKER, but still, nothing to write home about. Oh, and one more piece of advice for Ms. Leder: try to sprinkle your films with a slight touch of humour once in a while, and things might not seem so grim to the audience. Both of her films lack highly in this regard.
Little Known Facts: Téa Leoni's real name is Téa Pantleoni (Téa means Goddess). She was born in New York and stands 5"7. She married X-files star David Duchovny in 1997, and has been quoted as saying, ""I don't do T&A very well because I haven't got much of either." She actually auditioned for a Charlie's Angels (1976) remake role (as a dare) and got the part. A writer's strike in Hollywood meant the series was never made, but the pre-publicity was enough to get her noticed. Robert Duvall once said, ""When I started taking theater classes I began to make all As. Before that I didn't even know what an A was." When he first moved to NY to pursue his acting career, he shared an apartment with his older brother and four other aspiring actors, among them a young fellow by the name of Dustin Hoffman.
(c) 1998 Berge Garabedian
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


--- title: Title keywords: fastai sidebar: home_sidebar ---
You might want to have a cell just for __future__
imports, but there are no restrictions
These cells just run like normal when testing with nbdev_test_nbs
assert Tree(Tree(None,None),None) is not None
You can use special comments to export a cell containing __future__
imports
If you see SyntaxError: from __future__ imports must occur at the beginning of the file
:
%nbdev_export
from __future__ import annotations
you'll need to move the __future__
import to the top of the cell:
from __future__ import annotations
%nbdev_export
# from decision_tree.test.from_future import *
# Tree(Tree(None,None),None), annotations


The series of commands to run within this particular virtualenv.
Intended to be used with the pysh and pybat steps.
pysh
pybat


Preparation¶
This section details the steps required to prepare a component contribution for inclusion in the science repository of the framework.
You can then follow the steps below to prepare your component contribution:
Create your component by subclassing a generic framework component¶
In the modelling framework, the terrestrial water cycle is divided into
three components, i.e. SurfaceLayerComponent
, SubSurfaceComponent
,
and OpenWaterComponent
(see Fig. 1). These are the
three framework components to create subclasses from.
Each component features a fixed interface (i.e. a pre-defined set of transfers of information with the other components of the framework): inwards information (variables that are given to the component), and outwards information (variables that are computed by the component), see Fig. 2.
Contributions to the science repository of cm4twc
need to comply with
this fixed interface. If your contribution to cm4twc
is overlapping
several components, it requires to be refactored into the relevant number
of components.
Contributions must be implemented as a Python class, and more specifically as a subclass of one of the three framework components. This way, the interface for the component contribution is already set, and the component directly inherits all the functionalities intrinsic to the framework so that, as a contributor, you can focus solely on specifying the data and science elements of the component.
Creating your contribution as a Python class can simply be done by
subclassing from the relevant framework component, e.g. a surface layer
component named MyContribution
would be created as follows:
from cm4twc import SurfaceLayerComponent
class MyContribution(SurfaceLayerComponent):
pass
Note, pass
is only added here temporarily for this Python example
script to remain valid, it will be replaced in the subsequent steps.
Document your component by filling in your class docstring¶
A brief description of the component (with reference(s) if applicable) alongside a field list containing e.g. name(s) of contributor(s), affiliation(s) of contributor(s), licence, copyright, etc. must be provided. To do so, use your class docstring and follow a reStructuredText syntax as in the example below.
from cm4twc import SurfaceLayerComponent
class MyContribution(SurfaceLayerComponent):
"""
Brief description of the component.
Details published in `Doe et al. (2020) <https://doi.org/##.####/XXX>`_.
:Contributors: Jane Doe [1]
:Affiliations: [1] University
:Licence: GPL-3.0
:Copyright: 2021, Jane Doe
"""
Define your component by using component class attributes¶
The component definition is used by cm4twc
to make sure that all the
information required by the component to run is provided by the user.
The definition of a component is made of the information about its
inputs, outputs, states, parameters, and constants.
The inputs/outputs exclude those variables already included in the fixed interface, i.e. inwards and outwards transfers (see Fig. 2).
The inputs must be one of three following kinds:
dynamic: data required for each spatial element and for each time step,
static: data required for each spatial location and constant over time,
climatologic: data required for each spatial element and for a given frequency within a climatology year.
The parameters are those subject to tuning, while the constants are those not subject to tuning. Note, parameter tuning/calibration is not a functionality offered by the framework.
The definition for the component is specified by assigning dictionaries
to the class attributes _inputs_info
, _outputs_info
, _states_info
,
_parameters_info
, and _constants_info
. For example, in the _inputs_info
dictionary, each item corresponds to a different input, and for this item
the key is the name of the input, and the value is a dictionary containing
the metadata for the input, featuring at least two items, one for its kind
and one for its units (and one for its frequency if kind is
climatologic). All other items in the component definition must feature
at least a units metadata item, and an optional description metadata
item is strongly encouraged.
In addition, special attributes in the definition _land_sea_mask
and
_flow_direction
and must be assigned a boolean value (True if required,
False if not required). If you need land sea mask information for your
computation, set _land_sea_mask
to True and access it in your class
methods using self.spacedomain.land_sea_mask
. If you need flow
direction information or want to use the flow routing functionality of
the component (accessible through self.spacedomain.route()
), set
_flow_direction
as True, and access it in your class methods using
self.spacedomain.flow_direction
.
See a detailed example of component definition below.
from cm4twc import SurfaceLayerComponent
class MyContribution(SurfaceLayerComponent):
"""component description here"""
_inputs_info = {
'name_1st_input': {
'kind': 'dynamic',
'units': 'kg m-2 s-1'
},
'name_2nd_input': {
'kind': 'static',
'units': 'm'
},
'name_3rd_input': {
'kind': 'climatologic',
'frequency': 'monthly',
'units': '1'
}
}
_outputs_info = {
'name_1st_output': {
'units': 'kg m-2 s-1'
}
}
_states_info = {
'name_1st_state': {
'units': 'kg m-2'
}
}
_parameters_info = {
'name_1st_parameter': {
'description': 'brief parameter description here',
'units': 'kg m-2'
}
}
_constants_info = {
'name_1st_constant': {
'description': 'brief constant description here',
'units': 'kg m-2'
}
}
_land_sea_mask = False
_flow_direction = True
Implement the initialise-run-finalise component class methods¶
The computations of your component contribution must be broken down into
the three phases initialise, run, and finalise. This means that your
Python class must feature three methods named initialise
, run
, and
finalise
.
The initialise
method defines the initial conditions for the component
states and features any other action required to enable the component to
start its integration. It is called at the beginning of a model simulation.
The arguments of this method are the component states. This method is not
expected to return anything.
The run
method contains the computations required to integration from
one time step to the next. It is called multiple times to move through
the model simulation period. The arguments of this method are the component
inwards, inputs, states, parameters, and constants (constants must be
given a default value directly in the method signature). This method is
expected to return a tuple of two dictionaries: the first dictionary
must contain the component outward transfers (keys are the outward names,
values are the outward arrays), the second dictionary must contain the
component outputs (keys are the output names, values are the output arrays).
Note, the second dictionary may be empty if the component does not
feature any custom outputs.
The finalise
method contains any action required to guarantee that the
simulation can be restarted after the last simulation time step. It is
called at the end of a model simulation. This method is not expected to
return anything.
Since, the arguments of the three methods initialise
, run
, and
finalise
are going to be passed as keyword arguments, the names of the
arguments in their signatures must necessarily be the ones found in the
component class attribute (if renaming is required, this must be done
internally to the method). Moreover, they must all feature a final
special argument **kwargs
.
from cm4twc import SurfaceLayerComponent
class MyContribution(SurfaceLayerComponent):
"""component description here"""
# component definition here
def initialise(self, name_1st_state, **kwargs):
# set here initial condition values for component states
name_1st_state[-1][:] = 0
def run(self, name_1st_inwards, name_2nd_inwards, name_3rd_inwards,
name_1st_input, name_2nd_input, name_3rd_input,
name_1st_state, name_1st_parameter, name_1st_constant=1, **kwargs)
# compute science using available inwards/inputs/parameters/constants
outwards_1 = (name_1st_inwards + name_1st_input
+ name_1st_state[-1] * self.timedelta_in_seconds)
* name_1st_constant
output_1 = (name_2nd_input + name_3rd_input) * name_1st_parameter
routed, outed = self.spacedomain.route(outwards_1)
# update component state
name_1st_state[0][:] = name_1st_state[-1] - (routed + output_1)
# return outwards and outputs
return (
{'name_1st_outwards': outwards_1},
{'name_1st_output': output_1}
)
def finalise(self, name_1st_state, **kwargs)
# cleanly wrap up simulation here
# to be able to restart from where simulation stopped
pass
This concludes the preparation of your component contribution, the next step is to share your work by submitting it for inclusion in the framework (see section Submission).


H_art the band is made up of three members. Mordecai Mwinyi who is the lead singer, Wachira Gatama who is the poet and Kenneth Muya, the guitarist. The journey to the top was no walk in the park. They were set book actors, except Mordecai, at the Kenya National Theatre and performed in other small plays. Although they earned a few coins, they felt they needed to switch to music. At first the plan was for Mordecai to sing as Kenneth plays the piano but they decided to bring Wachira, who is more of a poet, on board and they’ve never looked back. The three became a team when they auditioned for a cancer awareness play at the Kenya National Theatre late in 2012.In 2013 they sang a political song and thereafter came up with their name H_art the band.They signed a deal with Penya records and were enrolled in Sauti Sol Academy. Little by little, they grew as a band and started performing in gigs.Their lyrical content, delivery and stage presence is what should define Kenyan music. Those who have attended H_art the Band shows will agree with me that Kenya overflows with talent. The trio style is refreshingly unique and so is their dress code thus making them to be my favourite.
Kennedy is also a singer and plays as the guitarist.
Here are some of my favourite songs:
Other songs include:


{{extend "layout.html"}} {{=H2(T("Conflict Resolution"))}} {{if not conflict:}}
There are no conflicts logged.
{{else:}}
| Local Record | Resource: {{=conflict.resource_table}} UUID: {{=conflict.uuid}} Conflict logged on: {{=conflict.logged_on}} |
Remote Record |
| Modified on: {{=local_record.modified_on}} | Modified on: {{=conflict.remote_modified_on}} | |
| Modified by: {{=local_modified_by}} | Modified by: {{=remote_modified_by}} |


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/Propositions.20as.20Types.html ---
I'm not clear why the definition of p1
below is not a type error. What can it possibly mean for p1
to be a proof of a proof of a proposition?
constant U : Type constant u0 : U constant u1 : u0 -- type error constant p0 : Prop constant p1 : p0 -- no type error! constant p2 : p1 -- type error
I thought of U
and Prop
as being of the same "universe level", but apparently they're not.
@Lyle Kopnicky Before I answer, do you mind editing the topic to your post (and don't forget to select "Change later messages to this topic"). Maybe set it to "Propositions as Types"
Let's have a look at what kind of beast Prop
is. Prop
is actually synonymous with Sort 0
, that is, a sort in universe 0.
For e0 : e1
(a type judgement) to make sense, e1 must be a sort, i.e. there must be a universe u
such that e1 : Sort u
.
Thanks!
We can see that p1 : p0
satisfies this constraint because p0 : Sort 0
.  Note that Type u = Sort (u+1)
We have the same problem for u1 : u0
as for p1 : p0
I'm not clear why the definition of
p1
below is not a type error. What can it possibly mean forp1
to be a proof of a proof of a proposition?
No, p0
is the proposition and p1
is the proof.
If we omit universes for a moment, a type t
is a term (or expression) such that t : Sort
and that allows you to type expressions e
: e : t
.
That means that Sort
must somehow be a type. This is where universes become important. If we still ignore them we have Sort : Sort
but that invites paradoxes so we have to rank sorts: Sort u : Sort (u+1)
Ah, that makes sense, @Kenny Lau , thanks.
Thanks, @Simon Hudon . If Prop
is Sort 0
, what sort does p0
have? Is it Sort (-1)
?
p0
is not a sort
Is Type
a sort?
Type = Sort 1
I see why you would think that. Sort u
is inhabited by sorts. They are not necessarily inhabited by sorts themselves.
p0 is not a sort
p0 is a sort but it is not equal to Sort u
for any u.
what sort of nonsense is this
It is a sort, it can be on the right hand side of :
It is not a type of sorts though
now I'm having jamais vu on sort
I guess I am thinking that everything has some "universe level", where Sort 1
is level 1, Sort 2
is level 2, etc. Then if you can write a : b
, a
is one level lower than b
. And you bottom out at some point, so that you can no longer write a : b
if b
's level is too low.
So, if Type
is at level 1, U
is at level 0 (though it's not synonymous with Sort 0
), and u0
is at level -1, and we can't write u1 : u0
because u0
has too low of a level. Does that make any sense?
You could think of it that way, that's true. It's important to note that "too low a level" makes a term not a type. We normally reserve that universe terminology for types. There is a problem with thinking of level -1 though
I think of u0
as the value level.
Even though that can be confusing because types are values too.
So, Sort 0
is the lowest level of types, and just below that is the value level. Things that are not types.
We can have some data d
of type t
with t : Sort 3
. You would probably think of it as being in universe 2 but d
is still not the type of any other terms.
OK, yeah, I guess my analogy breaks down there.
But what confuses me is, if Prop : Sort 1
, then Prop
would be at the same level as U
... level 0. So you should be able to have p0 : Prop
, but not p1 : p0
.
That would be going to "too low of a level".

So think of it this way: we're talking about a formal system focused on terms. Some terms t
are types. Every term t'
has a type such that t' : t
. Every type has type t : Sort u
for some universe u
Then in p1 : p0
, p0
must be a type. And p0 : Prop
, but Prop
is synonymous with Sort 0
, so that works.
Exactly
But is Type
synonymous with some sort?
sort 1
OK
And Type 1 = Sort 2
, Type 2 = Sort 3
, and so on?
That's right
So, Prop
is just the universe below Type
.
Yep!
Coming from Haskell, where we have a value level, and a type level (which is like Type
), and a kind level (which is like Type 1
), and then... well, they've sort of unified the levels from Type 1
up... I'm trying to figure out what the analogy is to Prop
there.
What does it mean to have another type level, below what I thought of as the lowest level?
Haskell doesn't really have a type Prop
. types in Prop
are a bit like data type that are guaranteed to be erased at run time
Haskell erases all the types at runtime anyway. Well, except maybe if you use existential types.
What I'm saying is that the values of a type in Prop
are erased at run time, not just the type itself
Gotcha.
Have you ever used the singleton library in Haskell?
No, but I've seen it demonstrated.
Are you saying that the singletons are also values that are erased at runtime?
Not quite no. So far as I know they haven't added erasure for those types. There's still an interesting comparison
I'll take a look at it sometime, thanks.
singleton
hinges on the idea of having type level natural numbers (and other objects). If you have n0
and n1
are type level natural numbers, n0 .<= n1
is the type of a proof that shows that n0 ≤ n1
. It is a data type and it is uninhabited (except for undefined
) unless the value of n0
is less or equal to that of n1
. As types n0
and n1
have only one value (again, except for undefined
): the number they represent.
Prop
s are a bit like those .<=
types (I'm not sure of the exact syntax, sorry)
Correction: the singleton operator is %<=
, not .<=
Does it clarify things?
It seems analogous to Prop, yes. But I'm struggling to line it up with the universes.
When you're getting started, you can mostly ignore universes. You can simply use Type
and Prop
. Higher universes become necessary when you bring in existential types.
OK. I meant that I'm imagining what the universes are in Haskell, and trying to figure out which level these propositions defined with the singleton library live at.
I think the analogy with Haskell's term, type and kind is somewhat wobbly.
I was thinking that Haskell's "type" is like Type
, and the lowest-level kind is like Type 1
.
Or... maybe Type
is a kind, so instances of that are types.
The need for universes in Lean comes from a requirement that the language be a consistent logic. Haskell doesn't have that requirement. I believe the requirement for Haskell to separate terms and types is historical. It started off with an ML style language and made a lot of changes over time including RankNTypes
and higher kinded types.
Right.
If we forget about Haskell's existential types and GADTs, I think its types are Type 0
and its kinds are Type 1
Yeah, makes sense. Except now they have unified Type 1
, Type 2
, and so forth...
So, these type-level naturals would have type Type 1
?
Maybe this will all make more sense if I look at Idris. It should have similar power to Lean but be easier to compare to Haskell.
So, translate concept from Lean to Idris, then from Idris to Haskell. Or vice versa.
Let me give you an example where Type 1
is needed in Lean.
OK
Hi Lyle,
There are three kinds of things in Haskell: terms, types, and kinds. The same trichotomy appears in Lean, but kinds have kinds too
(Σ t : Type 0, list t) : Type 1
. This is basically an existential type. Because it "contains" a Type 0
, it has to live in universe 1
Mario to the rescue! Thanks!
Also kinds are types and types are terms so it forms a subset relation
A kind (or a sort) is a term of the form Sort u
for some u
. A type is a term whose type is a kind, and a term is anything which is well typed
Any term has a type which is a type, which means that if e : t
then t : Sort u
for some u
Here e
and t
are both logically related to u
, which you might call the level of the expression, but obviously their relation to u
is slightly different. t
is level 1 means that t : Sort 1
while e
has type in level 1 since e : t : Sort 1
Right, that was my understanding so far.
In Haskell, there are values, types, and kinds which correspond roughly to terms in types of level 1, types in level 1, and Sort 1
with maybe some variations on it
The algebra of kinds in Haskell is not as rich as Lean's, they only have one universe
I think they call it *
but it is closest to Sort 1
aka Type
Yeah, they actually call it Type
now, in newer versions
So, how do the type-level nats fit into this?
@Mario Carneiro I think it's closer to Type*
because of existential types and GADTs
It's one universe, but it's system F so it is impredicative
and somehow contradiction is avoided by a hair
I thought because of undefined
you couldn't consider the whole thing a consistent logic
That's true too, but System F itself is consistent if you leave out bottom
there are lots of extensions that break consistency because Haskell wants to be turing complete
The TypeInType
extension allows kinds to be as intricate as types, allowing explicit quantification over kind variables, higher-rank kinds, and the use of type synonyms and families in kinds, among other features.
I am not a haskell expert, but from what I can tell, type level nats are a way to have nats as types, so that you can quantify over them without breaking the value/type distinction (and thus get dependent types over nats)
In lean this is not necessary because it's fully dependent anyway. Haskell is getting closer and closer to dependent type theory as time goes on, but it's not there yet
Yeah, since in Haskell you can't write a function from values to types, but you can write a function from types to types, these type-level nats stand in for values, but can be used in functions that produce types.
array A : nat -> Type
is an example of a dependent type family in lean
I see what you're saying about the one universe in Haskell. Traditionally in Haskell, you have kind *
, which is Lean's Sort 1
, and you have types whose type is *
, and you have values of those types. With the TypeInType
extension, the kinds can be treated like types that now have their own types, but it's all still one universe.
Oh right, there was something else I wanted to say about your earlier example: U : Type
and Prop : Type
, so these can be equated (U = Prop
is well formed), but they are nevertheless treated differently, since if u : U
then e : u
is malformed but if p : Prop
then h : p
is okay.
You can't prove that a type "is" a universe, it must be so syntactically
Hmm, OK. Well that's because Prop
is also a sort.
exactly
It is possible to consider type in type in dependent type theory, this would be a relatively small change to a lean-like language, but it is inconsistent by Girard's paradox so it is not usually used in languages that aspire to a sound proof theory
In fact, forgetting the universes is the first step in compiling lean programs
Right
In Haskell you can have kind * -> *
, e.g. List : * -> *
. So in Lean would List
have type Type -> Type
? Then what's the type of Type -> Type
? Is that Type 1
?
Indeed, list
has type list : Type u -> Type u
, which itself has type Type (u+1)
Ah, I see
Well, that helps. I have a lot more to learn about Lean. I've been working through Logic & Proof.
Most type families are universe polymorphic like this, but if we restrict to Type
, we have list.{0} : Type -> Type : Type 1
Most things that you think of as kinds will have type Type 1
if you replace *
with lean's Type
everywhere
Thanks!
In lean this is not necessary because it's fully dependent anyway. Haskell is getting closer and closer to dependent type theory as time goes on, but it's not there yet
I watched a talk by Edward Kmett on youtube recently -- "typeclasses against the world" (about Haskell and typeclasses) and, if I understood correctly, Kmett said at some point that a problem with typeclasses in DTT was that you get diamonds, and in Haskell these couldn't occur.
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC