mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Move Color.h from modules/graphics/ to common/
--HG-- branch : minor
This commit is contained in:
@@ -38,13 +38,6 @@ namespace love
|
||||
namespace image
|
||||
{
|
||||
|
||||
// Pixel format structure.
|
||||
struct pixel
|
||||
{
|
||||
// Red, green, blue, alpha.
|
||||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
union Pixel
|
||||
{
|
||||
uint8 rgba8[4];
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
// LOVE
|
||||
#include "STBHandler.h"
|
||||
#include "image/ImageData.h"
|
||||
#include "common/Color.h"
|
||||
|
||||
static void loveSTBIAssert(bool test, const char *teststr)
|
||||
{
|
||||
@@ -49,6 +50,8 @@ namespace image
|
||||
namespace magpie
|
||||
{
|
||||
|
||||
static_assert(sizeof(Color) == 4, "sizeof(Color) must equal 4 bytes!");
|
||||
|
||||
bool STBHandler::canDecode(love::filesystem::FileData *data)
|
||||
{
|
||||
int w = 0;
|
||||
@@ -144,7 +147,7 @@ FormatHandler::EncodedImage STBHandler::encode(const DecodedImage &img, EncodedF
|
||||
memcpy(encimg.data + headerlen, img.data, img.width * img.height * bpp);
|
||||
|
||||
// convert the pixels from RGBA to BGRA.
|
||||
pixel *encodedpixels = (pixel *) (encimg.data + headerlen);
|
||||
Color *encodedpixels = (Color *) (encimg.data + headerlen);
|
||||
for (int y = 0; y < img.height; y++)
|
||||
{
|
||||
for (int x = 0; x < img.width; x++)
|
||||
|
||||
Reference in New Issue
Block a user