JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::GIFImageFormat Class Reference

A subclass of ImageFileFormat for reading GIF files. More...

#include <juce_ImageFileFormat.h>

Inheritance diagram for juce::GIFImageFormat:
Collaboration diagram for juce::GIFImageFormat:

Public Member Functions

 GIFImageFormat ()
 
 ~GIFImageFormat () override
 
bool canUnderstand (InputStream &) override
 Returns true if the given stream seems to contain data that this format understands. More...
 
Image decodeImage (InputStream &) override
 Tries to decode and return an image from the given stream. More...
 
String getFormatName () override
 Returns a description of this file format. More...
 
bool usesFileExtension (const File &) override
 Returns true if this format uses the file extension of the given file. More...
 
bool writeImageToStream (const Image &, OutputStream &) override
 Attempts to write an image to a stream. More...
 

Static Public Member Functions

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

Detailed Description

A subclass of ImageFileFormat for reading GIF files.

See also
ImageFileFormat, PNGImageFormat, JPEGImageFormat

@tags{Graphics}

Constructor & Destructor Documentation

◆ GIFImageFormat()

juce::GIFImageFormat::GIFImageFormat ( )

◆ ~GIFImageFormat()

juce::GIFImageFormat::~GIFImageFormat ( )
override

Member Function Documentation

◆ canUnderstand()

bool juce::GIFImageFormat::canUnderstand ( InputStream input)
overridevirtual

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

Implements juce::ImageFileFormat.

◆ decodeImage()

Image juce::GIFImageFormat::decodeImage ( InputStream input)
overridevirtual

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 juce::ImageFileFormat.

◆ findImageFormatForFileExtension()

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

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()

static ImageFileFormat* juce::ImageFileFormat::findImageFormatForStream ( InputStream input)
staticinherited

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()

String juce::GIFImageFormat::getFormatName ( )
overridevirtual

Returns a description of this file format.

E.g. "JPEG", "PNG"

Implements juce::ImageFileFormat.

◆ loadFrom() [1/3]

static Image juce::ImageFileFormat::loadFrom ( const File file)
staticinherited

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() [2/3]

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

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.

◆ loadFrom() [3/3]

static Image juce::ImageFileFormat::loadFrom ( InputStream input)
staticinherited

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.

◆ usesFileExtension()

bool juce::GIFImageFormat::usesFileExtension ( const File possibleFile)
overridevirtual

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

Implements juce::ImageFileFormat.

◆ writeImageToStream()

bool juce::GIFImageFormat::writeImageToStream ( const Image sourceImage,
OutputStream destStream 
)
overridevirtual

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 juce::ImageFileFormat.


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