mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Unify pixel format enums for ImageData, CompressedImageData, and Canvas into a single PixelFormat enum.
Replace love.graphics.getRawImageFormats and love.graphics.getCompressedImageFormats with love.graphics.getImageFormats. --HG-- branch : minor
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2016 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stddef.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
enum PixelFormat
|
||||
{
|
||||
PIXELFORMAT_UNKNOWN,
|
||||
|
||||
// these are converted to an actual format by love
|
||||
PIXELFORMAT_NORMAL,
|
||||
PIXELFORMAT_HDR,
|
||||
|
||||
// "regular" formats
|
||||
PIXELFORMAT_R8,
|
||||
PIXELFORMAT_RG8,
|
||||
PIXELFORMAT_RGBA8,
|
||||
PIXELFORMAT_sRGBA8,
|
||||
PIXELFORMAT_R16,
|
||||
PIXELFORMAT_RG16,
|
||||
PIXELFORMAT_RGBA16,
|
||||
PIXELFORMAT_R16F,
|
||||
PIXELFORMAT_RG16F,
|
||||
PIXELFORMAT_RGBA16F,
|
||||
PIXELFORMAT_R32F,
|
||||
PIXELFORMAT_RG32F,
|
||||
PIXELFORMAT_RGBA32F,
|
||||
|
||||
// packed formats
|
||||
PIXELFORMAT_RGBA4,
|
||||
PIXELFORMAT_RGB5A1,
|
||||
PIXELFORMAT_RGB565,
|
||||
PIXELFORMAT_RGB10A2,
|
||||
PIXELFORMAT_RG11B10F,
|
||||
|
||||
// compressed formats
|
||||
PIXELFORMAT_DXT1,
|
||||
PIXELFORMAT_DXT3,
|
||||
PIXELFORMAT_DXT5,
|
||||
PIXELFORMAT_BC4,
|
||||
PIXELFORMAT_BC4s,
|
||||
PIXELFORMAT_BC5,
|
||||
PIXELFORMAT_BC5s,
|
||||
PIXELFORMAT_BC6H,
|
||||
PIXELFORMAT_BC6Hs,
|
||||
PIXELFORMAT_BC7,
|
||||
PIXELFORMAT_PVR1_RGB2,
|
||||
PIXELFORMAT_PVR1_RGB4,
|
||||
PIXELFORMAT_PVR1_RGBA2,
|
||||
PIXELFORMAT_PVR1_RGBA4,
|
||||
PIXELFORMAT_ETC1,
|
||||
PIXELFORMAT_ETC2_RGB,
|
||||
PIXELFORMAT_ETC2_RGBA,
|
||||
PIXELFORMAT_ETC2_RGBA1,
|
||||
PIXELFORMAT_EAC_R,
|
||||
PIXELFORMAT_EAC_Rs,
|
||||
PIXELFORMAT_EAC_RG,
|
||||
PIXELFORMAT_EAC_RGs,
|
||||
PIXELFORMAT_ASTC_4x4,
|
||||
PIXELFORMAT_ASTC_5x4,
|
||||
PIXELFORMAT_ASTC_5x5,
|
||||
PIXELFORMAT_ASTC_6x5,
|
||||
PIXELFORMAT_ASTC_6x6,
|
||||
PIXELFORMAT_ASTC_8x5,
|
||||
PIXELFORMAT_ASTC_8x6,
|
||||
PIXELFORMAT_ASTC_8x8,
|
||||
PIXELFORMAT_ASTC_10x5,
|
||||
PIXELFORMAT_ASTC_10x6,
|
||||
PIXELFORMAT_ASTC_10x8,
|
||||
PIXELFORMAT_ASTC_10x10,
|
||||
PIXELFORMAT_ASTC_12x10,
|
||||
PIXELFORMAT_ASTC_12x12,
|
||||
|
||||
PIXELFORMAT_MAX_ENUM
|
||||
};
|
||||
|
||||
bool getConstant(PixelFormat in, const char *&out);
|
||||
bool getConstant(const char *in, PixelFormat &out);
|
||||
|
||||
/**
|
||||
* Gets whether the specified pixel format is a compressed type.
|
||||
**/
|
||||
bool isPixelFormatCompressed(PixelFormat format);
|
||||
|
||||
/**
|
||||
* Gets the size in bytes of the specified pixel format.
|
||||
* NOTE: Currently returns 0 for compressed formats.
|
||||
**/
|
||||
size_t getPixelFormatSize(PixelFormat format);
|
||||
|
||||
} // love
|
||||
Reference in New Issue
Block a user