openshot-audio  0.1.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
juce::ImageFileFormat Class Referenceabstract

#include <juce_graphics.h>

Inheritance diagram for juce::ImageFileFormat:
juce::GIFImageFormat juce::JPEGImageFormat juce::PNGImageFormat

Public Member Functions

virtual ~ImageFileFormat ()
 
virtual String getFormatName ()=0
 
virtual bool canUnderstand (InputStream &input)=0
 
virtual bool usesFileExtension (const File &possibleFile)=0
 
virtual Image decodeImage (InputStream &input)=0
 
virtual bool writeImageToStream (const Image &sourceImage, OutputStream &destStream)=0
 

Static Public Member Functions

static ImageFileFormatfindImageFormatForStream (InputStream &input)
 
static ImageFileFormatfindImageFormatForFileExtension (const File &file)
 
static Image loadFrom (InputStream &input)
 
static Image loadFrom (const File &file)
 
static Image loadFrom (const void *rawData, size_t numBytesOfData)
 

Protected Member Functions

 ImageFileFormat ()
 

Detailed Description

Base-class for codecs that can read and write image file formats such as PNG, JPEG, etc.

This class also contains static methods to make it easy to load images from files, streams or from memory.

See also
Image, ImageCache

Constructor & Destructor Documentation

◆ ImageFileFormat()

juce::ImageFileFormat::ImageFileFormat ( )
inlineprotected

Creates an ImageFormat.

◆ ~ImageFileFormat()

virtual juce::ImageFileFormat::~ImageFileFormat ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ canUnderstand()

virtual bool juce::ImageFileFormat::canUnderstand ( InputStream input)
pure 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.

Note that this will advance the stream and leave it in a new position, so if you're planning on re-using it, you may want to rewind it after calling this method.

See also
decodeImage

Implemented in juce::GIFImageFormat, juce::JPEGImageFormat, and juce::PNGImageFormat.

◆ decodeImage()

virtual Image juce::ImageFileFormat::decodeImage ( InputStream input)
pure 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

Implemented in juce::GIFImageFormat, juce::JPEGImageFormat, and juce::PNGImageFormat.

◆ findImageFormatForFileExtension()

ImageFileFormat * ImageFileFormat::findImageFormatForFileExtension ( const File file)
static

Looks for a format that can handle the given file extension. There are currently built-in formats for PNG, JPEG and GIF formats. The object that is returned should not be deleted by the caller.

◆ findImageFormatForStream()

ImageFileFormat * ImageFileFormat::findImageFormatForStream ( InputStream input)
static

Tries the built-in formats to see if it can find one to read this stream. There are currently built-in decoders for PNG, JPEG and GIF formats. The object that is returned should not be deleted by the caller.

See also
canUnderstand, decodeImage, loadFrom

◆ getFormatName()

virtual String juce::ImageFileFormat::getFormatName ( )
pure virtual

Returns a description of this file format.

E.g. "JPEG", "PNG"

Implemented in juce::GIFImageFormat, juce::JPEGImageFormat, and juce::PNGImageFormat.

◆ loadFrom() [1/3]

Image ImageFileFormat::loadFrom ( InputStream input)
static

Tries to load an image from a stream.

This will use the findImageFormatForStream() method to locate a suitable codec, and use that to load the image.

Returns
the image that was decoded, or an invalid image if it fails.

◆ loadFrom() [2/3]

Image ImageFileFormat::loadFrom ( const File file)
static

Tries to load an image from a file.

This will use the findImageFormatForStream() method to locate a suitable codec, and use that to load the image.

Returns
the image that was decoded, or an invalid image if it fails.

◆ loadFrom() [3/3]

Image ImageFileFormat::loadFrom ( const void *  rawData,
size_t  numBytesOfData 
)
static

Tries to load an image from a block of raw image data.

This will use the findImageFormatForStream() method to locate a suitable codec, and use that to load the image.

Returns
the image that was decoded, or an invalid image if it fails.

◆ usesFileExtension()

virtual bool juce::ImageFileFormat::usesFileExtension ( const File possibleFile)
pure virtual

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

Implemented in juce::GIFImageFormat, juce::JPEGImageFormat, and juce::PNGImageFormat.

◆ writeImageToStream()

virtual bool juce::ImageFileFormat::writeImageToStream ( const Image sourceImage,
OutputStream destStream 
)
pure 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.

Implemented in juce::GIFImageFormat, juce::JPEGImageFormat, and juce::PNGImageFormat.


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