raylib_textures.c 6.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Image/Texture2D data loading/unloading functions
  2. Image LoadImage(const char *fileName); // Load an image into CPU memory (RAM)
  3. Image LoadImageEx(Color *pixels, int width, int height); // Load image data from Color array data (RGBA - 32bit)
  4. Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file
  5. Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource)
  6. Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
  7. Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory
  8. Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
  9. Texture2D LoadTextureFromImage(Image image); // Load a texture from image data
  10. RenderTexture2D LoadRenderTexture(int width, int height); // Load a texture to be used for rendering
  11. void UnloadImage(Image image); // Unload image from CPU memory (RAM)
  12. void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
  13. void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory
  14. Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
  15. Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image
  16. void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data
  17. // Image manipulation functions
  18. void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
  19. void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
  20. void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
  21. Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
  22. void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
  23. void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering)
  24. void ImageResizeNN(Image *image,int newWidth,int newHeight); // Resize and image (Nearest-Neighbor scaling algorithm)
  25. Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
  26. Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font)
  27. void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
  28. void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
  29. void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text,
  30. int fontSize, int spacing, Color color); // Draw text (custom sprite font) within image
  31. void ImageFlipVertical(Image *image); // Flip image vertically
  32. void ImageFlipHorizontal(Image *image); // Flip image horizontally
  33. void ImageColorTint(Image *image, Color color); // Modify image color: tint
  34. void ImageColorInvert(Image *image); // Modify image color: invert
  35. void ImageColorGrayscale(Image *image); // Modify bimage color: grayscale
  36. void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
  37. void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
  38. // Texture2D configuration functions
  39. void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
  40. void SetTextureFilter(Texture2D texture, int filterMode); // Set texture scaling filter mode
  41. void SetTextureWrap(Texture2D texture, int wrapMode); // Set texture wrapping mode
  42. // Texture2D drawing functions
  43. void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
  44. void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
  45. void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
  46. void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
  47. void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, // Draw a part of a texture defined by a rectangle with 'pro' parameters
  48. float rotation, Color tint);