Image codec to handle DDS files.
More...
#include <Luminous/ImageCodecDDS.hpp>
|
| bool | canRead (QFile &file) |
| | Can this codec read the given file? The method should examine the file contents and return true if this codec can read it. More... |
| |
| QString | extensions () const |
| | Get the extensions associated with this codec in a string separated by spaces. More... |
| |
| QString | name () const |
| | Return name of the codec. More... |
| |
| bool | ping (ImageInfo &info, QFile &file) |
| | Pinging an image just reads the width, height, and pixel format from a file. More... |
| |
| bool | read (Image &image, QFile &file) |
| | Read the image data from the given file. More... |
| |
| bool | read (CompressedImage &image, QFile &file, int level=0) |
| | Read compressed image data from the given file. More... |
| |
| bool | write (const Image &image, QFile &file) |
| | Store the given Image into a file. More... |
| |
| bool | writeMipmaps (const QString &filename, PixelFormat::Compression format, Nimble::Size size, int mipmaps, const std::vector< unsigned char > &dxt) |
| | Save the DXT compressed image data to a DDS file. More... |
| |
Image codec to handle DDS files.
Gets the required buffer size in pixels for the DDS image.
DXT compression is done in 4x4 blocks. This function gets the required image size in pixels by rounding the size up to nearest one divisible by four.
- Parameters
-
| size | size of the original image |
- Returns
- size required for the DXT compression
| bool Luminous::ImageCodecDDS::canRead |
( |
QFile & |
file | ) |
|
|
virtual |
Can this codec read the given file? The method should examine the file contents and return true if this codec can read it.
The function must not change the current position in the file.
- Parameters
-
- Returns
- true if the codec can read the image data stored in the file, false if it can't
Implements Luminous::ImageCodec.
| QString Luminous::ImageCodecDDS::extensions |
( |
| ) |
const |
|
virtual |
Get the extensions associated with this codec in a string separated by spaces.
- Returns
- extensions separated by spaces (eg. "jpeg jpg")
Implements Luminous::ImageCodec.
Gets the size of a single line in bytes.
- Parameters
-
| size | image dimensions |
| format | compression format used |
- Returns
- size of a line in bytes
| QString Luminous::ImageCodecDDS::name |
( |
| ) |
const |
|
virtual |
| bool Luminous::ImageCodecDDS::ping |
( |
ImageInfo & |
info, |
|
|
QFile & |
file |
|
) |
| |
|
virtual |
Pinging an image just reads the width, height, and pixel format from a file.
- Parameters
-
| info | ImageInfo struct to store the read info to |
| file | file to read from |
- Returns
- true if the reading succeeded, false otherwise
Implements Luminous::ImageCodec.
| bool Luminous::ImageCodecDDS::read |
( |
Image & |
image, |
|
|
QFile & |
file |
|
) |
| |
|
virtual |
Read the image data from the given file.
- Parameters
-
| image | Image to store the data into |
| file | file to read the data from |
- Returns
- true if the file was decoded successfully, false otherwise
Implements Luminous::ImageCodec.
| bool Luminous::ImageCodecDDS::read |
( |
CompressedImage & |
image, |
|
|
QFile & |
file, |
|
|
int |
level = 0 |
|
) |
| |
|
virtual |
Read compressed image data from the given file.
- Parameters
-
| image | image to read to |
| file | file to read from |
| level | mipmap level to read |
- Returns
- true if the file was decoded successfully, false otherwise
Reimplemented from Luminous::ImageCodec.
| bool Luminous::ImageCodecDDS::write |
( |
const Image & |
image, |
|
|
QFile & |
file |
|
) |
| |
|
virtual |
Store the given Image into a file.
- Parameters
-
| image | Image to store |
| file | file to write to |
- Returns
- true if the encoding was successful, false otherwise
Implements Luminous::ImageCodec.
Save the DXT compressed image data to a DDS file.
- Parameters
-
| filename | file to save to |
| format | compression format |
| size | size of the image in pixels |
| mipmaps | number of mipmap levels in the data |
| dxt | compressed image data |
- Returns
- true if the writing succeeded