mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 00:26:17 +00:00 
			
		
		
		
	change to more generic
This commit is contained in:
		
							parent
							
								
									4270474ed5
								
							
						
					
					
						commit
						1adeedc70d
					
				| 
						 | 
				
			
			@ -1240,7 +1240,7 @@ Used to perform **aspect ratio scaling** on the image element. As of this versio
 | 
			
		|||
 | 
			
		||||
```C
 | 
			
		||||
// 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.
 | 
			
		||||
CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = { 60, 60 } } }) {}
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			@ -1249,7 +1249,7 @@ CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = { 60, 60 } }
 | 
			
		|||
 | 
			
		||||
```C
 | 
			
		||||
// Load an image somewhere in your code
 | 
			
		||||
Texture profilePicture = LoadTexture("profilePicture.png");
 | 
			
		||||
YourImage profilePicture = LoadYourImage("profilePicture.png");
 | 
			
		||||
// Declare a reusable image config
 | 
			
		||||
Clay_ImageElementConfig imageConfig = (Clay_ImageElementConfig) { .imageData = &profilePicture, .sourceDimensions = {60, 60} };
 | 
			
		||||
// Declare an image element using a reusable config
 | 
			
		||||
| 
						 | 
				
			
			@ -1257,7 +1257,7 @@ CLAY({ .image = imageConfig }) {}
 | 
			
		|||
// Declare an image element using an inline config
 | 
			
		||||
CLAY({ .image = { .imageData = &profilePicture, .sourceDimensions = {60, 60} } }) {}
 | 
			
		||||
// Rendering example
 | 
			
		||||
Texture *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData;
 | 
			
		||||
YourImage *imageToRender = renderCommand->elementConfig.imageElementConfig->imageData;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**Rendering**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue