@@ -63,6 +63,12 @@ namespace wi::lua
6363 lunamethod (ImageParams_BindLua, DisableAngularSoftnessDoubleSided),
6464 lunamethod (ImageParams_BindLua, DisableAngularSoftnessInverse),
6565
66+ lunamethod (ImageParams_BindLua, EnableCornerRounding),
67+ lunamethod (ImageParams_BindLua, DisableCornerRounding),
68+ lunamethod (ImageParams_BindLua, SetCornerRounding),
69+
70+ lunamethod (ImageParams_BindLua, SetGradient),
71+
6672 { nullptr , nullptr }
6773 };
6874 Luna<ImageParams_BindLua>::PropertyType ImageParams_BindLua::properties[] = {
@@ -560,7 +566,7 @@ namespace wi::lua
560566 }
561567 int ImageParams_BindLua::EnableAngularSoftnessDoubleSided (lua_State* L)
562568 {
563- params.disableAngularSoftnessDoubleSided ();
569+ params.enableAngularSoftnessDoubleSided ();
564570 return 0 ;
565571 }
566572 int ImageParams_BindLua::EnableAngularSoftnessInverse (lua_State* L)
@@ -579,6 +585,67 @@ namespace wi::lua
579585 return 0 ;
580586 }
581587
588+ int ImageParams_BindLua::EnableCornerRounding (lua_State* L)
589+ {
590+ params.enableCornerRounding ();
591+ return 0 ;
592+ }
593+ int ImageParams_BindLua::DisableCornerRounding (lua_State* L)
594+ {
595+ params.disableCornerRounding ();
596+ return 0 ;
597+ }
598+ int ImageParams_BindLua::SetCornerRounding (lua_State* L)
599+ {
600+ int argc = wi::lua::SGetArgCount (L);
601+ if (argc < 2 )
602+ {
603+ wi::lua::SError (L, " SetCornerRounding(int corner, float rounding, opt int segments = 18): not enough arguments!" );
604+ return 0 ;
605+ }
606+ int corner = clamp (wi::lua::SGetInt (L, 1 ), 0 , (int )arraysize (params.corners_rounding ) - 1 );
607+ params.corners_rounding [corner].radius = wi::lua::SGetFloat (L, 2 );
608+ if (argc > 2 )
609+ {
610+ params.corners_rounding [corner].segments = wi::lua::SGetInt (L, 3 );
611+ }
612+ return 0 ;
613+ }
614+
615+ int ImageParams_BindLua::SetGradient (lua_State* L)
616+ {
617+ int argc = wi::lua::SGetArgCount (L);
618+ if (argc < 4 )
619+ {
620+ wi::lua::SError (L, " SetGradient(ImageGradientType type, Vector uv_start, Vector uv_end, Vector color): not enough arguments!" );
621+ return 0 ;
622+ }
623+ int type = wi::lua::SGetInt (L, 1 );
624+ Vector_BindLua* s = Luna<Vector_BindLua>::lightcheck (L, 2 );
625+ if (s == nullptr )
626+ {
627+ wi::lua::SError (L, " SetGradient(ImageGradientType type, Vector uv_start, Vector uv_end, Vector color): second argument is not a Vector!" );
628+ return 0 ;
629+ }
630+ Vector_BindLua* e = Luna<Vector_BindLua>::lightcheck (L, 3 );
631+ if (s == nullptr )
632+ {
633+ wi::lua::SError (L, " SetGradient(ImageGradientType type, Vector uv_start, Vector uv_end, Vector color): third argument is not a Vector!" );
634+ return 0 ;
635+ }
636+ Vector_BindLua* c = Luna<Vector_BindLua>::lightcheck (L, 4 );
637+ if (s == nullptr )
638+ {
639+ wi::lua::SError (L, " SetGradient(ImageGradientType type, Vector uv_start, Vector uv_end, Vector color): fourth argument is not a Vector!" );
640+ return 0 ;
641+ }
642+ params.gradient = (wi::image::Params::Gradient)type;
643+ params.gradient_uv_start = s->GetFloat2 ();
644+ params.gradient_uv_end = e->GetFloat2 ();
645+ params.gradient_color = c->GetFloat4 ();
646+ return 0 ;
647+ }
648+
582649 ImageParams_BindLua::ImageParams_BindLua (lua_State* L)
583650 {
584651 float x = 0 , y = 0 , w = 100 , h = 100 ;
@@ -642,6 +709,13 @@ BLENDMODE_OPAQUE = 0
642709BLENDMODE_ALPHA = 1
643710BLENDMODE_PREMULTIPLIED = 2
644711BLENDMODE_ADDITIVE = 3
712+
713+ ImageGradientType = {
714+ None = 0,
715+ Linear = 1,
716+ LinearReflected = 2,
717+ Circular = 3,
718+ }
645719)" );
646720
647721 }
0 commit comments