You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While creating examples and demos I missed some image manipulation functions. The following proposed functions could be useful.
Desired functions [textures.c]:
void ImageCrop(Image *image, Rectangle crop);
void ImageResize(Image *image, int newWidth, int newHeight); // Use stb_image_resize.h
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec);
void ImageDrawText(Image *dst, const char *text, Vector2 position, int size, Color color);
void ImageDrawTextEx(Image *dst, SpriteFont font, const char *text, Vector2 position, int size, Color color);
Compressed image formats won't be supported and returned image should keep the same format as original one. To simplify image operation in some cases, it could be converted to R8G8B8A8 (32bit) format to operate with it and reconverted to original format at the end.
Some notes on every function implementation:
ImageCrop() is quite easy, just take care of out-of-image limits.
ImageResize() is not that easy but 'stb_image_resize.h` can be used to simply the process, function would be just a wrapper.
ImageDraw() is just an image blitting process, it could use ImageResize() if destination rectangle size is different than source rectangle size.
ImageDrawText() is quite complex. It should use default raylib font but font image must be retrieved from SpriteFont texture id. Then, depending on every letter to draw into the resulting image, every letter source rectangle should be taken from font image and ImageDraw() could be used. Depending on desired font size, ImageResize() should also be used.
ImageDrawTextEx() is similar to ImageDrawText() but using a custom font.
The text was updated successfully, but these errors were encountered:
While creating examples and demos I missed some image manipulation functions. The following proposed functions could be useful.
Desired functions [textures.c]:
Compressed image formats won't be supported and returned image should keep the same format as original one. To simplify image operation in some cases, it could be converted to R8G8B8A8 (32bit) format to operate with it and reconverted to original format at the end.
Some notes on every function implementation:
ImageCrop()
is quite easy, just take care of out-of-image limits.ImageResize()
is not that easy but 'stb_image_resize.h` can be used to simply the process, function would be just a wrapper.ImageDraw()
is just an image blitting process, it could useImageResize()
if destination rectangle size is different than source rectangle size.ImageDrawText()
is quite complex. It should use default raylib font but font image must be retrieved from SpriteFont texture id. Then, depending on every letter to draw into the resulting image, every letter source rectangle should be taken from font image andImageDraw()
could be used. Depending on desired font size,ImageResize()
should also be used.ImageDrawTextEx()
is similar toImageDrawText()
but using a custom font.The text was updated successfully, but these errors were encountered: