mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-11-04 01:34:19 +00:00 
			
		
		
		
	Replaced GenImageGradientH and GenImageGradientV with GenImageLinearGradient (#3074)
* Replaced GenImageGradientH and GenImageGradientV with GenImageLinearGradient * renamed GenImageLinearGradient to GenImageGradientLinear
This commit is contained in:
		@@ -13,7 +13,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "raylib.h"
 | 
					#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
 | 
					// Program main entry point
 | 
				
			||||||
@@ -27,8 +27,9 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
 | 
					    InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
 | 
					    Image verticalGradient = GenImageGradientLinear(screenWidth, screenHeight, 0, RED, BLUE);
 | 
				
			||||||
    Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
 | 
					    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 radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
 | 
				
			||||||
    Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
 | 
					    Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
 | 
				
			||||||
    Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
 | 
					    Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
 | 
				
			||||||
@@ -38,10 +39,11 @@ int main(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    textures[0] = LoadTextureFromImage(verticalGradient);
 | 
					    textures[0] = LoadTextureFromImage(verticalGradient);
 | 
				
			||||||
    textures[1] = LoadTextureFromImage(horizontalGradient);
 | 
					    textures[1] = LoadTextureFromImage(horizontalGradient);
 | 
				
			||||||
    textures[2] = LoadTextureFromImage(radialGradient);
 | 
					    textures[2] = LoadTextureFromImage(diagonalGradient);
 | 
				
			||||||
    textures[3] = LoadTextureFromImage(checked);
 | 
					    textures[3] = LoadTextureFromImage(radialGradient);
 | 
				
			||||||
    textures[4] = LoadTextureFromImage(whiteNoise);
 | 
					    textures[4] = LoadTextureFromImage(checked);
 | 
				
			||||||
    textures[5] = LoadTextureFromImage(cellular);
 | 
					    textures[5] = LoadTextureFromImage(whiteNoise);
 | 
				
			||||||
 | 
					    textures[6] = LoadTextureFromImage(cellular);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Unload image data (CPU RAM)
 | 
					    // Unload image data (CPU RAM)
 | 
				
			||||||
    UnloadImage(verticalGradient);
 | 
					    UnloadImage(verticalGradient);
 | 
				
			||||||
@@ -83,10 +85,11 @@ int main(void)
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
 | 
					                case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
 | 
				
			||||||
                case 1: DrawText("HORIZONTAL GRADIENT", 540, 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 2: DrawText("DIAGONAL GRADIENT", 540, 10, 20, RAYWHITE); break;
 | 
				
			||||||
                case 3: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
 | 
					                case 3: DrawText("RADIAL GRADIENT", 580, 10, 20, LIGHTGRAY); break;
 | 
				
			||||||
                case 4: DrawText("WHITE NOISE", 640, 10, 20, RED); break;
 | 
					                case 4: DrawText("CHECKED", 680, 10, 20, RAYWHITE); break;
 | 
				
			||||||
                case 5: DrawText("CELLULAR", 670, 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;
 | 
					                default: break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      "name": "RAYLIB_VERSION_MINOR",
 | 
					      "name": "RAYLIB_VERSION_MINOR",
 | 
				
			||||||
      "type": "INT",
 | 
					      "type": "INT",
 | 
				
			||||||
      "value": 5,
 | 
					      "value": 6,
 | 
				
			||||||
      "description": ""
 | 
					      "description": ""
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -27,7 +27,7 @@
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      "name": "RAYLIB_VERSION",
 | 
					      "name": "RAYLIB_VERSION",
 | 
				
			||||||
      "type": "STRING",
 | 
					      "type": "STRING",
 | 
				
			||||||
      "value": "4.5",
 | 
					      "value": "4.6-dev",
 | 
				
			||||||
      "description": ""
 | 
					      "description": ""
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -1032,6 +1032,11 @@
 | 
				
			|||||||
          "type": "Transform **",
 | 
					          "type": "Transform **",
 | 
				
			||||||
          "name": "framePoses",
 | 
					          "name": "framePoses",
 | 
				
			||||||
          "description": "Poses array by frame"
 | 
					          "description": "Poses array by frame"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "type": "char[32]",
 | 
				
			||||||
 | 
					          "name": "name",
 | 
				
			||||||
 | 
					          "description": "Animation name"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -6236,8 +6241,8 @@
 | 
				
			|||||||
      ]
 | 
					      ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "name": "GenImageGradientV",
 | 
					      "name": "GenImageGradientLinear",
 | 
				
			||||||
      "description": "Generate image: vertical gradient",
 | 
					      "description": "Generate image: linear gradient",
 | 
				
			||||||
      "returnType": "Image",
 | 
					      "returnType": "Image",
 | 
				
			||||||
      "params": [
 | 
					      "params": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -6248,36 +6253,17 @@
 | 
				
			|||||||
          "type": "int",
 | 
					          "type": "int",
 | 
				
			||||||
          "name": "height"
 | 
					          "name": "height"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "type": "Color",
 | 
					 | 
				
			||||||
          "name": "top"
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "type": "Color",
 | 
					 | 
				
			||||||
          "name": "bottom"
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "name": "GenImageGradientH",
 | 
					 | 
				
			||||||
      "description": "Generate image: horizontal gradient",
 | 
					 | 
				
			||||||
      "returnType": "Image",
 | 
					 | 
				
			||||||
      "params": [
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "type": "int",
 | 
					          "type": "int",
 | 
				
			||||||
          "name": "width"
 | 
					          "name": "direction"
 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "type": "int",
 | 
					 | 
				
			||||||
          "name": "height"
 | 
					 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "type": "Color",
 | 
					          "type": "Color",
 | 
				
			||||||
          "name": "left"
 | 
					          "name": "start"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "type": "Color",
 | 
					          "type": "Color",
 | 
				
			||||||
          "name": "right"
 | 
					          "name": "end"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ return {
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      name = "RAYLIB_VERSION_MINOR",
 | 
					      name = "RAYLIB_VERSION_MINOR",
 | 
				
			||||||
      type = "INT",
 | 
					      type = "INT",
 | 
				
			||||||
      value = 5,
 | 
					      value = 6,
 | 
				
			||||||
      description = ""
 | 
					      description = ""
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -27,7 +27,7 @@ return {
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      name = "RAYLIB_VERSION",
 | 
					      name = "RAYLIB_VERSION",
 | 
				
			||||||
      type = "STRING",
 | 
					      type = "STRING",
 | 
				
			||||||
      value = "4.5",
 | 
					      value = "4.6-dev",
 | 
				
			||||||
      description = ""
 | 
					      description = ""
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -1032,6 +1032,11 @@ return {
 | 
				
			|||||||
          type = "Transform **",
 | 
					          type = "Transform **",
 | 
				
			||||||
          name = "framePoses",
 | 
					          name = "framePoses",
 | 
				
			||||||
          description = "Poses array by frame"
 | 
					          description = "Poses array by frame"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          type = "char[32]",
 | 
				
			||||||
 | 
					          name = "name",
 | 
				
			||||||
 | 
					          description = "Animation name"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -4991,25 +4996,15 @@ return {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name = "GenImageGradientV",
 | 
					      name = "GenImageGradientLinear",
 | 
				
			||||||
      description = "Generate image: vertical gradient",
 | 
					      description = "Generate image: linear gradient",
 | 
				
			||||||
      returnType = "Image",
 | 
					      returnType = "Image",
 | 
				
			||||||
      params = {
 | 
					      params = {
 | 
				
			||||||
        {type = "int", name = "width"},
 | 
					        {type = "int", name = "width"},
 | 
				
			||||||
        {type = "int", name = "height"},
 | 
					        {type = "int", name = "height"},
 | 
				
			||||||
        {type = "Color", name = "top"},
 | 
					        {type = "int", name = "direction"},
 | 
				
			||||||
        {type = "Color", name = "bottom"}
 | 
					        {type = "Color", name = "start"},
 | 
				
			||||||
      }
 | 
					        {type = "Color", name = "end"}
 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      name = "GenImageGradientH",
 | 
					 | 
				
			||||||
      description = "Generate image: horizontal gradient",
 | 
					 | 
				
			||||||
      returnType = "Image",
 | 
					 | 
				
			||||||
      params = {
 | 
					 | 
				
			||||||
        {type = "int", name = "width"},
 | 
					 | 
				
			||||||
        {type = "int", name = "height"},
 | 
					 | 
				
			||||||
        {type = "Color", name = "left"},
 | 
					 | 
				
			||||||
        {type = "Color", name = "right"}
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -3,9 +3,9 @@
 | 
				
			|||||||
    <Defines count="56">
 | 
					    <Defines count="56">
 | 
				
			||||||
        <Define name="RAYLIB_H" type="GUARD" value="" desc="" />
 | 
					        <Define name="RAYLIB_H" type="GUARD" value="" desc="" />
 | 
				
			||||||
        <Define name="RAYLIB_VERSION_MAJOR" type="INT" value="4" desc="" />
 | 
					        <Define name="RAYLIB_VERSION_MAJOR" type="INT" value="4" desc="" />
 | 
				
			||||||
        <Define name="RAYLIB_VERSION_MINOR" type="INT" value="5" desc="" />
 | 
					        <Define name="RAYLIB_VERSION_MINOR" type="INT" value="6" desc="" />
 | 
				
			||||||
        <Define name="RAYLIB_VERSION_PATCH" type="INT" value="0" desc="" />
 | 
					        <Define name="RAYLIB_VERSION_PATCH" type="INT" value="0" desc="" />
 | 
				
			||||||
        <Define name="RAYLIB_VERSION" type="STRING" value="4.5" desc="" />
 | 
					        <Define name="RAYLIB_VERSION" type="STRING" value="4.6-dev" desc="" />
 | 
				
			||||||
        <Define name="__declspec(x)" type="MACRO" value="__attribute__((x))" desc="" />
 | 
					        <Define name="__declspec(x)" type="MACRO" value="__attribute__((x))" desc="" />
 | 
				
			||||||
        <Define name="RLAPI" type="UNKNOWN" value="__declspec(dllexport)" desc="We are building the library as a Win32 shared library (.dll)" />
 | 
					        <Define name="RLAPI" type="UNKNOWN" value="__declspec(dllexport)" desc="We are building the library as a Win32 shared library (.dll)" />
 | 
				
			||||||
        <Define name="PI" type="FLOAT" value="3.14159265358979323846" desc="" />
 | 
					        <Define name="PI" type="FLOAT" value="3.14159265358979323846" desc="" />
 | 
				
			||||||
@@ -210,11 +210,12 @@
 | 
				
			|||||||
            <Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
 | 
					            <Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
 | 
				
			||||||
            <Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
 | 
					            <Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
 | 
				
			||||||
        </Struct>
 | 
					        </Struct>
 | 
				
			||||||
        <Struct name="ModelAnimation" fieldCount="4" desc="ModelAnimation">
 | 
					        <Struct name="ModelAnimation" fieldCount="5" desc="ModelAnimation">
 | 
				
			||||||
            <Field type="int" name="boneCount" desc="Number of bones" />
 | 
					            <Field type="int" name="boneCount" desc="Number of bones" />
 | 
				
			||||||
            <Field type="int" name="frameCount" desc="Number of animation frames" />
 | 
					            <Field type="int" name="frameCount" desc="Number of animation frames" />
 | 
				
			||||||
            <Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
 | 
					            <Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
 | 
				
			||||||
            <Field type="Transform **" name="framePoses" desc="Poses array by frame" />
 | 
					            <Field type="Transform **" name="framePoses" desc="Poses array by frame" />
 | 
				
			||||||
 | 
					            <Field type="char[32]" name="name" desc="Animation name" />
 | 
				
			||||||
        </Struct>
 | 
					        </Struct>
 | 
				
			||||||
        <Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
 | 
					        <Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
 | 
				
			||||||
            <Field type="Vector3" name="position" desc="Ray position (origin)" />
 | 
					            <Field type="Vector3" name="position" desc="Ray position (origin)" />
 | 
				
			||||||
@@ -655,7 +656,7 @@
 | 
				
			|||||||
            <Param type="unsigned int" name="frames" desc="" />
 | 
					            <Param type="unsigned int" name="frames" desc="" />
 | 
				
			||||||
        </Callback>
 | 
					        </Callback>
 | 
				
			||||||
    </Callbacks>
 | 
					    </Callbacks>
 | 
				
			||||||
    <Functions count="517">
 | 
					    <Functions count="516">
 | 
				
			||||||
        <Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
 | 
					        <Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
 | 
				
			||||||
            <Param type="int" name="width" desc="" />
 | 
					            <Param type="int" name="width" desc="" />
 | 
				
			||||||
            <Param type="int" name="height" desc="" />
 | 
					            <Param type="int" name="height" desc="" />
 | 
				
			||||||
@@ -1548,17 +1549,12 @@
 | 
				
			|||||||
            <Param type="int" name="height" desc="" />
 | 
					            <Param type="int" name="height" desc="" />
 | 
				
			||||||
            <Param type="Color" name="color" desc="" />
 | 
					            <Param type="Color" name="color" desc="" />
 | 
				
			||||||
        </Function>
 | 
					        </Function>
 | 
				
			||||||
        <Function name="GenImageGradientV" retType="Image" paramCount="4" desc="Generate image: vertical gradient">
 | 
					        <Function name="GenImageGradientLinear" retType="Image" paramCount="5" desc="Generate image: linear gradient">
 | 
				
			||||||
            <Param type="int" name="width" desc="" />
 | 
					            <Param type="int" name="width" desc="" />
 | 
				
			||||||
            <Param type="int" name="height" desc="" />
 | 
					            <Param type="int" name="height" desc="" />
 | 
				
			||||||
            <Param type="Color" name="top" desc="" />
 | 
					            <Param type="int" name="direction" desc="" />
 | 
				
			||||||
            <Param type="Color" name="bottom" desc="" />
 | 
					            <Param type="Color" name="start" desc="" />
 | 
				
			||||||
        </Function>
 | 
					            <Param type="Color" name="end" desc="" />
 | 
				
			||||||
        <Function name="GenImageGradientH" retType="Image" paramCount="4" desc="Generate image: horizontal gradient">
 | 
					 | 
				
			||||||
            <Param type="int" name="width" desc="" />
 | 
					 | 
				
			||||||
            <Param type="int" name="height" desc="" />
 | 
					 | 
				
			||||||
            <Param type="Color" name="left" desc="" />
 | 
					 | 
				
			||||||
            <Param type="Color" name="right" desc="" />
 | 
					 | 
				
			||||||
        </Function>
 | 
					        </Function>
 | 
				
			||||||
        <Function name="GenImageGradientRadial" retType="Image" paramCount="5" desc="Generate image: radial gradient">
 | 
					        <Function name="GenImageGradientRadial" retType="Image" paramCount="5" desc="Generate image: radial gradient">
 | 
				
			||||||
            <Param type="int" name="width" desc="" />
 | 
					            <Param type="int" name="width" desc="" />
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -211,8 +211,7 @@ ImageColorContrast|void|(Image *image, float contrast);|
 | 
				
			|||||||
ImageColorBrightness|void|(Image *image, int brightness);|
 | 
					ImageColorBrightness|void|(Image *image, int brightness);|
 | 
				
			||||||
ImageColorReplace|void|(Image *image, Color color, Color replace);|
 | 
					ImageColorReplace|void|(Image *image, Color color, Color replace);|
 | 
				
			||||||
GenImageColor|Image|(int width, int height, Color color);|
 | 
					GenImageColor|Image|(int width, int height, Color color);|
 | 
				
			||||||
GenImageGradientV|Image|(int width, int height, Color top, Color bottom);|
 | 
					GenImageGradientLinear|Image|(int width, int height, int direction, Color start, Color end);|
 | 
				
			||||||
GenImageGradientH|Image|(int width, int height, Color left, Color right);|
 | 
					 | 
				
			||||||
GenImageGradientRadial|Image|(int width, int height, float density, Color inner, Color outer);|
 | 
					GenImageGradientRadial|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);|
 | 
					GenImageChecked|Image|(int width, int height, int checksX, int checksY, Color col1, Color col2);|
 | 
				
			||||||
GenImageWhiteNoise|Image|(int width, int height, float factor);|
 | 
					GenImageWhiteNoise|Image|(int width, int height, float factor);|
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1378,20 +1378,13 @@
 | 
				
			|||||||
                <Param name="Color color" />
 | 
					                <Param name="Color color" />
 | 
				
			||||||
            </Overload>
 | 
					            </Overload>
 | 
				
			||||||
        </KeyWord>
 | 
					        </KeyWord>
 | 
				
			||||||
        <KeyWord name="GenImageGradientV" func="yes">
 | 
					        <KeyWord name="GenImageGradientLinear" func="yes">
 | 
				
			||||||
            <Overload retVal="Image" descr="Generate image: vertical gradient">
 | 
					            <Overload retVal="Image" descr="Generate image: linear gradient">
 | 
				
			||||||
                <Param name="int width" />
 | 
					                <Param name="int width" />
 | 
				
			||||||
                <Param name="int height" />
 | 
					                <Param name="int height" />
 | 
				
			||||||
                <Param name="Color top" />
 | 
					                <Param name="int direction" />
 | 
				
			||||||
                <Param name="Color bottom" />
 | 
					                <Param name="Color start" />
 | 
				
			||||||
            </Overload>
 | 
					                <Param name="Color end" />
 | 
				
			||||||
        </KeyWord>
 | 
					 | 
				
			||||||
        <KeyWord name="GenImageGradientH" func="yes">
 | 
					 | 
				
			||||||
            <Overload retVal="Image" descr="Generate image: horizontal gradient">
 | 
					 | 
				
			||||||
                <Param name="int width" />
 | 
					 | 
				
			||||||
                <Param name="int height" />
 | 
					 | 
				
			||||||
                <Param name="Color left" />
 | 
					 | 
				
			||||||
                <Param name="Color right" />
 | 
					 | 
				
			||||||
            </Overload>
 | 
					            </Overload>
 | 
				
			||||||
        </KeyWord>
 | 
					        </KeyWord>
 | 
				
			||||||
        <KeyWord name="GenImageGradientRadial" func="yes">
 | 
					        <KeyWord name="GenImageGradientRadial" func="yes">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -317,8 +317,7 @@ RLAPI bool ExportImageAsCode(Image image, const char *fileName);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Image generation functions
 | 
					// Image generation functions
 | 
				
			||||||
RLAPI Image GenImageColor(int width, int height, Color color);                                           // Generate image: plain color
 | 
					RLAPI Image GenImageColor(int width, int height, Color color);                                           // Generate image: plain color
 | 
				
			||||||
RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom);                           // Generate image: vertical gradient
 | 
					RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end);        // Generate image: linear gradient
 | 
				
			||||||
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right);                           // Generate image: horizontal gradient
 | 
					 | 
				
			||||||
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);      // Generate image: radial gradient
 | 
					RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);      // Generate image: radial gradient
 | 
				
			||||||
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2);    // Generate image: checked
 | 
					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 GenImageWhiteNoise(int width, int height, float factor);                                     // Generate image: white noise
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1239,8 +1239,7 @@ RLAPI bool ExportImageAsCode(Image image, const char *fileName);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Image generation functions
 | 
					// Image generation functions
 | 
				
			||||||
RLAPI Image GenImageColor(int width, int height, Color color);                                           // Generate image: plain color
 | 
					RLAPI Image GenImageColor(int width, int height, Color color);                                           // Generate image: plain color
 | 
				
			||||||
RLAPI Image GenImageGradientV(int width, int height, Color top, Color bottom);                           // Generate image: vertical gradient
 | 
					RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end);        // Generate image: linear gradient
 | 
				
			||||||
RLAPI Image GenImageGradientH(int width, int height, Color left, Color right);                           // Generate image: horizontal gradient
 | 
					 | 
				
			||||||
RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);      // Generate image: radial gradient
 | 
					RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);      // Generate image: radial gradient
 | 
				
			||||||
RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2);    // Generate image: checked
 | 
					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 GenImageWhiteNoise(int width, int height, float factor);                                     // Generate image: white noise
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -684,48 +684,35 @@ Image GenImageColor(int width, int height, Color color)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(SUPPORT_IMAGE_GENERATION)
 | 
					#if defined(SUPPORT_IMAGE_GENERATION)
 | 
				
			||||||
