Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced GenImageGradientH and GenImageGradientV with GenImageLinearGradient #3074

Merged
merged 2 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions examples/textures/textures_image_generation.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "raylib.h"

#define NUM_TEXTURES 6 // Currently we have 7 generation algorithms
#define NUM_TEXTURES 7 // Currently we have 7 generation algorithms

//------------------------------------------------------------------------------------
// Program main entry point
Expand All @@ -27,8 +27,9 @@ int main(void)

InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");

Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
Image verticalGradient = GenImageLinearGradient(screenWidth, screenHeight, 0, RED, BLUE);
Image horizontalGradient = GenImageLinearGradient(screenWidth, screenHeight, 90, RED, BLUE);
Image diagonalGradient = GenImageLinearGradient(screenWidth, screenHeight, 45, RED, BLUE);
Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
Expand All @@ -38,10 +39,11 @@ int main(void)

textures[0] = LoadTextureFromImage(verticalGradient);
textures[1] = LoadTextureFromImage(horizontalGradient);
textures[2] = LoadTextureFromImage(radialGradient);
textures[3] = LoadTextureFromImage(checked);
textures[4] = LoadTextureFromImage(whiteNoise);
textures[5] = LoadTextureFromImage(cellular);
textures[2] = LoadTextureFromImage(diagonalGradient);
textures[3] = LoadTextureFromImage(radialGradient);
textures[4] = LoadTextureFromImage(checked);
textures[5] = LoadTextureFromImage(whiteNoise);
textures[6] = LoadTextureFromImage(cellular);

// Unload image data (CPU RAM)
UnloadImage(verticalGradient);
Expand Down Expand Up @@ -83,10 +85,11 @@ int main(void)
{
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
case 1: DrawText("HORIZONTAL GRADIENT", 540, 10, 20, RAYWHITE); break;
case 2: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
case 3: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
case 4: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
case 5: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
case 2: DrawText("DIAGONAL GRADIENT", 540, 10, 20, RAYWHITE); break;
case 3: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
case 4: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
case 5: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
case 6: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
default: break;
}

Expand Down
38 changes: 12 additions & 26 deletions parser/output/raylib_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"name": "RAYLIB_VERSION_MINOR",
"type": "INT",
"value": 5,
"value": 6,
"description": ""
},
{
Expand All @@ -27,7 +27,7 @@
{
"name": "RAYLIB_VERSION",
"type": "STRING",
"value": "4.5",
"value": "4.6-dev",
"description": ""
},
{
Expand Down Expand Up @@ -1032,6 +1032,11 @@
"type": "Transform **",
"name": "framePoses",
"description": "Poses array by frame"
},
{
"type": "char[32]",
"name": "name",
"description": "Animation name"
}
]
},
Expand Down Expand Up @@ -6236,8 +6241,8 @@
]
},
{
"name": "GenImageGradientV",
"description": "Generate image: vertical gradient",
"name": "GenImageLinearGradient",
"description": "Generate image: linear gradient",
"returnType": "Image",
"params": [
{
Expand All @@ -6248,36 +6253,17 @@
"type": "int",
"name": "height"
},
{
"type": "Color",
"name": "top"
},
{
"type": "Color",
"name": "bottom"
}
]
},
{
"name": "GenImageGradientH",
"description": "Generate image: horizontal gradient",
"returnType": "Image",
"params": [
{
"type": "int",
"name": "width"
},
{
"type": "int",
"name": "height"
"name": "direction"
},
{
"type": "Color",
"name": "left"
"name": "start"
},
{
"type": "Color",
"name": "right"
"name": "end"
}
]
},
Expand Down
29 changes: 12 additions & 17 deletions parser/output/raylib_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ return {
{
name = "RAYLIB_VERSION_MINOR",
type = "INT",
value = 5,
value = 6,
description = ""
},
{
Expand All @@ -27,7 +27,7 @@ return {
{
name = "RAYLIB_VERSION",
type = "STRING",
value = "4.5",
value = "4.6-dev",
description = ""
},
{
Expand Down Expand Up @@ -1032,6 +1032,11 @@ return {
type = "Transform **",
name = "framePoses",
description = "Poses array by frame"
},
{
type = "char[32]",
name = "name",
description = "Animation name"
}
}
},
Expand Down Expand Up @@ -4991,25 +4996,15 @@ return {
}
},
{
name = "GenImageGradientV",
description = "Generate image: vertical gradient",
returnType = "Image",
params = {
{type = "int", name = "width"},
{type = "int", name = "height"},
{type = "Color", name = "top"},
{type = "Color", name = "bottom"}
}
},
{
name = "GenImageGradientH",
description = "Generate image: horizontal gradient",
name = "GenImageLinearGradient",
description = "Generate image: linear gradient",
returnType = "Image",
params = {
{type = "int", name = "width"},
{type = "int", name = "height"},
{type = "Color", name = "left"},
{type = "Color", name = "right"}
{type = "int", name = "direction"},
{type = "Color", name = "start"},
{type = "Color", name = "end"}
}
},
{
Expand Down
Loading