-
Notifications
You must be signed in to change notification settings - Fork 27
Some image manipulation functions don't work #30
Copy link
Copy link
Closed
Description
I'm writing a game engine using Jaylib, and some of the image manipulation functions, such as:
void ImageFlipVertical(Image image);
void ImageFlipHorizontal(Image image);
void ImageRotateCW(Image image);
void ImageRotateCCW(Image image);
void ImageColorTint(Image image, Color color);
void ImageColorInvert(Image image);
void ImageColorGrayscale(Image image);
Don't work. The image resizing functions do work, but these ones don't. I checked the docs, and im using them correctly, so im not exactly sure why it isnt working. This is my code:
public class Sprite {
@Getter
private String path;
@Getter
private Image img;
@Getter
private Texture rawTex;
public Sprite(String path) {
this.path = path;
this.img = LoadImage(path);
this.rawTex = LoadTextureFromImage(img);
}
public void flip() {
ImageFlipVertical(img);
}
public void resize(Vector2f newSize) {
// Use nearest neighbour scaling algorithm instead of the default bicubic scaling algorithm
// https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
ImageResizeNN(this.img, (int) newSize.x, (int) newSize.y);
// reload the texture after resizing
this.rawTex = LoadTextureFromImage(this.img);
}
public void resizeBicubic(Vector2f newSize) {
// Raylib uses the bicubic resizing algorithm by default
// https://en.wikipedia.org/wiki/Bicubic_interpolation
ImageResize(this.img, (int) newSize.x, (int) newSize.y);
// reload the texture after resizing
this.rawTex = LoadTextureFromImage(this.img);
}
public void dispose() {
UnloadImage(img);
UnloadTexture(rawTex);
}
}and the sprite.flip() function isn't changing anything in the image.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels