diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c index df4cb92f1..359dc236a 100644 --- a/examples/textures/textures_image_generation.c +++ b/examples/textures/textures_image_generation.c @@ -13,7 +13,7 @@ #include "raylib.h" -#define NUM_TEXTURES 10 // Currently we have 8 generation algorithms but some are have multiple purposes (Linear and Square Gradients) +#define NUM_TEXTURES 9 // Currently we have 8 generation algorithms but some are have multiple purposes (Linear and Square Gradients) //------------------------------------------------------------------------------------ // Program main entry point @@ -31,8 +31,7 @@ int main(void) Image horizontalGradient = GenImageGradientLinear(screenWidth, screenHeight, 90, RED, BLUE); Image diagonalGradient = GenImageGradientLinear(screenWidth, screenHeight, 45, RED, BLUE); Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK); - Image squareGradient = GenImageGradientSquare(screenWidth, screenHeight, screenHeight*0.9, screenHeight*0.9, 0.0f, WHITE, BLACK); - Image rectangularGradient = GenImageGradientSquare(screenWidth, screenHeight, screenWidth, screenHeight, 0.0f, WHITE, BLACK); + Image squareGradient = GenImageGradientSquare(screenWidth, screenHeight, 0.0f, WHITE, BLACK); Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE); Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f); Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f); @@ -45,11 +44,10 @@ int main(void) textures[2] = LoadTextureFromImage(diagonalGradient); textures[3] = LoadTextureFromImage(radialGradient); textures[4] = LoadTextureFromImage(squareGradient); - textures[5] = LoadTextureFromImage(rectangularGradient); - textures[6] = LoadTextureFromImage(checked); - textures[7] = LoadTextureFromImage(whiteNoise); - textures[8] = LoadTextureFromImage(perlinNoise); - textures[9] = LoadTextureFromImage(cellular); + textures[5] = LoadTextureFromImage(checked); + textures[6] = LoadTextureFromImage(whiteNoise); + textures[7] = LoadTextureFromImage(perlinNoise); + textures[8] = LoadTextureFromImage(cellular); // Unload image data (CPU RAM) UnloadImage(verticalGradient); @@ -97,11 +95,10 @@ int main(void) case 2: DrawText("DIAGONAL GRADIENT", 540, 10, 20, RAYWHITE); break; case 3: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break; case 4: DrawText("SQUARE GRADIENT", 580, 10, 20, LIGHTGRAY); break; - case 5: DrawText("RECTANGULAR GRADIENT", 530, 10, 20, LIGHTGRAY); break; - case 6: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break; - case 7: DrawText("WHITE NOISE", 640, 10, 20, RED); break; - case 8: DrawText("PERLIN NOISE", 640, 10, 20, RED); break; - case 9: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break; + case 5: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break; + case 6: DrawText("WHITE NOISE", 640, 10, 20, RED); break; + case 7: DrawText("PERLIN NOISE", 640, 10, 20, RED); break; + case 8: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break; default: break; } diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index 0c6350c1a..4438ab0da 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -6307,14 +6307,6 @@ "type": "int", "name": "height" }, - { - "type": "int", - "name": "gradientWidth" - }, - { - "type": "int", - "name": "gradientHeight" - }, { "type": "float", "name": "density" diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua index 51653f448..79b3a9283 100644 --- a/parser/output/raylib_api.lua +++ b/parser/output/raylib_api.lua @@ -5026,8 +5026,6 @@ return { params = { {type = "int", name = "width"}, {type = "int", name = "height"}, - {type = "int", name = "gradientWidth"}, - {type = "int", name = "gradientHeight"}, {type = "float", name = "density"}, {type = "Color", name = "inner"}, {type = "Color", name = "outer"} diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt index 486b40c4f..c53cb77ec 100644 --- a/parser/output/raylib_api.txt +++ b/parser/output/raylib_api.txt @@ -2434,17 +2434,15 @@ Function 247: GenImageGradientRadial() (5 input parameters) Param[3]: density (type: float) Param[4]: inner (type: Color) Param[5]: outer (type: Color) -Function 248: GenImageGradientSquare() (7 input parameters) +Function 248: GenImageGradientSquare() (5 input parameters) Name: GenImageGradientSquare Return type: Image Description: Generate image: square gradient Param[1]: width (type: int) Param[2]: height (type: int) - Param[3]: gradientWidth (type: int) - Param[4]: gradientHeight (type: int) - Param[5]: density (type: float) - Param[6]: inner (type: Color) - Param[7]: outer (type: Color) + Param[3]: density (type: float) + Param[4]: inner (type: Color) + Param[5]: outer (type: Color) Function 249: GenImageChecked() (6 input parameters) Name: GenImageChecked Return type: Image diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml index 453260e9e..85b3e3e4c 100644 --- a/parser/output/raylib_api.xml +++ b/parser/output/raylib_api.xml @@ -1563,11 +1563,9 @@ - + - - diff --git a/projects/Geany/raylib.c.tags b/projects/Geany/raylib.c.tags index 23296648e..4cc6d4605 100644 --- a/projects/Geany/raylib.c.tags +++ b/projects/Geany/raylib.c.tags @@ -213,7 +213,7 @@ ImageColorReplace|void|(Image *image, Color color, Color replace);| GenImageColor|Image|(int width, int height, Color color);| GenImageGradientLinear|Image|(int width, int height, int direction, Color start, Color end);| GenImageGradientRadial|Image|(int width, int height, float density, Color inner, Color outer);| -GenImageGradientSquare|Image|(int width, int height, int gradientWidth, int gradientHeight, float density, Color inner, Color outer);| +GenImageGradientSquare|Image|(int width, int height, float density, Color inner, Color outer);| GenImageChecked|Image|(int width, int height, int checksX, int checksY, Color col1, Color col2);| GenImageWhiteNoise|Image|(int width, int height, float factor);| GenImagePerlinNoise|Image|(int width, int height, int offsetX, int offsetY, float scale);| diff --git a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml index 2dcd994aa..7e173a936 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +++ b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml @@ -1400,8 +1400,6 @@ - - diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h index b09e53f5a..f20f065e3 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h @@ -319,7 +319,7 @@ RLAPI bool ExportImageAsCode(Image image, const char *fileName); RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); // Generate image: linear gradient RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient -RLAPI Image GenImageGradientSquare(int width, int height, int gradientWidth, int gradientHeight, float density, Color inner, Color outer); // Generate image: square gradient +RLAPI Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); // Generate image: square gradient RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise diff --git a/src/raylib.h b/src/raylib.h index cbaac57a0..703e70c21 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1241,7 +1241,7 @@ RLAPI bool ExportImageAsCode(Image image, const char *fileName); RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient -RLAPI Image GenImageGradientSquare(int width, int height, int gradientWidth, int gradientHeight, float density, Color inner, Color outer); // Generate image: square gradient +RLAPI Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); // Generate image: square gradient RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise diff --git a/src/rtextures.c b/src/rtextures.c index 3d20d5143..f6a747c0f 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -765,16 +765,13 @@ Image GenImageGradientRadial(int width, int height, float density, Color inner, } // Generate image: square gradient -Image GenImageGradientSquare(int width, int height, int gradientWidth, int gradientHeight, float density, Color inner, Color outer) +Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer) { Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color)); float centerX = (float)width/2.0f; float centerY = (float)height/2.0f; - float gradientCenterX = gradientWidth / 2.0f; - float gradientCenterY = gradientHeight / 2.0f; - for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) @@ -784,8 +781,8 @@ Image GenImageGradientSquare(int width, int height, int gradientWidth, int gradi float distY = fabsf(y - centerY); // Normalize the distances by the dimensions of the gradient rectangle - float normalizedDistX = distX / gradientCenterX; - float normalizedDistY = distY / gradientCenterY; + float normalizedDistX = distX / centerX; + float normalizedDistY = distY / centerY; // Calculate the total normalized Manhattan distance float manhattanDist = fmax(normalizedDistX, normalizedDistY);