@@ -11,7 +11,7 @@ use graphene_core::raster_types::{CPU, Raster};
1111use graphene_core:: table:: Table ;
1212use graphene_core_shaders:: color:: Color ;
1313use graphene_core_shaders:: context:: Ctx ;
14- use graphene_core_shaders:: registry:: types:: { Angle , Percentage , SignedPercentage } ;
14+ use graphene_core_shaders:: registry:: types:: { AngleF32 , PercentageF32 , SignedPercentageF32 } ;
1515#[ cfg( not( feature = "std" ) ) ]
1616use num_traits:: float:: Float ;
1717
@@ -149,8 +149,8 @@ fn brightness_contrast<T: Adjust<Color>>(
149149 GradientStops ,
150150 ) ]
151151 mut input : T ,
152- brightness : SignedPercentage ,
153- contrast : SignedPercentage ,
152+ brightness : SignedPercentageF32 ,
153+ contrast : SignedPercentageF32 ,
154154 use_classic : bool ,
155155) -> T {
156156 if use_classic {
@@ -239,11 +239,11 @@ fn levels<T: Adjust<Color>>(
239239 GradientStops ,
240240 ) ]
241241 mut image : T ,
242- #[ default( 0. ) ] shadows : Percentage ,
243- #[ default( 50. ) ] midtones : Percentage ,
244- #[ default( 100. ) ] highlights : Percentage ,
245- #[ default( 0. ) ] output_minimums : Percentage ,
246- #[ default( 100. ) ] output_maximums : Percentage ,
242+ #[ default( 0. ) ] shadows : PercentageF32 ,
243+ #[ default( 50. ) ] midtones : PercentageF32 ,
244+ #[ default( 100. ) ] highlights : PercentageF32 ,
245+ #[ default( 0. ) ] output_minimums : PercentageF32 ,
246+ #[ default( 100. ) ] output_maximums : PercentageF32 ,
247247) -> T {
248248 image. adjust ( |color| {
249249 let color = color. to_gamma_srgb ( ) ;
@@ -310,22 +310,22 @@ fn black_and_white<T: Adjust<Color>>(
310310 #[ default( Color :: BLACK ) ] tint : Table < Color > ,
311311 #[ default( 40. ) ]
312312 #[ range( ( -200. , 300. ) ) ]
313- reds : Percentage ,
313+ reds : PercentageF32 ,
314314 #[ default( 60. ) ]
315315 #[ range( ( -200. , 300. ) ) ]
316- yellows : Percentage ,
316+ yellows : PercentageF32 ,
317317 #[ default( 40. ) ]
318318 #[ range( ( -200. , 300. ) ) ]
319- greens : Percentage ,
319+ greens : PercentageF32 ,
320320 #[ default( 60. ) ]
321321 #[ range( ( -200. , 300. ) ) ]
322- cyans : Percentage ,
322+ cyans : PercentageF32 ,
323323 #[ default( 20. ) ]
324324 #[ range( ( -200. , 300. ) ) ]
325- blues : Percentage ,
325+ blues : PercentageF32 ,
326326 #[ default( 80. ) ]
327327 #[ range( ( -200. , 300. ) ) ]
328- magentas : Percentage ,
328+ magentas : PercentageF32 ,
329329) -> T {
330330 let tint: Option < Color > = tint. into ( ) ;
331331 let tint = tint. unwrap_or ( Color :: BLACK ) ;
@@ -383,9 +383,9 @@ fn hue_saturation<T: Adjust<Color>>(
383383 GradientStops ,
384384 ) ]
385385 mut input : T ,
386- hue_shift : Angle ,
387- saturation_shift : SignedPercentage ,
388- lightness_shift : SignedPercentage ,
386+ hue_shift : AngleF32 ,
387+ saturation_shift : SignedPercentageF32 ,
388+ lightness_shift : SignedPercentageF32 ,
389389) -> T {
390390 input. adjust ( |color| {
391391 let color = color. to_gamma_srgb ( ) ;
@@ -441,8 +441,8 @@ fn threshold<T: Adjust<Color>>(
441441 GradientStops ,
442442 ) ]
443443 mut image : T ,
444- #[ default( 50. ) ] min_luminance : Percentage ,
445- #[ default( 100. ) ] max_luminance : Percentage ,
444+ #[ default( 50. ) ] min_luminance : PercentageF32 ,
445+ #[ default( 100. ) ] max_luminance : PercentageF32 ,
446446 luminance_calc : LuminanceCalculation ,
447447) -> T {
448448 image. adjust ( |color| {
@@ -487,7 +487,7 @@ fn vibrance<T: Adjust<Color>>(
487487 GradientStops ,
488488 ) ]
489489 mut image : T ,
490- vibrance : SignedPercentage ,
490+ vibrance : SignedPercentageF32 ,
491491) -> T {
492492 image. adjust ( |color| {
493493 let vibrance = vibrance as f32 / 100. ;
@@ -959,21 +959,21 @@ fn exposure<T: Adjust<Color>>(
959959 GradientStops ,
960960 ) ]
961961 mut input : T ,
962- exposure : f64 ,
963- offset : f64 ,
962+ exposure : f32 ,
963+ offset : f32 ,
964964 #[ default( 1. ) ]
965965 #[ range( ( 0.01 , 10. ) ) ]
966966 #[ hard_min( 0.0001 ) ]
967- gamma_correction : f64 ,
967+ gamma_correction : f32 ,
968968) -> T {
969969 input. adjust ( |color| {
970970 let adjusted = color
971971 // Exposure
972- . map_rgb ( |c : f32 | c * 2_f32 . powf ( exposure as f32 ) )
972+ . map_rgb ( |c : f32 | c * 2_f32 . powf ( exposure) )
973973 // Offset
974- . map_rgb ( |c : f32 | c + offset as f32 )
974+ . map_rgb ( |c : f32 | c + offset)
975975 // Gamma correction
976- . gamma ( gamma_correction as f32 ) ;
976+ . gamma ( gamma_correction) ;
977977
978978 adjusted. map_rgb ( |c : f32 | c. clamp ( 0. , 1. ) )
979979 } ) ;
0 commit comments