@@ -207,74 +207,4 @@ internal static string EntityName(Entity entity, int? faction = null)
207207 foreach ( var j in SDL . GetFullscreenDisplayModes ( i , out _ ) )
208208 yield return j ;
209209 }
210-
211- }
212-
213- // extension methods would probably make this a bit neater
214- public static class ColorUtils
215- {
216- public static byte FloatToByte ( float f ) =>
217- ( byte ) MathF . Floor ( f >= 1 ? 255 : f * 256 ) ;
218-
219- public static float ByteToFloat ( byte b ) =>
220- ( 1.0f / 255 ) * b ;
221-
222- // ImVector4 convert
223- public static Color ImVector4ToColor ( System . Numerics . Vector4 vec )
224- {
225- return Color . FromArgb (
226- ColorUtils . FloatToByte ( vec . W ) ,
227- ColorUtils . FloatToByte ( vec . X ) ,
228- ColorUtils . FloatToByte ( vec . Y ) ,
229- ColorUtils . FloatToByte ( vec . Z ) ) ;
230- }
231-
232- public static SDL . Color ImVector4ToSDLColor ( System . Numerics . Vector4 vec )
233- {
234- return new ( ) {
235- R = ColorUtils . FloatToByte ( vec . X ) ,
236- G = ColorUtils . FloatToByte ( vec . Y ) ,
237- B = ColorUtils . FloatToByte ( vec . Z ) ,
238- A = ColorUtils . FloatToByte ( vec . W )
239- } ;
240- }
241-
242- // Color convert
243- public static SDL . Color ColorToSDLColor ( Color color )
244- {
245- return new ( ) {
246- R = color . R ,
247- G = color . G ,
248- B = color . B ,
249- A = color . A
250- } ;
251- }
252-
253- public static System . Numerics . Vector4 ColorToImVector4 ( Color color )
254- {
255- return new (
256- ColorUtils . ByteToFloat ( color . R ) ,
257- ColorUtils . ByteToFloat ( color . G ) ,
258- ColorUtils . ByteToFloat ( color . B ) ,
259- ColorUtils . ByteToFloat ( color . A ) ) ;
260- }
261-
262- // SDL.Color convert
263- public static Color SDLColorToColor ( SDL . Color color )
264- {
265- return Color . FromArgb (
266- color . A ,
267- color . R ,
268- color . G ,
269- color . B ) ;
270- }
271-
272- public static System . Numerics . Vector4 SDLColorToImVector4 ( SDL . Color color )
273- {
274- return new (
275- ColorUtils . ByteToFloat ( color . R ) ,
276- ColorUtils . ByteToFloat ( color . G ) ,
277- ColorUtils . ByteToFloat ( color . B ) ,
278- ColorUtils . ByteToFloat ( color . A ) ) ;
279- }
280210}
0 commit comments