Images (CPU), textures (GPU) and colors. 125 functions, from raylib's rtextures.
Image loading functions
Load image from file into CPU memory (RAM)
Zigfn loadImage(fileName: [:0]const u8) error{LoadFailed}!Image
CImage LoadImage(const char *fileName);
Used in textures_image_drawing, textures_image_loading, textures_image_processing, textures_image_text, textures_to_image, textures_blend_modes and 11 more.
Load image from RAW file data
Zigfn loadImageRaw(fileName: [:0]const u8, width: i32, height: i32, format: PixelFormat, headerSize: i32) error{LoadFailed}!Image
CImage LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize);
Used in textures_raw_data.
Load image sequence from file (frames appended to image.data)
Load image sequence from file (frames appended to image.data).
Zigfn loadImageAnim(fileName: [:0]const u8) error{LoadFailed}!ImageAnim
CImage LoadImageAnim(const char *fileName, int *frames);
Used in textures_gif_player.
Load image sequence from memory buffer
Load image sequence from memory buffer (fileType: ".gif").
Zigfn loadImageAnimFromMemory(fileType: [:0]const u8, fileData: []const u8) error{LoadFailed}!ImageAnim
CImage LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int *frames);
Load image from memory buffer, fileType refers to extension: i.e. '.png'
Zigfn loadImageFromMemory(fileType: [:0]const u8, fileData: []const u8) error{LoadFailed}!Image
CImage LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize);
Load image from GPU texture data
Zigfn loadImageFromTexture(texture: Texture2D) error{LoadFailed}!Image
CImage LoadImageFromTexture(Texture2D texture);
Used in textures_to_image, textures_mouse_painting, shaders_game_of_life.
Load image from screen buffer (screenshot)
Zigfn loadImageFromScreen() error{LoadFailed}!Image
CImage LoadImageFromScreen(void);
Used in core_screen_recording.
Check if an image is valid (data and parameters)
Zigfn isImageValid(image: Image) bool
Cbool IsImageValid(Image image);
Used in textures_clipboard_image.
Unload image from CPU memory (RAM)
Zigfn unloadImage(image: Image) void
Cvoid UnloadImage(Image image);
Used in core_screen_recording, shapes_top_down_lights, textures_clipboard_image, textures_magnifying_glass, textures_image_drawing, textures_image_generation and 29 more.
Export image data to file, returns true on success
Zigfn exportImage(image: Image, fileName: [:0]const u8) bool
Cbool ExportImage(Image image, const char *fileName);
Used in textures_mouse_painting.
Export image to memory buffer, memory must be MemFree()
Export image to memory buffer (fileType: ".png"...). Free with `memFree`.
Zigfn exportImageToMemory(image: Image, fileType: [:0]const u8) error{ExportFailed}![]u8
Cunsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize);
Export image as code file defining an array of bytes, returns true on success
Zigfn exportImageAsCode(image: Image, fileName: [:0]const u8) bool
Cbool ExportImageAsCode(Image image, const char *fileName);
Image generation functions
Generate image: plain color
Zigfn genImageColor(width: i32, height: i32, color: Color) Image
CImage GenImageColor(int width, int height, Color color);
Used in textures_magnifying_glass, textures_screen_buffer, textures_cellular_automata, models_mesh_uv_painting, models_procedural_decals, shaders_texture_rendering and 4 more.
Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient
Zigfn genImageGradientLinear(width: i32, height: i32, direction: i32, start: Color, end: Color) Image
CImage GenImageGradientLinear(int width, int height, int direction, Color start, Color end);
Used in textures_image_generation.
Generate image: radial gradient
Zigfn genImageGradientRadial(width: i32, height: i32, density: f32, inner: Color, outer: Color) Image
CImage GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);
Used in textures_image_generation.
Generate image: square gradient
Zigfn genImageGradientSquare(width: i32, height: i32, density: f32, inner: Color, outer: Color) Image
CImage GenImageGradientSquare(int width, int height, float density, Color inner, Color outer);
Used in textures_image_generation.
Generate image: checked
Zigfn genImageChecked(width: i32, height: i32, checksX: i32, checksY: i32, col1: Color, col2: Color) Image
CImage GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2);
Used in shapes_top_down_lights, textures_image_generation, textures_image_channel, models_mesh_generation, models_procedural_decals.
Generate image: white noise
Zigfn genImageWhiteNoise(width: i32, height: i32, factor: f32) Image
CImage GenImageWhiteNoise(int width, int height, float factor);
Used in textures_image_generation.
Generate image: perlin noise
Zigfn genImagePerlinNoise(width: i32, height: i32, offsetX: i32, offsetY: i32, scale: f32) Image
CImage GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale);
Used in textures_image_generation, shaders_vertex_displacement.
Generate image: cellular algorithm, bigger tileSize means bigger cells
Zigfn genImageCellular(width: i32, height: i32, tileSize: i32) Image
CImage GenImageCellular(int width, int height, int tileSize);
Used in textures_image_generation.
Generate image: grayscale image from text data
Zigfn genImageText(width: i32, height: i32, text: [:0]const u8) Image
CImage GenImageText(int width, int height, const char *text);
Image manipulation functions
Create an image duplicate (useful for transformations)
Zigfn imageCopy(image: Image) Image
CImage ImageCopy(Image image);
Used in textures_image_processing, textures_image_kernel.
Create an image from another image piece
Zigfn imageFromImage(image: Image, rec: Rectangle) Image
CImage ImageFromImage(Image image, Rectangle rec);
Used in models_rotating_cube.
Create an image from a selected channel of another image (GRAYSCALE)
Zigfn imageFromChannel(image: Image, selectedChannel: i32) Image
CImage ImageFromChannel(Image image, int selectedChannel);
Used in textures_image_channel.
Create an image from text (default font)
Create an image from text (default font).
Zigfn imageText(text: [:0]const u8, fontSize: i32, color: Color) Image
CImage ImageText(const char *text, int fontSize, Color color);
Create an image from text (custom sprite font)
Zigfn imageTextEx(font: Font, text: [:0]const u8, fontSize: f32, spacing: f32, tint: Color) Image
CImage ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint);
Convert image data to desired format
Zigfn imageFormat(image: *Image, newFormat: PixelFormat) void
Cvoid ImageFormat(Image *image, int newFormat);
Used in textures_image_processing.
Convert image to POT (power-of-two)
Zigfn imageToPOT(image: *Image, fill: Color) void
Cvoid ImageToPOT(Image *image, Color fill);
Crop an image to a defined rectangle
Zigfn imageCrop(image: *Image, crop: Rectangle) void
Cvoid ImageCrop(Image *image, Rectangle crop);
Used in textures_image_drawing, textures_image_kernel.
Crop image depending on alpha value
Zigfn imageAlphaCrop(image: *Image, threshold: f32) void
Cvoid ImageAlphaCrop(Image *image, float threshold);
Clear alpha channel to desired color
Zigfn imageAlphaClear(image: *Image, color: Color, threshold: f32) void
Cvoid ImageAlphaClear(Image *image, Color color, float threshold);
Apply alpha mask to image
Zigfn imageAlphaMask(image: *Image, alphaMask: Image) void
Cvoid ImageAlphaMask(Image *image, Image alphaMask);
Used in textures_image_channel.
Premultiply alpha channel
Zigfn imageAlphaPremultiply(image: *Image) void
Cvoid ImageAlphaPremultiply(Image *image);
Apply Gaussian blur using a box blur approximation
Zigfn imageBlurGaussian(image: *Image, blurSize: i32) void
Cvoid ImageBlurGaussian(Image *image, int blurSize);
Used in textures_image_processing.
Apply custom square convolution kernel to image
Zigfn imageKernelConvolution(image: *Image, kernel: []const f32) void
Cvoid ImageKernelConvolution(Image *image, const float *kernel, int kernelSize);
Used in textures_image_kernel.
Resize image (Bicubic scaling algorithm)
Zigfn imageResize(image: *Image, newWidth: i32, newHeight: i32) void
Cvoid ImageResize(Image *image, int newWidth, int newHeight);
Used in textures_image_drawing.
Resize image (Nearest-Neighbor scaling algorithm)
Zigfn imageResizeNN(image: *Image, newWidth: i32, newHeight: i32) void
Cvoid ImageResizeNN(Image *image, int newWidth, int newHeight);
Used in models_decals.
Resize canvas and fill with color
Zigfn imageResizeCanvas(image: *Image, newWidth: i32, newHeight: i32, offsetX: i32, offsetY: i32, fill: Color) void
Cvoid ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill);
Compute all mipmap levels for a provided image
Zigfn imageMipmaps(image: *Image) void
Cvoid ImageMipmaps(Image *image);
Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
Zigfn imageDither(image: *Image, rBpp: i32, gBpp: i32, bBpp: i32, aBpp: i32) void
Cvoid ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);
Flip image vertically
Zigfn imageFlipVertical(image: *Image) void
Cvoid ImageFlipVertical(Image *image);
Used in textures_image_processing, textures_mouse_painting.
Flip image horizontally
Zigfn imageFlipHorizontal(image: *Image) void
Cvoid ImageFlipHorizontal(Image *image);
Used in textures_image_drawing, textures_image_processing.
Rotate image by input angle in degrees (-359 to 359)
Zigfn imageRotate(image: *Image, degrees: i32) void
Cvoid ImageRotate(Image *image, int degrees);
Used in textures_image_rotate.
Rotate image clockwise 90deg
Zigfn imageRotateCW(image: *Image) void
Cvoid ImageRotateCW(Image *image);
Rotate image counter-clockwise 90deg
Zigfn imageRotateCCW(image: *Image) void
Cvoid ImageRotateCCW(Image *image);
Modify image color: tint
Zigfn imageColorTint(image: *Image, color: Color) void
Cvoid ImageColorTint(Image *image, Color color);
Used in textures_image_processing.
Modify image color: invert
Zigfn imageColorInvert(image: *Image) void
Cvoid ImageColorInvert(Image *image);
Used in textures_image_processing.
Modify image color: grayscale
Zigfn imageColorGrayscale(image: *Image) void
Cvoid ImageColorGrayscale(Image *image);
Used in textures_image_processing.
Modify image color: contrast (-100 to 100)
Zigfn imageColorContrast(image: *Image, contrast: i32) void
Cvoid ImageColorContrast(Image *image, int contrast);
Used in textures_image_processing.
Modify image color: brightness (-255 to 255)
Zigfn imageColorBrightness(image: *Image, brightness: i32) void
Cvoid ImageColorBrightness(Image *image, int brightness);
Used in textures_image_processing.
Modify image color: replace color
Zigfn imageColorReplace(image: *Image, color: Color, replace: Color) void
Cvoid ImageColorReplace(Image *image, Color color, Color replace);
Load color data from image as a Color array (RGBA - 32bit)
Load color data from image as a Color array (RGBA - 32bit). Free with `unloadImageColors`.
Zigfn loadImageColors(image: Image) error{LoadFailed}![]Color
CColor *LoadImageColors(Image image);
Used in textures_image_processing, models_first_person_maze.
Load colors palette from image as a Color array (RGBA - 32bit)
Load colors palette from image as a Color array (RGBA - 32bit). Free with `unloadImagePalette`.
Zigfn loadImagePalette(image: Image, maxPaletteSize: i32) error{LoadFailed}![]Color
CColor *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount);
Unload color data loaded with LoadImageColors()
Unload color data loaded with `loadImageColors`.
Zigfn unloadImageColors(colors: []Color) void
Cvoid UnloadImageColors(Color *colors);
Used in textures_image_processing, models_first_person_maze.
Unload colors palette loaded with LoadImagePalette()
Unload colors palette loaded with `loadImagePalette`.
Zigfn unloadImagePalette(colors: []Color) void
Cvoid UnloadImagePalette(Color *colors);
Get image alpha border rectangle
Zigfn getImageAlphaBorder(image: Image, threshold: f32) Rectangle
CRectangle GetImageAlphaBorder(Image image, float threshold);
Get image pixel color at (x, y) position
Zigfn getImageColor(image: Image, x: i32, y: i32) Color
CColor GetImageColor(Image image, int x, int y);
Used in textures_cellular_automata, models_mesh_uv_painting, shaders_game_of_life.
Image drawing functions
Clear image background with provided color
Zigfn imageClearBackground(dst: *Image, color: Color) void
Cvoid ImageClearBackground(Image *dst, Color color);
Used in textures_cellular_automata, models_mesh_uv_painting, shaders_game_of_life.
Draw pixel within an image
Zigfn imageDrawPixel(dst: *Image, posX: i32, posY: i32, color: Color) void
Cvoid ImageDrawPixel(Image *dst, int posX, int posY, Color color);
Used in textures_image_drawing, textures_screen_buffer, textures_cellular_automata, shaders_game_of_life, audio_spectrum_visualizer.
Draw pixel within an image (Vector version)
Zigfn imageDrawPixelV(dst: *Image, position: Vector2, color: Color) void
Cvoid ImageDrawPixelV(Image *dst, Vector2 position, Color color);
Draw line within an image
Zigfn imageDrawLine(dst: *Image, startPosX: i32, startPosY: i32, endPosX: i32, endPosY: i32, color: Color) void
Cvoid ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color);
Draw line within an image (Vector version)
Zigfn imageDrawLineV(dst: *Image, start: Vector2, end: Vector2, color: Color) void
Cvoid ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color);
Draw a line defining thickness within an image
Zigfn imageDrawLineEx(dst: *Image, start: Vector2, end: Vector2, thick: i32, color: Color) void
Cvoid ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color);
Draw a lines sequence within an image
Zigfn imageDrawLineStrip(dst: *Image, points: []const Vector2, color: Color) void
Cvoid ImageDrawLineStrip(Image *dst, const Vector2 *points, int pointCount, Color color);
Draw triangle within an image
Zigfn imageDrawTriangle(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void
Cvoid ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
Draw triangle with interpolated colors within an image
Zigfn imageDrawTriangleGradient(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, c1: Color, c2: Color, c3: Color) void
Cvoid ImageDrawTriangleGradient(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3);
Draw triangle outline within an image
Zigfn imageDrawTriangleLines(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void
Cvoid ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
Draw a triangle fan defined by points within an image (first vertex is the center)
Zigfn imageDrawTriangleFan(dst: *Image, points: []const Vector2, color: Color) void
Cvoid ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color);
Draw a triangle strip defined by points within an image
Zigfn imageDrawTriangleStrip(dst: *Image, points: []const Vector2, color: Color) void
Cvoid ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color);
Draw rectangle within an image
Zigfn imageDrawRectangle(dst: *Image, posX: i32, posY: i32, width: i32, height: i32, color: Color) void
Cvoid ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color);
Used in textures_image_drawing.
Draw rectangle within an image (Vector version)
Zigfn imageDrawRectangleV(dst: *Image, position: Vector2, size: Vector2, color: Color) void
Cvoid ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color);
Draw rectangle within an image
Zigfn imageDrawRectangleRec(dst: *Image, rec: Rectangle, color: Color) void
Cvoid ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color);
Draw a color-filled rectangle with pro parameters within and image
Zigfn imageDrawRectanglePro(dst: *Image, rec: Rectangle, origin: Vector2, rotation: f32, color: Color) void
Cvoid ImageDrawRectanglePro(Image *dst, Rectangle rec, Vector2 origin, float rotation, Color color);
Draw rectangle lines within an image
Zigfn imageDrawRectangleLines(dst: *Image, posX: i32, posY: i32, width: i32, height: i32, color: Color) void
Cvoid ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color);
Draw rectangle lines within an image with line thickness
Zigfn imageDrawRectangleLinesEx(dst: *Image, rec: Rectangle, thick: i32, color: Color) void
Cvoid ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color);
Draw rectangle with gradient colors within an image, counter-clockwise color order
Zigfn imageDrawRectangleGradientEx(dst: *Image, rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color) void
Cvoid ImageDrawRectangleGradientEx(Image *dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4);
Draw a filled circle within an image
Zigfn imageDrawCircle(dst: *Image, centerX: i32, centerY: i32, radius: i32, color: Color) void
Cvoid ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color);
Used in textures_magnifying_glass, models_mesh_uv_painting, models_procedural_decals.
Draw a filled circle within an image (Vector version)
Zigfn imageDrawCircleV(dst: *Image, center: Vector2, radius: i32, color: Color) void
Cvoid ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color);
Draw circle outline within an image
Zigfn imageDrawCircleLines(dst: *Image, centerX: i32, centerY: i32, radius: i32, color: Color) void
Cvoid ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color);
Used in textures_image_drawing.
Draw circle outline within an image (Vector version)
Zigfn imageDrawCircleLinesV(dst: *Image, center: Vector2, radius: i32, color: Color) void
Cvoid ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color);
Draw a gradient-filled circle within an image
Zigfn imageDrawCircleGradient(dst: *Image, center: Vector2, radius: f32, inner: Color, outer: Color) void
Cvoid ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer);
Draw an image within an image
Zigfn imageDrawImage(dst: *Image, src: Image, posX: i32, posY: i32, tint: Color) void
Cvoid ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint);
Draw an image with scaling and rotation within an image
Zigfn imageDrawImageEx(dst: *Image, src: Image, position: Vector2, rotation: f32, scale: f32, tint: Color) void
Cvoid ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, float scale, Color tint);
Draw a part of an image defined by a rectangle within an image
Zigfn imageDrawImageRec(dst: *Image, src: Image, srcRec: Rectangle, position: Vector2, tint: Color) void
Cvoid ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint);
Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
Zigfn imageDrawImagePro(dst: *Image, src: Image, srcRec: Rectangle, dstRec: Rectangle, origin: Vector2, rotation: f32, tint: Color) void
Cvoid ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint);
Used in textures_image_drawing.
Draw text (using default font) within an image (destination)
Zigfn imageDrawText(dst: *Image, text: [:0]const u8, posX: i32, posY: i32, fontSize: i32, color: Color) void
Cvoid ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color);
Draw text (custom sprite font) within an image (destination)
Zigfn imageDrawTextEx(dst: *Image, font: Font, text: [:0]const u8, position: Vector2, fontSize: f32, spacing: f32, tint: Color) void
Cvoid ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint);
Used in textures_image_drawing, textures_image_text.
Draw text using Font and pro parameters (rotation)
Zigfn imageDrawTextPro(dst: *Image, font: Font, text: [:0]const u8, position: Vector2, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) void
Cvoid ImageDrawTextPro(Image *dst, Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint);
Texture loading functions
Load texture from file into GPU memory (VRAM)
Zigfn loadTexture(fileName: [:0]const u8) error{LoadFailed}!Texture2D
CTexture2D LoadTexture(const char *fileName);
Used in core_input_gamepad, textures_magnifying_glass, textures_logo_raylib, textures_srcrec_dstrec, textures_particles_blending, textures_npatch_drawing and 35 more.
Load texture from image data
Zigfn loadTextureFromImage(image: Image) error{LoadFailed}!Texture2D
CTexture2D LoadTextureFromImage(Image image);
Used in shapes_top_down_lights, textures_clipboard_image, textures_magnifying_glass, textures_image_drawing, textures_image_generation, textures_image_loading and 26 more.
Load cubemap from image, multiple image cubemap layouts supported
Zigfn loadTextureCubemap(image: Image, layout: CubemapLayout) error{LoadFailed}!TextureCubemap
CTextureCubemap LoadTextureCubemap(Image image, int layout);
Used in models_skybox_rendering.
Load texture for rendering (framebuffer)
Zigfn loadRenderTexture(width: i32, height: i32) error{LoadFailed}!RenderTexture2D
CRenderTexture2D LoadRenderTexture(int width, int height);
Used in core_2d_camera_split_screen, core_3d_camera_split_screen, core_window_letterbox, core_vr_simulator, core_smooth_pixelperfect, core_render_texture and 20 more.
Load texture for rendering (framebuffer), with specific format
Zigfn loadRenderTextureEx(width: i32, height: i32, format: PixelFormat) error{LoadFailed}!RenderTexture2D
CRenderTexture2D LoadRenderTextureEx(int width, int height, int format);
Check if texture is valid (loaded in GPU)
Zigfn isTextureValid(texture: Texture2D) bool
Cbool IsTextureValid(Texture2D texture);
Used in textures_clipboard_image.
Unload texture from GPU memory (VRAM)
Zigfn unloadTexture(texture: Texture2D) void
Cvoid UnloadTexture(Texture2D texture);
Used in core_input_gamepad, shapes_top_down_lights, textures_clipboard_image, textures_magnifying_glass, textures_logo_raylib, textures_srcrec_dstrec and 60 more.
Check if render texture is valid (loaded in GPU)
Zigfn isRenderTextureValid(target: RenderTexture2D) bool
Cbool IsRenderTextureValid(RenderTexture2D target);
Unload render texture from GPU memory (VRAM)
Zigfn unloadRenderTexture(target: RenderTexture2D) void
Cvoid UnloadRenderTexture(RenderTexture2D target);
Used in core_2d_camera_split_screen, core_3d_camera_split_screen, core_window_letterbox, core_vr_simulator, core_smooth_pixelperfect, core_render_texture and 20 more.
Update GPU texture with new data (pixels should be able to fill texture)
Zigfn updateTexture(texture: Texture2D, pixels: *const anyopaque) void
Cvoid UpdateTexture(Texture2D texture, const void *pixels);
Used in textures_image_processing, textures_gif_player, textures_screen_buffer, textures_cellular_automata, models_mesh_uv_painting, audio_spectrum_visualizer.
Update GPU texture rectangle with new data (pixels and rec should fit in texture)
Zigfn updateTextureRec(texture: Texture2D, rec: Rectangle, pixels: *const anyopaque) void
Cvoid UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels);
Used in shaders_game_of_life.
Texture drawing functions
Draw a Texture2D
Zigfn drawTexture(texture: Texture2D, posX: i32, posY: i32, tint: Color) void
Cvoid DrawTexture(Texture2D texture, int posX, int posY, Color tint);
Used in core_input_gamepad, shapes_bullet_hell, textures_magnifying_glass, textures_logo_raylib, textures_image_drawing, textures_image_generation and 28 more.
Draw a Texture2D with position defined as Vector2
Zigfn drawTextureV(texture: Texture2D, position: Vector2, tint: Color) void
Cvoid DrawTextureV(Texture2D texture, Vector2 position, Color tint);
Used in textures_image_text, shaders_ascii_rendering.
Draw a Texture2D with rotation and scale
Zigfn drawTextureEx(texture: Texture2D, position: Vector2, rotation: f32, scale: f32, tint: Color) void
Cvoid DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint);
Used in textures_image_text, textures_background_scrolling, textures_screen_buffer, models_cubicmap_rendering, models_first_person_maze, shaders_julia_set and 1 more.
Draw a part of a texture defined by a rectangle
Zigfn drawTextureRec(texture: Texture2D, rec: Rectangle, position: Vector2, tint: Color) void
Cvoid DrawTextureRec(Texture2D texture, Rectangle rec, Vector2 position, Color tint);
Used in core_2d_camera_split_screen, core_3d_camera_split_screen, shapes_top_down_lights, shapes_double_pendulum, shapes_lines_drawing, textures_magnifying_glass and 13 more.
Draw a part of a texture defined by a source rectangle to destination rectangle, with scaling and rotation
Zigfn drawTexturePro(texture: Texture2D, srcrec: Rectangle, dstrec: Rectangle, origin: Vector2, rotation: f32, tint: Color) void
Cvoid DrawTexturePro(Texture2D texture, Rectangle srcrec, Rectangle dstrec, Vector2 origin, float rotation, Color tint);
Used in core_window_letterbox, core_vr_simulator, core_smooth_pixelperfect, core_render_texture, core_viewport_scaling, textures_clipboard_image and 10 more.
Draw a texture (or part of it) that stretches or shrinks nicely
Zigfn drawTextureNPatch(texture: Texture2D, nPatchInfo: NPatchInfo, dstrec: Rectangle, origin: Vector2, rotation: f32, tint: Color) void
Cvoid DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dstrec, Vector2 origin, float rotation, Color tint);
Used in textures_npatch_drawing.
Color/pixel related functions
Check if two colors are equal
Zigfn colorIsEqual(col1: Color, col2: Color) bool
Cbool ColorIsEqual(Color col1, Color col2);
Get color with alpha applied, alpha goes from 0.0f to 1.0f
Zigfn fade(color: Color, alpha: f32) Color
CColor Fade(Color color, float alpha);
Used in core_input_gestures, core_input_gestures_testbed, core_2d_camera, core_2d_camera_split_screen, core_3d_camera_free, core_3d_camera_first_person and 45 more.
Get hexadecimal value for a Color (0xRRGGBBAA)
Zigfn colorToInt(color: Color) i32
Cint ColorToInt(Color color);
Used in shapes_math_sine_cosine, shapes_outlines_testbed.
Get Color normalized as float [0..1]
Zigfn colorNormalize(color: Color) Vector4
CVector4 ColorNormalize(Color color);
Used in shaders_fog_rendering, shaders_shadowmap_rendering, shaders_basic_pbr, shaders_rounded_rectangle, raylib_opengl_interop.
Get Color from normalized values [0..1]
Zigfn colorFromNormalized(normalized: Vector4) Color
CColor ColorFromNormalized(Vector4 normalized);
Used in audio_spectrum_visualizer.
Get HSV values for a Color, hue [0..360], saturation/value [0..1]
Zigfn colorToHSV(color: Color) Vector3
CVector3 ColorToHSV(Color color);
Get a Color from HSV values, hue [0..360], saturation/value [0..1]
Zigfn colorFromHSV(hue: f32, saturation: f32, value: f32) Color
CColor ColorFromHSV(float hue, float saturation, float value);
Used in shapes_triangle_strip, shapes_pie_chart, shapes_lines_drawing, shapes_math_angle_rotation, shapes_rlgl_color_wheel, shapes_hilbert_curve and 5 more.
Get color multiplied with another color
Zigfn colorTint(color: Color, tint: Color) Color
CColor ColorTint(Color color, Color tint);
Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
Zigfn colorBrightness(color: Color, factor: f32) Color
CColor ColorBrightness(Color color, float factor);
Get color with contrast correction, contrast values between -1.0f and 1.0f
Zigfn colorContrast(color: Color, contrast: f32) Color
CColor ColorContrast(Color color, float contrast);
Get color with alpha applied, alpha goes from 0.0f to 1.0f
Zigfn colorAlpha(color: Color, alpha: f32) Color
CColor ColorAlpha(Color color, float alpha);
Used in shapes_top_down_lights, shapes_rlgl_triangle, textures_magnifying_glass, textures_tiled_drawing, models_loading_vox, shaders_basic_lighting and 2 more.
Get src alpha-blended into dst color with tint
Zigfn colorAlphaBlend(dst: Color, src: Color, tint: Color) Color
CColor ColorAlphaBlend(Color dst, Color src, Color tint);
Get color lerp interpolation between two colors, factor [0.0f..1.0f]
Zigfn colorLerp(color1: Color, color2: Color, factor: f32) Color
CColor ColorLerp(Color color1, Color color2, float factor);
Used in shapes_clock_of_clocks, shapes_starfield_effect, shapes_rlgl_color_wheel.
Get Color structure from hexadecimal value
Zigfn getColor(hexValue: u32) Color
CColor GetColor(unsigned int hexValue);
Used in textures_background_scrolling, text_inline_styling.
Get Color from a source pixel pointer of certain format
Zigfn getPixelColor(srcPtr: *const anyopaque, format: PixelFormat) Color
CColor GetPixelColor(const void *srcPtr, int format);
Set color formatted into destination pixel pointer
Zigfn setPixelColor(dstPtr: *anyopaque, color: Color, format: PixelFormat) void
Cvoid SetPixelColor(void *dstPtr, Color color, int format);
Get pixel data size in bytes for certain format
Zigfn getPixelDataSize(width: i32, height: i32, format: PixelFormat) i32
Cint GetPixelDataSize(int width, int height, int format);