2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-10-13 04:51:53 -04:00
Files
raylib-cs/Raylib-cs/types/Image.cs
Matorio 75aabd1cc0 Explicit core types and autonomous types. (#304)
* All the "var" variables were changed to explicit types on the raylib class
* "MakeDirectory" overload, and string version of "GetApplicationDirectory" and "GetWorkingDirectory" methods
* Added "Dimensions" property to "Texture2D"
* New overloads for the "LoadFileData" and "SaveFileData" methods
* Raymath's const "NativeLibName" is now referencing to "Raylib.NativeLibName"
* Color constructors are more readable
* Added "Dimensions" property to "Image"
* Changed all the "var" for explicit types on the "Logging" class
* Changed "Int64" for "long" on CBool, and using constructor on the operators instead setting the value manually
* Added indexer to "FilePathLists"
* Changed all "var" for explicit types on "Utf8Buffer"
* New "GetRandomSequence" method overloads in "Raylib.Utils" acepting "int" and "float"
* Added new extension "byte.Lerp"
* Added new extension "Log" for "TraceLogLevel"
* Constructors on Color no longer just truncate the float value, but also round it (+ 0.5f)
* New static method on Color, "Color.Lerp"
* Added static method "FromHSV" to Color
* Added new getter method "GetHSV" on Color
* Added index security on the FilePathList indexer
* Added Rectangle extension
* Added "MoveTowards" extensions to RaylibExtensions
* Added "TranslateLocal" and "TranslateGlobal" to Transform
* Removed unnecessary "partial" declarations
* Updating calls and docs
* Moved the "AudioCallback" delegate into the "AudioMixed.cs" File
* Properties and structs marked as read-only on the "Model.cs" file
* Updated the "README.md" to mentions Raylib-cs targets net6.0 and net8.0 (and also explicitly added that the
"STAThread" attribute comes from the "System" namespace)
* Added a few sizing utils to "Rectangle"
* Added "GetScreenCenter" to "Raylib.Utils"
2025-09-21 09:09:38 +01:00

169 lines
3.0 KiB
C#

using System.Runtime.InteropServices;
using System.Numerics;
namespace Raylib_cs;
/// <summary>
/// Pixel formats<br/>
/// NOTE: Support depends on OpenGL version and platform
/// </summary>
public enum PixelFormat
{
/// <summary>
/// 8 bit per pixel (no alpha)
/// </summary>
UncompressedGrayscale = 1,
/// <summary>
/// 8*2 bpp (2 channels)
/// </summary>
UncompressedGrayAlpha,
/// <summary>
/// 16 bpp
/// </summary>
UncompressedR5G6B5,
/// <summary>
/// 24 bpp
/// </summary>
UncompressedR8G8B8,
/// <summary>
/// 16 bpp (1 bit alpha)
/// </summary>
UncompressedR5G5B5A1,
/// <summary>
/// 16 bpp (4 bit alpha)
/// </summary>
UncompressedR4G4B4A4,
/// <summary>
/// 32 bpp
/// </summary>
UncompressedR8G8B8A8,
/// <summary>
/// 32 bpp (1 channel - float)
/// </summary>
UncompressedR32,
/// <summary>
/// 32*3 bpp (3 channels - float)
/// </summary>
UncompressedR32G32B32,
/// <summary>
/// 32*4 bpp (4 channels - float)
/// </summary>
UncompressedR32G32B32A32,
/// <summary>
/// 16 bpp (1 channel - half float)
/// </summary>
UncompressedR16,
/// <summary>
/// 16*3 bpp (3 channels - half float)
/// </summary>
UncompressedR16G16B16,
/// <summary>
/// 16*4 bpp (4 channels - half float)
/// </summary>
UncompressedR16G16B16A16,
/// <summary>
/// 4 bpp (no alpha)
/// </summary>
CompressedDxt1Rgb,
/// <summary>
/// 4 bpp (1 bit alpha)
/// </summary>
CompressedDxt1Rgba,
/// <summary>
/// 8 bpp
/// </summary>
CompressedDxt3Rgba,
/// <summary>
/// 8 bpp
/// </summary>
CompressedDxt5Rgba,
/// <summary>
/// 4 bpp
/// </summary>
CompressedEtc1Rgb,
/// <summary>
/// 4 bpp
/// </summary>
CompressedEtc2Rgb,
/// <summary>
/// 8 bpp
/// </summary>
CompressedEtc2EacRgba,
/// <summary>
/// 4 bpp
/// </summary>
CompressedPvrtRgb,
/// <summary>
/// 4 bpp
/// </summary>
CompressedPvrtRgba,
/// <summary>
/// 8 bpp
/// </summary>
CompressedAstc4X4Rgba,
/// <summary>
/// 2 bpp
/// </summary>
CompressedAstc8X8Rgba
}
/// <summary>
/// Image, pixel data stored in CPU memory (RAM)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct Image
{
/// <summary>
/// Image raw data
/// </summary>
public void* Data;
/// <summary>
/// Image base width
/// </summary>
public int Width;
/// <summary>
/// Image base height
/// </summary>
public int Height;
/// <summary>
/// Mipmap levels, 1 by default
/// </summary>
public int Mipmaps;
/// <summary>
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat Format;
/// <summary>
/// Get width and height packed in a Vector2
/// </summary>
public readonly Vector2 Dimensions => new Vector2(Width, Height);
}