summaryrefslogtreecommitdiff
path: root/src/textures.c
diff options
context:
space:
mode:
authorjussi2023-08-17 18:33:50 +0300
committerjussi2023-08-17 18:33:50 +0300
commitb7b46ada041ad56b1bc84fea3062464b702135c5 (patch)
tree6453e7100bdb7c5353d0eb4f5227c0c571533d45 /src/textures.c
parent5438a70b0a5aac72c071c90650b509cf46e557cb (diff)
downloadreilua-enhanced-b7b46ada041ad56b1bc84fea3062464b702135c5.tar.gz
reilua-enhanced-b7b46ada041ad56b1bc84fea3062464b702135c5.tar.bz2
reilua-enhanced-b7b46ada041ad56b1bc84fea3062464b702135c5.zip
Vertex buffers state and Shader state functions. Vertex buffers management WIP.
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/textures.c b/src/textures.c
index 786dfd4..c04179d 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -85,6 +85,8 @@ Texture2D* texturesGetSourceTexture( size_t id ) {
break;
}
}
+
+ return &state->textures[id]->texture;
}
void texturesFreeTexture( size_t id ) {
@@ -752,6 +754,33 @@ int ltexturesImageAlphaPremultiply( lua_State *L ) {
}
/*
+> success = RL.ImageBlurGaussian( Image image, int blurSize )
+
+Apply Gaussian blur using a box blur approximation
+
+- Failure return false
+- Success return true
+*/
+int ltexturesImageBlurGaussian( lua_State *L ) {
+ if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) ) {
+ TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageBlurGaussian( Image image, int blurSize )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ size_t imageId = lua_tointeger( L, 1 );
+ int blurSize = lua_tointeger( L, 2 );
+
+ if ( !validImage( imageId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ ImageBlurGaussian( state->images[ imageId ], blurSize );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
> success = RL.ImageResize( Image image, Vector2 size )
Resize image ( Bicubic scaling algorithm )
@@ -1397,6 +1426,36 @@ int ltexturesImageDrawCircle( lua_State *L ) {
}
/*
+> success = RL.ImageDrawCircleLines( Image dst, Vector2 center, int radius, Color color )
+
+Draw circle outline within an image
+
+- Failure return false
+- Success return true
+*/
+int ltexturesImageDrawCircleLines( lua_State *L ) {
+ if ( !lua_isnumber( L, 1 ) || !lua_istable( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_istable( L, 4 ) ) {
+ TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageDrawCircleLines( Image dst, Vector2 center, int radius, Color color )" );
+ lua_pushboolean( L, false );
+ return 1;
+ }
+ size_t imageId = lua_tointeger( L, 1 );
+ Vector2 center = uluaGetVector2Index( L, 2 );
+ int radius = lua_tointeger( L, 3 );
+ Color color = uluaGetColorIndex( L, 4 );
+
+ if ( !validImage( imageId ) ) {
+ lua_pushboolean( L, false );
+ return 1;
+ }
+
+ ImageDrawCircleLinesV( state->images[ imageId ], center, radius, color );
+ lua_pushboolean( L, true );
+
+ return 1;
+}
+
+/*
> success = RL.ImageDrawRectangle( Image dst, Rectangle rec, Color color )
Draw rectangle within an image