diff options
Diffstat (limited to 'cheatsheet/raylib_textures.c')
| -rw-r--r-- | cheatsheet/raylib_textures.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cheatsheet/raylib_textures.c b/cheatsheet/raylib_textures.c index 44bf3f8..272c3ea 100644 --- a/cheatsheet/raylib_textures.c +++ b/cheatsheet/raylib_textures.c @@ -1,11 +1,12 @@ // Image loading functions - // NOTE: This functions do not require GPU access + // NOTE: These functions do not require GPU access Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM) Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data) Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png' Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot) + bool IsImageReady(Image image); // Check if an image is ready void UnloadImage(Image image); // Unload image from CPU memory (RAM) bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success @@ -17,7 +18,9 @@ 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, 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 + Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data // Image manipulation functions Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) @@ -31,6 +34,7 @@ void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel + void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) 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 fill); // Resize canvas and fill with color @@ -60,8 +64,10 @@ void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version) void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version) - void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle within an image - void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw circle within an image (Vector version) + void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image + void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version) + void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image + void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version) void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version) void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image @@ -76,7 +82,9 @@ Texture2D LoadTextureFromImage(Image image); // Load texture from image data TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer) + bool IsTextureReady(Texture2D texture); // Check if a texture is ready void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM) + bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM) void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data @@ -91,11 +99,8 @@ void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2 void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle - void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint); // Draw texture quad with tiling and offset parameters - void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint); // Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. - void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters - void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely - void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint); // Draw a textured polygon + void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters + void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely // Color/pixel related functions Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f @@ -104,6 +109,9 @@ Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1] Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1] Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1] + Color ColorTint(Color color, Color tint); // Get color multiplied with another color + Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f + Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value |
