sdl3_sys/generated/
rect.rs

1//! Some helper functions for managing rectangles and 2D points, in both
2//! integer and floating point versions.
3
4use super::stdinc::*;
5
6use super::error::*;
7
8/// The structure that defines a point (using integers).
9///
10/// ## Availability
11/// This struct is available since SDL 3.2.0.
12///
13/// ## See also
14/// - [`SDL_GetRectEnclosingPoints`]
15/// - [`SDL_PointInRect`]
16#[repr(C)]
17#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
18#[cfg_attr(feature = "debug-impls", derive(Debug))]
19pub struct SDL_Point {
20    pub x: ::core::ffi::c_int,
21    pub y: ::core::ffi::c_int,
22}
23
24/// The structure that defines a point (using floating point values).
25///
26/// ## Availability
27/// This struct is available since SDL 3.2.0.
28///
29/// ## See also
30/// - [`SDL_GetRectEnclosingPointsFloat`]
31/// - [`SDL_PointInRectFloat`]
32#[repr(C)]
33#[derive(Clone, Copy, Default, PartialEq)]
34#[cfg_attr(feature = "debug-impls", derive(Debug))]
35pub struct SDL_FPoint {
36    pub x: ::core::ffi::c_float,
37    pub y: ::core::ffi::c_float,
38}
39
40/// A rectangle, with the origin at the upper left (using integers).
41///
42/// ## Availability
43/// This struct is available since SDL 3.2.0.
44///
45/// ## See also
46/// - [`SDL_RectEmpty`]
47/// - [`SDL_RectsEqual`]
48/// - [`SDL_HasRectIntersection`]
49/// - [`SDL_GetRectIntersection`]
50/// - [`SDL_GetRectAndLineIntersection`]
51/// - [`SDL_GetRectUnion`]
52/// - [`SDL_GetRectEnclosingPoints`]
53#[repr(C)]
54#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
55#[cfg_attr(feature = "debug-impls", derive(Debug))]
56pub struct SDL_Rect {
57    pub x: ::core::ffi::c_int,
58    pub y: ::core::ffi::c_int,
59    pub w: ::core::ffi::c_int,
60    pub h: ::core::ffi::c_int,
61}
62
63/// A rectangle stored using floating point values.
64///
65/// The origin of the coordinate space is in the top-left, with increasing
66/// values moving down and right. The properties `x` and `y` represent the
67/// coordinates of the top-left corner of the rectangle.
68///
69/// ## Availability
70/// This struct is available since SDL 3.2.0.
71///
72/// ## See also
73/// - [`SDL_RectEmptyFloat`]
74/// - [`SDL_RectsEqualFloat`]
75/// - [`SDL_RectsEqualEpsilon`]
76/// - [`SDL_HasRectIntersectionFloat`]
77/// - [`SDL_GetRectIntersectionFloat`]
78/// - [`SDL_GetRectAndLineIntersectionFloat`]
79/// - [`SDL_GetRectUnionFloat`]
80/// - [`SDL_GetRectEnclosingPointsFloat`]
81/// - [`SDL_PointInRectFloat`]
82#[repr(C)]
83#[derive(Clone, Copy, Default, PartialEq)]
84#[cfg_attr(feature = "debug-impls", derive(Debug))]
85pub struct SDL_FRect {
86    pub x: ::core::ffi::c_float,
87    pub y: ::core::ffi::c_float,
88    pub w: ::core::ffi::c_float,
89    pub h: ::core::ffi::c_float,
90}
91
92/// Convert an [`SDL_Rect`] to [`SDL_FRect`]
93///
94/// ## Parameters
95/// - `rect`: a pointer to an [`SDL_Rect`].
96/// - `frect`: a pointer filled in with the floating point representation of
97///   `rect`.
98///
99/// ## Thread safety
100/// It is safe to call this function from any thread.
101///
102/// ## Availability
103/// This function is available since SDL 3.2.0.
104#[inline(always)]
105pub const unsafe fn SDL_RectToFRect(rect: *const SDL_Rect, frect: *mut SDL_FRect) {
106    {
107        let (ptr, value) = (
108            unsafe { &raw mut (*frect).x },
109            (unsafe { (&raw const (*rect).x).read() } as ::core::ffi::c_float),
110        );
111        unsafe { ptr.write(value) };
112        value
113    };
114    {
115        let (ptr, value) = (
116            unsafe { &raw mut (*frect).y },
117            (unsafe { (&raw const (*rect).y).read() } as ::core::ffi::c_float),
118        );
119        unsafe { ptr.write(value) };
120        value
121    };
122    {
123        let (ptr, value) = (
124            unsafe { &raw mut (*frect).w },
125            (unsafe { (&raw const (*rect).w).read() } as ::core::ffi::c_float),
126        );
127        unsafe { ptr.write(value) };
128        value
129    };
130    {
131        let (ptr, value) = (
132            unsafe { &raw mut (*frect).h },
133            (unsafe { (&raw const (*rect).h).read() } as ::core::ffi::c_float),
134        );
135        unsafe { ptr.write(value) };
136        value
137    };
138}
139
140/// Determine whether a point resides inside a rectangle.
141///
142/// A point is considered part of a rectangle if both `p` and `r` are not NULL,
143/// and `p`'s x and y coordinates are >= to the rectangle's top left corner,
144/// and < the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0)
145/// as "inside" and (0,1) as not.
146///
147/// Note that this is a forced-inline function in a header, and not a public
148/// API function available in the SDL library (which is to say, the code is
149/// embedded in the calling program and the linker and dynamic loader will not
150/// be able to find this function inside SDL itself).
151///
152/// ## Parameters
153/// - `p`: the point to test.
154/// - `r`: the rectangle to test.
155///
156/// ## Return value
157/// Returns true if `p` is contained by `r`, false otherwise.
158///
159/// ## Thread safety
160/// It is safe to call this function from any thread.
161///
162/// ## Availability
163/// This function is available since SDL 3.2.0.
164#[inline(always)]
165pub const unsafe fn SDL_PointInRect(
166    p: *const SDL_Point,
167    r: *const SDL_Rect,
168) -> ::core::primitive::bool {
169    return if (((((!p.is_null() && !r.is_null())
170        && (unsafe { (&raw const (*p).x).read() } >= unsafe { (&raw const (*r).x).read() }))
171        && (unsafe { (&raw const (*p).x).read() }
172            < (unsafe { (&raw const (*r).x).read() } + unsafe { (&raw const (*r).w).read() })))
173        && (unsafe { (&raw const (*p).y).read() } >= unsafe { (&raw const (*r).y).read() }))
174        && (unsafe { (&raw const (*p).y).read() }
175            < (unsafe { (&raw const (*r).y).read() } + unsafe { (&raw const (*r).h).read() })))
176    {
177        true
178    } else {
179        false
180    };
181}
182
183/// Determine whether a rectangle has no area.
184///
185/// A rectangle is considered "empty" for this function if `r` is NULL, or if
186/// `r`'s width and/or height are <= 0.
187///
188/// Note that this is a forced-inline function in a header, and not a public
189/// API function available in the SDL library (which is to say, the code is
190/// embedded in the calling program and the linker and dynamic loader will not
191/// be able to find this function inside SDL itself).
192///
193/// ## Parameters
194/// - `r`: the rectangle to test.
195///
196/// ## Return value
197/// Returns true if the rectangle is "empty", false otherwise.
198///
199/// ## Thread safety
200/// It is safe to call this function from any thread.
201///
202/// ## Availability
203/// This function is available since SDL 3.2.0.
204#[inline(always)]
205pub const unsafe fn SDL_RectEmpty(r: *const SDL_Rect) -> ::core::primitive::bool {
206    return if ((!(!r.is_null()) || (unsafe { (&raw const (*r).w).read() } <= 0_i32))
207        || (unsafe { (&raw const (*r).h).read() } <= 0_i32))
208    {
209        true
210    } else {
211        false
212    };
213}
214
215/// Determine whether two rectangles are equal.
216///
217/// Rectangles are considered equal if both are not NULL and each of their x,
218/// y, width and height match.
219///
220/// Note that this is a forced-inline function in a header, and not a public
221/// API function available in the SDL library (which is to say, the code is
222/// embedded in the calling program and the linker and dynamic loader will not
223/// be able to find this function inside SDL itself).
224///
225/// ## Parameters
226/// - `a`: the first rectangle to test.
227/// - `b`: the second rectangle to test.
228///
229/// ## Return value
230/// Returns true if the rectangles are equal, false otherwise.
231///
232/// ## Thread safety
233/// It is safe to call this function from any thread.
234///
235/// ## Availability
236/// This function is available since SDL 3.2.0.
237#[inline(always)]
238pub const unsafe fn SDL_RectsEqual(
239    a: *const SDL_Rect,
240    b: *const SDL_Rect,
241) -> ::core::primitive::bool {
242    return if (((((!a.is_null() && !b.is_null())
243        && (unsafe { (&raw const (*a).x).read() } == unsafe { (&raw const (*b).x).read() }))
244        && (unsafe { (&raw const (*a).y).read() } == unsafe { (&raw const (*b).y).read() }))
245        && (unsafe { (&raw const (*a).w).read() } == unsafe { (&raw const (*b).w).read() }))
246        && (unsafe { (&raw const (*a).h).read() } == unsafe { (&raw const (*b).h).read() }))
247    {
248        true
249    } else {
250        false
251    };
252}
253
254unsafe extern "C" {
255    /// Determine whether two rectangles intersect.
256    ///
257    /// If either pointer is NULL the function will return false.
258    ///
259    /// ## Parameters
260    /// - `A`: an [`SDL_Rect`] structure representing the first rectangle.
261    /// - `B`: an [`SDL_Rect`] structure representing the second rectangle.
262    ///
263    /// ## Return value
264    /// Returns true if there is an intersection, false otherwise.
265    ///
266    /// ## Thread safety
267    /// It is safe to call this function from any thread.
268    ///
269    /// ## Availability
270    /// This function is available since SDL 3.2.0.
271    ///
272    /// ## See also
273    /// - [`SDL_GetRectIntersection`]
274    pub fn SDL_HasRectIntersection(
275        A: *const SDL_Rect,
276        B: *const SDL_Rect,
277    ) -> ::core::primitive::bool;
278}
279
280unsafe extern "C" {
281    /// Calculate the intersection of two rectangles.
282    ///
283    /// If `result` is NULL then this function will return false.
284    ///
285    /// ## Parameters
286    /// - `A`: an [`SDL_Rect`] structure representing the first rectangle.
287    /// - `B`: an [`SDL_Rect`] structure representing the second rectangle.
288    /// - `result`: an [`SDL_Rect`] structure filled in with the intersection of
289    ///   rectangles `A` and `B`.
290    ///
291    /// ## Return value
292    /// Returns true if there is an intersection, false otherwise.
293    ///
294    /// ## Availability
295    /// This function is available since SDL 3.2.0.
296    ///
297    /// ## See also
298    /// - [`SDL_HasRectIntersection`]
299    pub fn SDL_GetRectIntersection(
300        A: *const SDL_Rect,
301        B: *const SDL_Rect,
302        result: *mut SDL_Rect,
303    ) -> ::core::primitive::bool;
304}
305
306unsafe extern "C" {
307    /// Calculate the union of two rectangles.
308    ///
309    /// ## Parameters
310    /// - `A`: an [`SDL_Rect`] structure representing the first rectangle.
311    /// - `B`: an [`SDL_Rect`] structure representing the second rectangle.
312    /// - `result`: an [`SDL_Rect`] structure filled in with the union of rectangles
313    ///   `A` and `B`.
314    ///
315    /// ## Return value
316    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
317    ///   information.
318    ///
319    /// ## Availability
320    /// This function is available since SDL 3.2.0.
321    pub fn SDL_GetRectUnion(
322        A: *const SDL_Rect,
323        B: *const SDL_Rect,
324        result: *mut SDL_Rect,
325    ) -> ::core::primitive::bool;
326}
327
328unsafe extern "C" {
329    /// Calculate a minimal rectangle enclosing a set of points.
330    ///
331    /// If `clip` is not NULL then only points inside of the clipping rectangle are
332    /// considered.
333    ///
334    /// ## Parameters
335    /// - `points`: an array of [`SDL_Point`] structures representing points to be
336    ///   enclosed.
337    /// - `count`: the number of structures in the `points` array.
338    /// - `clip`: an [`SDL_Rect`] used for clipping or NULL to enclose all points.
339    /// - `result`: an [`SDL_Rect`] structure filled in with the minimal enclosing
340    ///   rectangle.
341    ///
342    /// ## Return value
343    /// Returns true if any points were enclosed or false if all the points were
344    ///   outside of the clipping rectangle.
345    ///
346    /// ## Availability
347    /// This function is available since SDL 3.2.0.
348    pub fn SDL_GetRectEnclosingPoints(
349        points: *const SDL_Point,
350        count: ::core::ffi::c_int,
351        clip: *const SDL_Rect,
352        result: *mut SDL_Rect,
353    ) -> ::core::primitive::bool;
354}
355
356unsafe extern "C" {
357    /// Calculate the intersection of a rectangle and line segment.
358    ///
359    /// This function is used to clip a line segment to a rectangle. A line segment
360    /// contained entirely within the rectangle or that does not intersect will
361    /// remain unchanged. A line segment that crosses the rectangle at either or
362    /// both ends will be clipped to the boundary of the rectangle and the new
363    /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
364    ///
365    /// ## Parameters
366    /// - `rect`: an [`SDL_Rect`] structure representing the rectangle to intersect.
367    /// - `X1`: a pointer to the starting X-coordinate of the line.
368    /// - `Y1`: a pointer to the starting Y-coordinate of the line.
369    /// - `X2`: a pointer to the ending X-coordinate of the line.
370    /// - `Y2`: a pointer to the ending Y-coordinate of the line.
371    ///
372    /// ## Return value
373    /// Returns true if there is an intersection, false otherwise.
374    ///
375    /// ## Availability
376    /// This function is available since SDL 3.2.0.
377    pub fn SDL_GetRectAndLineIntersection(
378        rect: *const SDL_Rect,
379        X1: *mut ::core::ffi::c_int,
380        Y1: *mut ::core::ffi::c_int,
381        X2: *mut ::core::ffi::c_int,
382        Y2: *mut ::core::ffi::c_int,
383    ) -> ::core::primitive::bool;
384}
385
386/// Determine whether a point resides inside a floating point rectangle.
387///
388/// A point is considered part of a rectangle if both `p` and `r` are not NULL,
389/// and `p`'s x and y coordinates are >= to the rectangle's top left corner,
390/// and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point
391/// (0,0) and (0,1) as "inside" and (0,2) as not.
392///
393/// Note that this is a forced-inline function in a header, and not a public
394/// API function available in the SDL library (which is to say, the code is
395/// embedded in the calling program and the linker and dynamic loader will not
396/// be able to find this function inside SDL itself).
397///
398/// ## Parameters
399/// - `p`: the point to test.
400/// - `r`: the rectangle to test.
401///
402/// ## Return value
403/// Returns true if `p` is contained by `r`, false otherwise.
404///
405/// ## Thread safety
406/// It is safe to call this function from any thread.
407///
408/// ## Availability
409/// This function is available since SDL 3.2.0.
410#[inline(always)]
411pub const unsafe fn SDL_PointInRectFloat(
412    p: *const SDL_FPoint,
413    r: *const SDL_FRect,
414) -> ::core::primitive::bool {
415    return if (((((!p.is_null() && !r.is_null())
416        && (unsafe { (&raw const (*p).x).read() } >= unsafe { (&raw const (*r).x).read() }))
417        && (unsafe { (&raw const (*p).x).read() }
418            <= (unsafe { (&raw const (*r).x).read() } + unsafe { (&raw const (*r).w).read() })))
419        && (unsafe { (&raw const (*p).y).read() } >= unsafe { (&raw const (*r).y).read() }))
420        && (unsafe { (&raw const (*p).y).read() }
421            <= (unsafe { (&raw const (*r).y).read() } + unsafe { (&raw const (*r).h).read() })))
422    {
423        true
424    } else {
425        false
426    };
427}
428
429/// Determine whether a floating point rectangle takes no space.
430///
431/// A rectangle is considered "empty" for this function if `r` is NULL, or if
432/// `r`'s width and/or height are < 0.0f.
433///
434/// Note that this is a forced-inline function in a header, and not a public
435/// API function available in the SDL library (which is to say, the code is
436/// embedded in the calling program and the linker and dynamic loader will not
437/// be able to find this function inside SDL itself).
438///
439/// ## Parameters
440/// - `r`: the rectangle to test.
441///
442/// ## Return value
443/// Returns true if the rectangle is "empty", false otherwise.
444///
445/// ## Thread safety
446/// It is safe to call this function from any thread.
447///
448/// ## Availability
449/// This function is available since SDL 3.2.0.
450#[inline(always)]
451pub const unsafe fn SDL_RectEmptyFloat(r: *const SDL_FRect) -> ::core::primitive::bool {
452    return if ((!(!r.is_null()) || (unsafe { (&raw const (*r).w).read() } < 0.0_f32))
453        || (unsafe { (&raw const (*r).h).read() } < 0.0_f32))
454    {
455        true
456    } else {
457        false
458    };
459}
460
461/// Determine whether two floating point rectangles are equal, within some
462/// given epsilon.
463///
464/// Rectangles are considered equal if both are not NULL and each of their x,
465/// y, width and height are within `epsilon` of each other. If you don't know
466/// what value to use for `epsilon`, you should call the [`SDL_RectsEqualFloat`]
467/// function instead.
468///
469/// Note that this is a forced-inline function in a header, and not a public
470/// API function available in the SDL library (which is to say, the code is
471/// embedded in the calling program and the linker and dynamic loader will not
472/// be able to find this function inside SDL itself).
473///
474/// ## Parameters
475/// - `a`: the first rectangle to test.
476/// - `b`: the second rectangle to test.
477/// - `epsilon`: the epsilon value for comparison.
478///
479/// ## Return value
480/// Returns true if the rectangles are equal, false otherwise.
481///
482/// ## Thread safety
483/// It is safe to call this function from any thread.
484///
485/// ## Availability
486/// This function is available since SDL 3.2.0.
487///
488/// ## See also
489/// - [`SDL_RectsEqualFloat`]
490#[inline(always)]
491pub unsafe fn SDL_RectsEqualEpsilon(
492    a: *const SDL_FRect,
493    b: *const SDL_FRect,
494    epsilon: ::core::ffi::c_float,
495) -> ::core::primitive::bool {
496    return if ((!a.is_null() && !b.is_null())
497        && ((a == b)
498            || ((((SDL_fabsf(
499                (unsafe { (&raw const (*a).x).read() } - unsafe { (&raw const (*b).x).read() }),
500            ) <= epsilon)
501                && (SDL_fabsf(
502                    (unsafe { (&raw const (*a).y).read() } - unsafe { (&raw const (*b).y).read() }),
503                ) <= epsilon))
504                && (SDL_fabsf(
505                    (unsafe { (&raw const (*a).w).read() } - unsafe { (&raw const (*b).w).read() }),
506                ) <= epsilon))
507                && (SDL_fabsf(
508                    (unsafe { (&raw const (*a).h).read() } - unsafe { (&raw const (*b).h).read() }),
509                ) <= epsilon))))
510    {
511        true
512    } else {
513        false
514    };
515}
516
517/// Determine whether two floating point rectangles are equal, within a default
518/// epsilon.
519///
520/// Rectangles are considered equal if both are not NULL and each of their x,
521/// y, width and height are within [`SDL_FLT_EPSILON`] of each other. This is often
522/// a reasonable way to compare two floating point rectangles and deal with the
523/// slight precision variations in floating point calculations that tend to pop
524/// up.
525///
526/// Note that this is a forced-inline function in a header, and not a public
527/// API function available in the SDL library (which is to say, the code is
528/// embedded in the calling program and the linker and dynamic loader will not
529/// be able to find this function inside SDL itself).
530///
531/// ## Parameters
532/// - `a`: the first rectangle to test.
533/// - `b`: the second rectangle to test.
534///
535/// ## Return value
536/// Returns true if the rectangles are equal, false otherwise.
537///
538/// ## Thread safety
539/// It is safe to call this function from any thread.
540///
541/// ## Availability
542/// This function is available since SDL 3.2.0.
543///
544/// ## See also
545/// - [`SDL_RectsEqualEpsilon`]
546#[inline(always)]
547pub unsafe fn SDL_RectsEqualFloat(
548    a: *const SDL_FRect,
549    b: *const SDL_FRect,
550) -> ::core::primitive::bool {
551    return unsafe { SDL_RectsEqualEpsilon(a, b, SDL_FLT_EPSILON) };
552}
553
554unsafe extern "C" {
555    /// Determine whether two rectangles intersect with float precision.
556    ///
557    /// If either pointer is NULL the function will return false.
558    ///
559    /// ## Parameters
560    /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
561    /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
562    ///
563    /// ## Return value
564    /// Returns true if there is an intersection, false otherwise.
565    ///
566    /// ## Availability
567    /// This function is available since SDL 3.2.0.
568    ///
569    /// ## See also
570    /// - [`SDL_GetRectIntersection`]
571    pub fn SDL_HasRectIntersectionFloat(
572        A: *const SDL_FRect,
573        B: *const SDL_FRect,
574    ) -> ::core::primitive::bool;
575}
576
577unsafe extern "C" {
578    /// Calculate the intersection of two rectangles with float precision.
579    ///
580    /// If `result` is NULL then this function will return false.
581    ///
582    /// ## Parameters
583    /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
584    /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
585    /// - `result`: an [`SDL_FRect`] structure filled in with the intersection of
586    ///   rectangles `A` and `B`.
587    ///
588    /// ## Return value
589    /// Returns true if there is an intersection, false otherwise.
590    ///
591    /// ## Availability
592    /// This function is available since SDL 3.2.0.
593    ///
594    /// ## See also
595    /// - [`SDL_HasRectIntersectionFloat`]
596    pub fn SDL_GetRectIntersectionFloat(
597        A: *const SDL_FRect,
598        B: *const SDL_FRect,
599        result: *mut SDL_FRect,
600    ) -> ::core::primitive::bool;
601}
602
603unsafe extern "C" {
604    /// Calculate the union of two rectangles with float precision.
605    ///
606    /// ## Parameters
607    /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
608    /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
609    /// - `result`: an [`SDL_FRect`] structure filled in with the union of rectangles
610    ///   `A` and `B`.
611    ///
612    /// ## Return value
613    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
614    ///   information.
615    ///
616    /// ## Availability
617    /// This function is available since SDL 3.2.0.
618    pub fn SDL_GetRectUnionFloat(
619        A: *const SDL_FRect,
620        B: *const SDL_FRect,
621        result: *mut SDL_FRect,
622    ) -> ::core::primitive::bool;
623}
624
625unsafe extern "C" {
626    /// Calculate a minimal rectangle enclosing a set of points with float
627    /// precision.
628    ///
629    /// If `clip` is not NULL then only points inside of the clipping rectangle are
630    /// considered.
631    ///
632    /// ## Parameters
633    /// - `points`: an array of [`SDL_FPoint`] structures representing points to be
634    ///   enclosed.
635    /// - `count`: the number of structures in the `points` array.
636    /// - `clip`: an [`SDL_FRect`] used for clipping or NULL to enclose all points.
637    /// - `result`: an [`SDL_FRect`] structure filled in with the minimal enclosing
638    ///   rectangle.
639    ///
640    /// ## Return value
641    /// Returns true if any points were enclosed or false if all the points were
642    ///   outside of the clipping rectangle.
643    ///
644    /// ## Availability
645    /// This function is available since SDL 3.2.0.
646    pub fn SDL_GetRectEnclosingPointsFloat(
647        points: *const SDL_FPoint,
648        count: ::core::ffi::c_int,
649        clip: *const SDL_FRect,
650        result: *mut SDL_FRect,
651    ) -> ::core::primitive::bool;
652}
653
654unsafe extern "C" {
655    /// Calculate the intersection of a rectangle and line segment with float
656    /// precision.
657    ///
658    /// This function is used to clip a line segment to a rectangle. A line segment
659    /// contained entirely within the rectangle or that does not intersect will
660    /// remain unchanged. A line segment that crosses the rectangle at either or
661    /// both ends will be clipped to the boundary of the rectangle and the new
662    /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
663    ///
664    /// ## Parameters
665    /// - `rect`: an [`SDL_FRect`] structure representing the rectangle to intersect.
666    /// - `X1`: a pointer to the starting X-coordinate of the line.
667    /// - `Y1`: a pointer to the starting Y-coordinate of the line.
668    /// - `X2`: a pointer to the ending X-coordinate of the line.
669    /// - `Y2`: a pointer to the ending Y-coordinate of the line.
670    ///
671    /// ## Return value
672    /// Returns true if there is an intersection, false otherwise.
673    ///
674    /// ## Availability
675    /// This function is available since SDL 3.2.0.
676    pub fn SDL_GetRectAndLineIntersectionFloat(
677        rect: *const SDL_FRect,
678        X1: *mut ::core::ffi::c_float,
679        Y1: *mut ::core::ffi::c_float,
680        X2: *mut ::core::ffi::c_float,
681        Y2: *mut ::core::ffi::c_float,
682    ) -> ::core::primitive::bool;
683}
684
685#[cfg(doc)]
686use crate::everything::*;