diff options
| author | Ray <[email protected]> | 2018-06-01 00:53:40 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2018-06-01 00:53:40 +0200 |
| commit | 2536bea379387e525e3107ee07355292ee87a566 (patch) | |
| tree | cf5d014793d54bd26735cb776b729814b7cb5a78 /src/textures.c | |
| parent | 129c890a28b50c2ce3820e3745f8c89c8833f02c (diff) | |
| download | raylib-2536bea379387e525e3107ee07355292ee87a566.tar.gz raylib-2536bea379387e525e3107ee07355292ee87a566.zip | |
Added: ImageResizeCanvas() -WIP-
Added note idea on ImageFormat() for future redesign (to support
16bit-32bit pixel-formats)
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/textures.c b/src/textures.c index 0aac923f..239b7cf5 100644 --- a/src/textures.c +++ b/src/textures.c @@ -664,6 +664,7 @@ void ImageFormat(Image *image, int newFormat) if ((image->format < COMPRESSED_DXT1_RGB) && (newFormat < COMPRESSED_DXT1_RGB)) { Color *pixels = GetImageData(*image); + //Vector4 *pixels = GetImageDataNormalized(*image); // TODO: Support 8->32bit channels free(image->data); // WARNING! We loose mipmaps data --> Regenerated at the end... image->data = NULL; @@ -1066,6 +1067,20 @@ void ImageResizeNN(Image *image,int newWidth,int newHeight) free(pixels); } +// Resize canvas, using anchor point and color filling +void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int anchor, Color color) +{ + Image imTemp = GenImageColor(newWidth, newHeight, color); + Rectangle rec = { 0, 0, image->width, image->height }; + + // TODO: consider anchor properly + + ImageDraw(&imTemp, *image, rec, rec); + ImageFormat(&imTemp, image->format); + UnloadImage(*image); + *image = imTemp; +} + // Generate all mipmap levels for a provided image // NOTE 1: Supports POT and NPOT images // NOTE 2: image.data is scaled to include mipmap levels |
