JUCE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
JPEGImageFormat Class Reference

A subclass of ImageFileFormat for reading and writing JPEG files. More...

Inherits ImageFileFormat.

Public Member Functions

 JPEGImageFormat ()
 
 ~JPEGImageFormat ()
 
void setQuality (float newQuality)
 Specifies the quality to be used when writing a JPEG file.
 
String getFormatName ()
 Returns a description of this file format.
 
bool usesFileExtension (const File &possibleFile)
 Returns true if this format uses the file extension of the given file.
 
bool canUnderstand (InputStream &input)
 Returns true if the given stream seems to contain data that this format understands.
 
Image decodeImage (InputStream &input)
 Tries to decode and return an image from the given stream.
 
bool writeImageToStream (const Image &sourceImage, OutputStream &destStream)
 Attempts to write an image to a stream.
 
- Public Member Functions inherited from ImageFileFormat
virtual ~ImageFileFormat ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from ImageFileFormat
static ImageFileFormatfindImageFormatForStream (InputStream &input)
 Tries the built-in formats to see if it can find one to read this stream.
 
static ImageFileFormatfindImageFormatForFileExtension (const File &file)
 Looks for a format that can handle the given file extension.
 
static Image loadFrom (InputStream &input)
 Tries to load an image from a stream.
 
static Image loadFrom (const File &file)
 Tries to load an image from a file.
 
static Image loadFrom (const void *rawData, size_t numBytesOfData)
 Tries to load an image from a block of raw image data.
 
- Protected Member Functions inherited from ImageFileFormat
 ImageFileFormat ()
 Creates an ImageFormat.
 

Detailed Description

A subclass of ImageFileFormat for reading and writing JPEG files.

See Also
ImageFileFormat, PNGImageFormat

Constructor & Destructor Documentation

JPEGImageFormat::JPEGImageFormat ( )
JPEGImageFormat::~JPEGImageFormat ( )

Member Function Documentation

void JPEGImageFormat::setQuality ( float  newQuality)

Specifies the quality to be used when writing a JPEG file.

Parameters
newQualitya value 0 to 1.0, where 0 is low quality, 1.0 is best, or any negative value is "default" quality
String JPEGImageFormat::getFormatName ( )
virtual

Returns a description of this file format.

E.g. "JPEG", "PNG"

Implements ImageFileFormat.

bool JPEGImageFormat::usesFileExtension ( const File possibleFile)
virtual

Returns true if this format uses the file extension of the given file.

Implements ImageFileFormat.

bool JPEGImageFormat::canUnderstand ( InputStream input)
virtual

Returns true if the given stream seems to contain data that this format understands.

The format class should only read the first few bytes of the stream and sniff for header bytes that it understands.

See Also
decodeImage

Implements ImageFileFormat.

Image JPEGImageFormat::decodeImage ( InputStream input)
virtual

Tries to decode and return an image from the given stream.

This will be called for an image format after calling its canUnderStand() method to see if it can handle the stream.

Parameters
inputthe stream to read the data from. The stream will be positioned at the start of the image data (but this may not necessarily be position 0)
Returns
the image that was decoded, or an invalid image if it fails.
See Also
loadFrom

Implements ImageFileFormat.

bool JPEGImageFormat::writeImageToStream ( const Image sourceImage,
OutputStream destStream 
)
virtual

Attempts to write an image to a stream.

To specify extra information like encoding quality, there will be appropriate parameters in the subclasses of the specific file types.

Returns
true if it nothing went wrong.

Implements ImageFileFormat.


The documentation for this class was generated from the following file: