mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Move decoder-agnostic love.image code out of the magpie backend folder.
--HG-- branch : minor
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
#include "ImageData.h"
|
||||
#include "CompressedImageData.h"
|
||||
|
||||
// C++
|
||||
#include <list>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
@@ -46,17 +49,19 @@ public:
|
||||
|
||||
static love::Type type;
|
||||
|
||||
virtual ~Image() {}
|
||||
Image();
|
||||
virtual ~Image();
|
||||
|
||||
// Implements Module.
|
||||
virtual ModuleType getModuleType() const { return M_IMAGE; }
|
||||
ModuleType getModuleType() const override { return M_IMAGE; }
|
||||
const char *getName() const override;
|
||||
|
||||
/**
|
||||
* Creates new ImageData from FileData.
|
||||
* @param data The FileData containing the encoded image data.
|
||||
* @return The new ImageData.
|
||||
**/
|
||||
virtual ImageData *newImageData(love::filesystem::FileData *data) = 0;
|
||||
ImageData *newImageData(love::filesystem::FileData *data);
|
||||
|
||||
/**
|
||||
* Creates empty ImageData with the given size.
|
||||
@@ -64,7 +69,7 @@ public:
|
||||
* @param height The height of the ImageData.
|
||||
* @return The new ImageData.
|
||||
**/
|
||||
virtual ImageData *newImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8) = 0;
|
||||
ImageData *newImageData(int width, int height, PixelFormat format = PIXELFORMAT_RGBA8);
|
||||
|
||||
/**
|
||||
* Creates empty ImageData with the given size.
|
||||
@@ -75,28 +80,36 @@ public:
|
||||
* copy it.
|
||||
* @return The new ImageData.
|
||||
**/
|
||||
virtual ImageData *newImageData(int width, int height, PixelFormat format, void *data, bool own = false) = 0;
|
||||
ImageData *newImageData(int width, int height, PixelFormat format, void *data, bool own = false);
|
||||
|
||||
/**
|
||||
* Creates new CompressedImageData from FileData.
|
||||
* @param data The FileData containing the compressed image data.
|
||||
* @return The new CompressedImageData.
|
||||
**/
|
||||
virtual CompressedImageData *newCompressedData(love::filesystem::FileData *data) = 0;
|
||||
CompressedImageData *newCompressedData(love::filesystem::FileData *data);
|
||||
|
||||
/**
|
||||
* Determines whether a FileData is Compressed image data or not.
|
||||
* @param data The FileData to test.
|
||||
**/
|
||||
virtual bool isCompressed(love::filesystem::FileData *data) = 0;
|
||||
bool isCompressed(love::filesystem::FileData *data);
|
||||
|
||||
std::vector<StrongRef<ImageData>> newCubeFaces(ImageData *src);
|
||||
std::vector<StrongRef<ImageData>> newVolumeLayers(ImageData *src);
|
||||
|
||||
const std::list<FormatHandler *> &getFormatHandlers() const;
|
||||
|
||||
private:
|
||||
|
||||
ImageData *newPastedImageData(ImageData *src, int sx, int sy, int w, int h);
|
||||
|
||||
// Image format handlers we can use for decoding and encoding ImageData.
|
||||
std::list<FormatHandler *> formatHandlers;
|
||||
|
||||
// Compressed image format handers we can use for parsing CompressedImageData.
|
||||
std::list<CompressedFormatHandler *> compressedFormatHandlers;
|
||||
|
||||
}; // Image
|
||||
|
||||
} // image
|
||||
|
||||
Reference in New Issue
Block a user