change to more generic

This commit is contained in:
CrackedPixel 2025-02-16 10:20:46 -06:00
parent 4270474ed5
commit 1adeedc70d

View File

@ -1240,7 +1240,7 @@ Used to perform **aspect ratio scaling** on the image element. As of this versio
```C ```C
// Load an image somewhere in your code // Load an image somewhere in your code
Texture profilePicture = LoadTexture("profilePicture.png"); YourImage profilePicture = LoadYourImage("profilePicture.png");
// Note that when rendering, .imageData will be void* type. // Note that when rendering, .imageData will be void* type.
CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = { 60, 60 } } }) {} CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = { 60, 60 } } }) {}
``` ```
@ -1249,7 +1249,7 @@ CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = { 60, 60 } }
```C ```C
// Load an image somewhere in your code // Load an image somewhere in your code
Texture profilePicture = LoadTexture("profilePicture.png"); YourImage profilePicture = LoadYourImage("profilePicture.png");
// Declare a reusable image config // Declare a reusable image config
Clay_ImageElementConfig imageConfig = (Clay_ImageElementConfig) { .imageData = &profilePicture, .sourceDimensions = {60, 60} }; Clay_ImageElementConfig imageConfig = (Clay_ImageElementConfig) { .imageData = &profilePicture, .sourceDimensions = {60, 60} };
// Declare an image element using a reusable config // Declare an image element using a reusable config
@ -1257,7 +1257,7 @@ CLAY({ .image = imageConfig }) {}
// Declare an image element using an inline config // Declare an image element using an inline config
CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = {60, 60} } }) {} CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = {60, 60} } }) {}
// Rendering example // Rendering example
Texture *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData; YourImage *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData;
``` ```
**Rendering** **Rendering**