// Generate image: vertical gradient
 | 
					// Generate image: linear gradient
 | 
				
			||||||
Image GenImageGradientV(int width, int height, Color top, Color bottom)
 | 
					// The direction value specifies the direction of the gradient (in degrees) 
 | 
				
			||||||
 | 
					// with 0 being vertical (from top to bottom), 90 being horizontal (from left to right).
 | 
				
			||||||
 | 
					// The gradient effectively rotates counter-clockwise by the specified amount.
 | 
				
			||||||
 | 
					Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
 | 
					    Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (int j = 0; j < height; j++)
 | 
					    float radianDirection = (float)(90 - direction) / 180.f * 3.14159f;
 | 
				
			||||||
 | 
					    float cosDir = cos(radianDirection);
 | 
				
			||||||
 | 
					    float sinDir = sin(radianDirection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int i, j;
 | 
				
			||||||
 | 
					    for (i = 0; i < width; i++)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        float factor = (float)j/(float)height;
 | 
					        for (j = 0; j < height; j++)
 | 
				
			||||||
        for (int i = 0; i < width; i++)
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            pixels[j*width + i].r = (int)((float)bottom.r*factor + (float)top.r*(1.f - factor));
 | 
					            // Calculate the relative position of the pixel along the gradient direction
 | 
				
			||||||
            pixels[j*width + i].g = (int)((float)bottom.g*factor + (float)top.g*(1.f - factor));
 | 
					            float pos = (i * cosDir + j * sinDir) / (width * cosDir + height * sinDir);
 | 
				
			||||||
            pixels[j*width + i].b = (int)((float)bottom.b*factor + (float)top.b*(1.f - factor));
 | 
					 | 
				
			||||||
            pixels[j*width + i].a = (int)((float)bottom.a*factor + (float)top.a*(1.f - factor));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Image image = {
 | 
					            float factor = pos;
 | 
				
			||||||
        .data = pixels,
 | 
					            factor = (factor > 1.f) ? 1.f : factor;  // Clamp to [0,1]
 | 
				
			||||||
        .width = width,
 | 
					            factor = (factor < 0.f) ? 0.f : factor;  // Clamp to [0,1]
 | 
				
			||||||
        .height = height,
 | 
					 | 
				
			||||||
        .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
 | 
					 | 
				
			||||||
        .mipmaps = 1
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return image;
 | 
					            // Generate the color for this pixel
 | 
				
			||||||
}
 | 
					            pixels[j * width + i].r = (int)((float)end.r*factor + (float)start.r*(1.f - factor));
 | 
				
			||||||
 | 
					            pixels[j * width + i].g = (int)((float)end.g*factor + (float)start.g*(1.f - factor));
 | 
				
			||||||
// Generate image: horizontal gradient
 | 
					            pixels[j * width + i].b = (int)((float)end.b*factor + (float)start.b*(1.f - factor));
 | 
				
			||||||
Image GenImageGradientH(int width, int height, Color left, Color right)
 | 
					            pixels[j * width + i].a = (int)((float)end.a*factor + (float)start.a*(1.f - factor));
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for (int i = 0; i < width; i++)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        float factor = (float)i/(float)width;
 | 
					 | 
				
			||||||
        for (int j = 0; j < height; j++)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            pixels[j*width + i].r = (int)((float)right.r*factor + (float)left.r*(1.f - factor));
 | 
					 | 
				
			||||||
            pixels[j*width + i].g = (int)((float)right.g*factor + (float)left.g*(1.f - factor));
 | 
					 | 
				
			||||||
            pixels[j*width + i].b = (int)((float)right.b*factor + (float)left.b*(1.f - factor));
 | 
					 | 
				
			||||||
            pixels[j*width + i].a = (int)((float)right.a*factor + (float)left.a*(1.f - factor));
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user