A subclass of ImageFileFormat for reading and writing WebP files.
Both lossy and lossless WebP images can be read and written. Writing is lossy by default; call setLossless() to change that.
Animated WebP files can be read, but as ImageFileFormat has no concept of multiple frames, only the first frame is returned. Writing animations is not supported.
Public Member Functions | |
| void | setQuality (float newQuality) |
| Specifies the quality to be used when writing a lossy WebP file. | |
| void | setLossless (bool shouldBeLossless) |
| Specifies whether images should be written losslessly. | |
| String | getFormatName () override |
| Returns a description of this file format. | |
| bool | usesFileExtension (const File &) override |
| Returns true if this format uses the file extension of the given file. | |
| bool | canUnderstand (InputStream &) override |
| Returns true if the given stream seems to contain data that this format understands. | |
| Image | decodeImage (InputStream &) override |
| Tries to decode and return an image from the given stream. | |
| bool | writeImageToStream (const Image &, OutputStream &) override |
| Attempts to write an image to a stream. | |
| Public Member Functions inherited from juce::ImageFileFormat | |
| virtual | ~ImageFileFormat ()=default |
| Destructor. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from juce::ImageFileFormat | |
| static ImageFileFormat * | findImageFormatForStream (InputStream &input) |
| Tries the built-in formats to see if it can find one to read this stream. | |
| static ImageFileFormat * | findImageFormatForFileExtension (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 juce::ImageFileFormat | |
| ImageFileFormat ()=default | |
| Creates an ImageFormat. | |
| void juce::WebPImageFormat::setQuality | ( | float | newQuality | ) |
Specifies the quality to be used when writing a lossy WebP file.
| newQuality | a value 0 to 1.0, where 0 is low quality, 1.0 is best, the default value is 0.9 |
This has no effect when writing losslessly.
| void juce::WebPImageFormat::setLossless | ( | bool | shouldBeLossless | ) |
Specifies whether images should be written losslessly.
This is false by default, meaning that written images are lossy, using the quality given to setQuality().
|
overridevirtual |
|
overridevirtual |
Returns true if this format uses the file extension of the given file.
Implements juce::ImageFileFormat.
|
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.
Implements juce::ImageFileFormat.
|
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.
| input | the 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) |
Implements juce::ImageFileFormat.
|
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.
Implements juce::ImageFileFormat.