summaryrefslogtreecommitdiffhomepage
path: root/cheatsheet/raylib_textures.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-07-15 21:26:53 +0200
committerRay <[email protected]>2018-07-15 21:26:53 +0200
commit055b0583d6096a0b621816a9374c412f1e929d3c (patch)
treedfaa3889823d9964e288ef86091fa0b90d8c69df /cheatsheet/raylib_textures.c
parent0a86a8aba37278723138647c4894fd89963195af (diff)
downloadraylib.com-055b0583d6096a0b621816a9374c412f1e929d3c.tar.gz
raylib.com-055b0583d6096a0b621816a9374c412f1e929d3c.zip
Updated cheatsheet
Diffstat (limited to 'cheatsheet/raylib_textures.c')
-rw-r--r--cheatsheet/raylib_textures.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/cheatsheet/raylib_textures.c b/cheatsheet/raylib_textures.c
index 3ccfd9d..58b9a0e 100644
--- a/cheatsheet/raylib_textures.c
+++ b/cheatsheet/raylib_textures.c
@@ -1,50 +1,63 @@
- // Image/Texture2D data loading/unloading functions
- Image LoadImage(const char *fileName); // Load an image into CPU memory (RAM)
- Image LoadImageEx(Color *pixels, int width, int height); // Load image data from Color array data (RGBA - 32bit)
+ // Image/Texture2D data loading/unloading/saving functions
+ Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
+ Image LoadImageEx(Color *pixels, int width, int height); // Load image from Color array data (RGBA - 32bit)
Image LoadImagePro(void *data, int width, int height, int format); // Load image from raw data with parameters
- Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file
- Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
- Texture2D LoadTextureFromImage(Image image); // Load a texture from image data
- RenderTexture2D LoadRenderTexture(int width, int height); // Load a texture to be used for rendering
+ Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
+ void ExportImage(const char *fileName, Image image); // Export image as a PNG file
+ Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
+ Texture2D LoadTextureFromImage(Image image); // Load texture from image data
+ RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
- void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
- void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory
+ void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
+ void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
+ Vector4 *GetImageDataNormalized(Image image); // Get pixel data from image as Vector4 array (float normalized)
+ int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture)
Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
- void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data
- void SaveImageAs(const char *fileName, Image image); // Save image to a PNG file
-
+ void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
+
// Image manipulation functions
+ Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
- void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
- Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
+ void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color
+ void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value
+ void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
- void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering)
- void ImageResizeNN(Image *image,int newWidth,int newHeight); // Resize and image (Nearest-Neighbor scaling algorithm)
+ void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (bilinear filtering)
+ void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
+ void ImageResizeCanvas(Image *image, int newWidth, int newHeight,
+ int offsetX, int offsetY, Color color); // Resize canvas and fill with color
+ void ImageMipmaps(Image *image); // Generate all mipmap levels for a provided image
+ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
- Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font)
+ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
+ void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color); // Draw rectangle within an image
void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
- void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text,
- int fontSize, int spacing, Color color); // Draw text (custom sprite font) within image
+ void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text,
+ float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination)
void ImageFlipVertical(Image *image); // Flip image vertically
void ImageFlipHorizontal(Image *image); // Flip image horizontally
+ void ImageRotateCW(Image *image); // Rotate image clockwise 90deg
+ void ImageRotateCCW(Image *image); // Rotate image counter-clockwise 90deg
void ImageColorTint(Image *image, Color color); // Modify image color: tint
void ImageColorInvert(Image *image); // Modify image color: invert
- void ImageColorGrayscale(Image *image); // Modify bimage color: grayscale
+ void ImageColorGrayscale(Image *image); // Modify image color: grayscale
void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
+ void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color
// Image generation functions
+ Image GenImageColor(int width, int height, Color color); // Generate image: plain color
Image GenImageGradientV(int width, int height, Color top, Color bottom); // Generate image: vertical gradient
Image GenImageGradientH(int width, int height, Color left, Color right); // Generate image: horizontal gradient
Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
- Image GenImagePerlinNoise(int width, int height, float scale); // Generate image: perlin noise
+ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm. Bigger tileSize means bigger cells
// Texture2D configuration functions