#include <cascade/util/CascadeJpegFile.h>
Public Types | |
enum | ColorSpace { eRGB, eYUV, eYUYV } |
Public Member Functions | |
CascadeJpegFile () | |
virtual | ~CascadeJpegFile () |
destructor | |
bool | Init (CascadeStream *inStream, const CascadeString &inName, ColorSpace inColorSpace=eRGB, bool inDeleteStream=false) |
bool | Init (const char *inFilename, ColorSpace inColorSpace=eRGB) |
u32 | GetBitmapDataSize (u32 inScaledWidth=0, u32 inScaledHeight=0) |
bool | GetBitmapData (u8 *outBitmapData, u32 inBitmapDataSize, CascadeRect &inClipRect, u32 inScaledWidth=0, u32 inScaledHeight=0, u32 inRotationDegrees=0) |
void | AbortDecode (void) |
bool | GetThumbnailData (u8 *outThumbnailData, u32 inThumbnailDataSize, u32 inWidth, u32 inHeight, u32 inRotationDegrees=0) |
void | GetImageInfo (u32 &outWidth, u32 &outHeight, u32 &outBPP) const |
u32 | GetImageWidth (void) const |
u32 | GetImageHeight (void) const |
u32 | GetImageBPP (void) const |
u32 | GetImageRotation (void) const |
const CascadeString & | GetName (void) const |
const CascadeString & | GetImageDate (void) const |
const CascadeString & | GetImageMake (void) const |
const CascadeString & | GetImageModel (void) const |
const CascadeString & | GetImageTitle (void) const |
const CascadeString & | GetImageArtist (void) const |
const CascadeString & | GetImageCopyright (void) const |
u32 | GetImageExposureNumerator (void) const |
u32 | GetImageExposureDenominator (void) const |
float | GetImageFStop (void) const |
bool | GetImageFlashState (bool &outFlashState) const |
bool | HasThumbnail (void) |
Static Public Member Functions | |
static bool | GetScaledImageDims (u32 inDivisor, u32 inWidth, u32 inHeight, u32 &outWidth, u32 &outHeight) |
The CascadeJpegFile class is used to decode JPEG image files. The decoding functions are designed to run in minimum memory, while allowing for rotation, scaling and clipping of the original image into the output data. All of these transformations are performed during the decoding process, which minimizes memory footprint.
|
|
|
default constructor Lightweight. Init must be called to associate the object with a file. |
|
destructor
|
|
abort function Call (from another thread) to cause GetBitmapData to exit early and return false. |
|
decode the image, optionally scaling, cropping and rotating Fills the supplied pointer with the decoded image, scaled, rotated and clipped if desired. You must call Init() before calling this function. Callers should call GetBitmapDataSize first, and allocate a pointer of the appropriate size.
Lastly, callers may pass an optional clipping rectangle. The clipping operation is performed AFTER scaling, but BEFORE rotation. If, for example, the original image is 640x480, and the caller wants the 320x240 rectangle at the center of the image cut out, scaled back up to 640x480, and rotated 90 degrees (yielding an output bitmap that is 480x640), they would call GetBitmapData with: inScaledWidth = 1280 inScaledHeight = 960 inRotationDegrees = 90 inClipRect = CascadeRect(320, 240, 640, 480)
|
|
get size of returned decoded data Call this function after calling Init() to get the size that the decoded bitmap data will be, including any desired scaling. (Call with no arguments or pass zeros to return the image's native size.)
|
|
artist accessor If the EXIF header is present and the Artist tag has been written, this will return a CascadeString which contains the contents of the tag. EXIF does not mandate a format. This is uncommon in digital camera images, but is used by some other systems.
|
|
depth accessor Returns the native bit depth of the image |
|
copyright accessor If the EXIF header is present and the Copyright tag has been written, this will return a CascadeString which contains the contents of the tag. EXIF does not mandate a format. This is uncommon in digital camera images, but is used by some other systems.
|
|
date accessor If the EXIF header is present and the DateTime tag has been written, this will return a CascadeString which contains that date information, in the EXIF-compliant string format.
|
|
exposure denominator accessor If the EXIF header is present and the ExposureTime tag has been written, this will return a u32 representing the denominator of the rational value in the tag. You should also call GetImageExposureNumerator().
|
|
exposure numerator accessor If the EXIF header is present and the ExposureTime tag has been written, this will return a u32 representing the numerator of the rational value in the tag. You should also call GetImageExposureDenominator().
|
|
flash state accessor If the EXIF header is present and the Flash tag has been written, this sets the supplied boolean to true if the flash fired, or false if not. The function returns a boolean specifying whether the flash information was present in the file. If no flash information is present, the outFlashState boolean is not modified.
|
|
f-stop accessor If the EXIF header is present and the FNumber tag has been written, this will return a float representing the f-stop stored in that tag.
|
|
height accessor Returns the native height of the image |
|
get native image data Return the width, height and pixel depth of the main image. Sizes are the native sizes of the image
|
|
make accessor If the EXIF header is present and the Make tag has been written, this will return a CascadeString which contains the contents of the tag. EXIF does not mandate a format. If the file originates from a digital camera, this will typically be "Canon" or "Olympus" or similar.
|
|
model accessor If the EXIF header is present and the Model tag has been written, this will return a CascadeString which contains the contents of the tag. EXIF does not mandate a format. If the file originates from a digital camera, this will typically be "Canon PowerShot S230" or "Olympus C-5050Z" or similar.
|
|
rotation accessor If the EXIF header is present and the orientation tag has been written, this will return the rotation of the image as written into the file. To display the image upright, subtract this value from 360 and pass the result into GetBitmapData as the rotation parameter.
|
|
title accessor If the EXIF header is present and the ImageDescription tag has been written, this will return a CascadeString which contains the contents of the tag. EXIF does not mandate a format. This is uncommon in digital camera images, but is used for image titles by some systems.
|
|
width accessor Returns the native width of the image |
|
name accessor Get the name of the image, as set in Init.
|
|
scaled dimension utility If you're trying to figure out what resolutions you can get from a JPEG image by scaling entirely in the DCT domain (which is high-performance), you may use this function to ensure that your dimensions agree with the JPEG implementation. Valid divisor are 1, 2, 4 and 8. The function is static, so you need not have a CascadeJpegFile instantiated.
|
|
fetch decoded image thumbnail, if present If the image file contains an EXIF-compliant thumbnail, this function decodes it and returns it, optionally scaling and rotating the thumbnail image. You must call Init before calling this function.
|
|
check for image thumbnail Returns true if the EXIF header is present and contains a thumbnail image. |
|
initialization For compatibility with older code, this function provides the old file-based initialization. It creates the stream internally and then calls the CascadeStream-based Init function.
|
|
initialization Initialization. From the supplied stream (which should be opened by the client before calling Init), reads the JPEG and EXIF header information. Returns false if the stream does not point to valid JPEG data, or if data cannot be read. Missing EXIF is not an error condition. If inDeleteStream is true, the stream object will be deleted when this CascadeJpegFile is deleted. Otherwise, the calling function is responsible for disposal of the stream.
|