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 /// ## Thread safety
295 /// It is safe to call this function from any thread.
296 ///
297 /// ## Availability
298 /// This function is available since SDL 3.2.0.
299 ///
300 /// ## See also
301 /// - [`SDL_HasRectIntersection`]
302 pub fn SDL_GetRectIntersection(
303 A: *const SDL_Rect,
304 B: *const SDL_Rect,
305 result: *mut SDL_Rect,
306 ) -> ::core::primitive::bool;
307}
308
309unsafe extern "C" {
310 /// Calculate the union of two rectangles.
311 ///
312 /// ## Parameters
313 /// - `A`: an [`SDL_Rect`] structure representing the first rectangle.
314 /// - `B`: an [`SDL_Rect`] structure representing the second rectangle.
315 /// - `result`: an [`SDL_Rect`] structure filled in with the union of rectangles
316 /// `A` and `B`.
317 ///
318 /// ## Return value
319 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
320 /// information.
321 ///
322 /// ## Thread safety
323 /// It is safe to call this function from any thread.
324 ///
325 /// ## Availability
326 /// This function is available since SDL 3.2.0.
327 pub fn SDL_GetRectUnion(
328 A: *const SDL_Rect,
329 B: *const SDL_Rect,
330 result: *mut SDL_Rect,
331 ) -> ::core::primitive::bool;
332}
333
334unsafe extern "C" {
335 /// Calculate a minimal rectangle enclosing a set of points.
336 ///
337 /// If `clip` is not NULL then only points inside of the clipping rectangle are
338 /// considered.
339 ///
340 /// ## Parameters
341 /// - `points`: an array of [`SDL_Point`] structures representing points to be
342 /// enclosed.
343 /// - `count`: the number of structures in the `points` array.
344 /// - `clip`: an [`SDL_Rect`] used for clipping or NULL to enclose all points.
345 /// - `result`: an [`SDL_Rect`] structure filled in with the minimal enclosing
346 /// rectangle.
347 ///
348 /// ## Return value
349 /// Returns true if any points were enclosed or false if all the points were
350 /// outside of the clipping rectangle.
351 ///
352 /// ## Thread safety
353 /// It is safe to call this function from any thread.
354 ///
355 /// ## Availability
356 /// This function is available since SDL 3.2.0.
357 pub fn SDL_GetRectEnclosingPoints(
358 points: *const SDL_Point,
359 count: ::core::ffi::c_int,
360 clip: *const SDL_Rect,
361 result: *mut SDL_Rect,
362 ) -> ::core::primitive::bool;
363}
364
365unsafe extern "C" {
366 /// Calculate the intersection of a rectangle and line segment.
367 ///
368 /// This function is used to clip a line segment to a rectangle. A line segment
369 /// contained entirely within the rectangle or that does not intersect will
370 /// remain unchanged. A line segment that crosses the rectangle at either or
371 /// both ends will be clipped to the boundary of the rectangle and the new
372 /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
373 ///
374 /// ## Parameters
375 /// - `rect`: an [`SDL_Rect`] structure representing the rectangle to intersect.
376 /// - `X1`: a pointer to the starting X-coordinate of the line.
377 /// - `Y1`: a pointer to the starting Y-coordinate of the line.
378 /// - `X2`: a pointer to the ending X-coordinate of the line.
379 /// - `Y2`: a pointer to the ending Y-coordinate of the line.
380 ///
381 /// ## Return value
382 /// Returns true if there is an intersection, false otherwise.
383 ///
384 /// ## Thread safety
385 /// It is safe to call this function from any thread.
386 ///
387 /// ## Availability
388 /// This function is available since SDL 3.2.0.
389 pub fn SDL_GetRectAndLineIntersection(
390 rect: *const SDL_Rect,
391 X1: *mut ::core::ffi::c_int,
392 Y1: *mut ::core::ffi::c_int,
393 X2: *mut ::core::ffi::c_int,
394 Y2: *mut ::core::ffi::c_int,
395 ) -> ::core::primitive::bool;
396}
397
398/// Determine whether a point resides inside a floating point rectangle.
399///
400/// A point is considered part of a rectangle if both `p` and `r` are not NULL,
401/// and `p`'s x and y coordinates are >= to the rectangle's top left corner,
402/// and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point
403/// (0,0) and (0,1) as "inside" and (0,2) as not.
404///
405/// Note that this is a forced-inline function in a header, and not a public
406/// API function available in the SDL library (which is to say, the code is
407/// embedded in the calling program and the linker and dynamic loader will not
408/// be able to find this function inside SDL itself).
409///
410/// ## Parameters
411/// - `p`: the point to test.
412/// - `r`: the rectangle to test.
413///
414/// ## Return value
415/// Returns true if `p` is contained by `r`, false otherwise.
416///
417/// ## Thread safety
418/// It is safe to call this function from any thread.
419///
420/// ## Availability
421/// This function is available since SDL 3.2.0.
422#[inline(always)]
423pub const unsafe fn SDL_PointInRectFloat(
424 p: *const SDL_FPoint,
425 r: *const SDL_FRect,
426) -> ::core::primitive::bool {
427 return if (((((!p.is_null() && !r.is_null())
428 && (unsafe { (&raw const (*p).x).read() } >= unsafe { (&raw const (*r).x).read() }))
429 && (unsafe { (&raw const (*p).x).read() }
430 <= (unsafe { (&raw const (*r).x).read() } + unsafe { (&raw const (*r).w).read() })))
431 && (unsafe { (&raw const (*p).y).read() } >= unsafe { (&raw const (*r).y).read() }))
432 && (unsafe { (&raw const (*p).y).read() }
433 <= (unsafe { (&raw const (*r).y).read() } + unsafe { (&raw const (*r).h).read() })))
434 {
435 true
436 } else {
437 false
438 };
439}
440
441/// Determine whether a floating point rectangle takes no space.
442///
443/// A rectangle is considered "empty" for this function if `r` is NULL, or if
444/// `r`'s width and/or height are < 0.0f.
445///
446/// Note that this is a forced-inline function in a header, and not a public
447/// API function available in the SDL library (which is to say, the code is
448/// embedded in the calling program and the linker and dynamic loader will not
449/// be able to find this function inside SDL itself).
450///
451/// ## Parameters
452/// - `r`: the rectangle to test.
453///
454/// ## Return value
455/// Returns true if the rectangle is "empty", false otherwise.
456///
457/// ## Thread safety
458/// It is safe to call this function from any thread.
459///
460/// ## Availability
461/// This function is available since SDL 3.2.0.
462#[inline(always)]
463pub const unsafe fn SDL_RectEmptyFloat(r: *const SDL_FRect) -> ::core::primitive::bool {
464 return if ((!(!r.is_null()) || (unsafe { (&raw const (*r).w).read() } < 0.0_f32))
465 || (unsafe { (&raw const (*r).h).read() } < 0.0_f32))
466 {
467 true
468 } else {
469 false
470 };
471}
472
473/// Determine whether two floating point rectangles are equal, within some
474/// given epsilon.
475///
476/// Rectangles are considered equal if both are not NULL and each of their x,
477/// y, width and height are within `epsilon` of each other. If you don't know
478/// what value to use for `epsilon`, you should call the [`SDL_RectsEqualFloat`]
479/// function instead.
480///
481/// Note that this is a forced-inline function in a header, and not a public
482/// API function available in the SDL library (which is to say, the code is
483/// embedded in the calling program and the linker and dynamic loader will not
484/// be able to find this function inside SDL itself).
485///
486/// ## Parameters
487/// - `a`: the first rectangle to test.
488/// - `b`: the second rectangle to test.
489/// - `epsilon`: the epsilon value for comparison.
490///
491/// ## Return value
492/// Returns true if the rectangles are equal, false otherwise.
493///
494/// ## Thread safety
495/// It is safe to call this function from any thread.
496///
497/// ## Availability
498/// This function is available since SDL 3.2.0.
499///
500/// ## See also
501/// - [`SDL_RectsEqualFloat`]
502#[inline(always)]
503pub unsafe fn SDL_RectsEqualEpsilon(
504 a: *const SDL_FRect,
505 b: *const SDL_FRect,
506 epsilon: ::core::ffi::c_float,
507) -> ::core::primitive::bool {
508 return if ((!a.is_null() && !b.is_null())
509 && ((a == b)
510 || ((((SDL_fabsf(
511 (unsafe { (&raw const (*a).x).read() } - unsafe { (&raw const (*b).x).read() }),
512 ) <= epsilon)
513 && (SDL_fabsf(
514 (unsafe { (&raw const (*a).y).read() } - unsafe { (&raw const (*b).y).read() }),
515 ) <= epsilon))
516 && (SDL_fabsf(
517 (unsafe { (&raw const (*a).w).read() } - unsafe { (&raw const (*b).w).read() }),
518 ) <= epsilon))
519 && (SDL_fabsf(
520 (unsafe { (&raw const (*a).h).read() } - unsafe { (&raw const (*b).h).read() }),
521 ) <= epsilon))))
522 {
523 true
524 } else {
525 false
526 };
527}
528
529/// Determine whether two floating point rectangles are equal, within a default
530/// epsilon.
531///
532/// Rectangles are considered equal if both are not NULL and each of their x,
533/// y, width and height are within [`SDL_FLT_EPSILON`] of each other. This is often
534/// a reasonable way to compare two floating point rectangles and deal with the
535/// slight precision variations in floating point calculations that tend to pop
536/// up.
537///
538/// Note that this is a forced-inline function in a header, and not a public
539/// API function available in the SDL library (which is to say, the code is
540/// embedded in the calling program and the linker and dynamic loader will not
541/// be able to find this function inside SDL itself).
542///
543/// ## Parameters
544/// - `a`: the first rectangle to test.
545/// - `b`: the second rectangle to test.
546///
547/// ## Return value
548/// Returns true if the rectangles are equal, false otherwise.
549///
550/// ## Thread safety
551/// It is safe to call this function from any thread.
552///
553/// ## Availability
554/// This function is available since SDL 3.2.0.
555///
556/// ## See also
557/// - [`SDL_RectsEqualEpsilon`]
558#[inline(always)]
559pub unsafe fn SDL_RectsEqualFloat(
560 a: *const SDL_FRect,
561 b: *const SDL_FRect,
562) -> ::core::primitive::bool {
563 return unsafe { SDL_RectsEqualEpsilon(a, b, SDL_FLT_EPSILON) };
564}
565
566unsafe extern "C" {
567 /// Determine whether two rectangles intersect with float precision.
568 ///
569 /// If either pointer is NULL the function will return false.
570 ///
571 /// ## Parameters
572 /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
573 /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
574 ///
575 /// ## Return value
576 /// Returns true if there is an intersection, false otherwise.
577 ///
578 /// ## Thread safety
579 /// It is safe to call this function from any thread.
580 ///
581 /// ## Availability
582 /// This function is available since SDL 3.2.0.
583 ///
584 /// ## See also
585 /// - [`SDL_GetRectIntersectionFloat`]
586 pub fn SDL_HasRectIntersectionFloat(
587 A: *const SDL_FRect,
588 B: *const SDL_FRect,
589 ) -> ::core::primitive::bool;
590}
591
592unsafe extern "C" {
593 /// Calculate the intersection of two rectangles with float precision.
594 ///
595 /// If `result` is NULL then this function will return false.
596 ///
597 /// ## Parameters
598 /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
599 /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
600 /// - `result`: an [`SDL_FRect`] structure filled in with the intersection of
601 /// rectangles `A` and `B`.
602 ///
603 /// ## Return value
604 /// Returns true if there is an intersection, false otherwise.
605 ///
606 /// ## Thread safety
607 /// It is safe to call this function from any thread.
608 ///
609 /// ## Availability
610 /// This function is available since SDL 3.2.0.
611 ///
612 /// ## See also
613 /// - [`SDL_HasRectIntersectionFloat`]
614 pub fn SDL_GetRectIntersectionFloat(
615 A: *const SDL_FRect,
616 B: *const SDL_FRect,
617 result: *mut SDL_FRect,
618 ) -> ::core::primitive::bool;
619}
620
621unsafe extern "C" {
622 /// Calculate the union of two rectangles with float precision.
623 ///
624 /// ## Parameters
625 /// - `A`: an [`SDL_FRect`] structure representing the first rectangle.
626 /// - `B`: an [`SDL_FRect`] structure representing the second rectangle.
627 /// - `result`: an [`SDL_FRect`] structure filled in with the union of rectangles
628 /// `A` and `B`.
629 ///
630 /// ## Return value
631 /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
632 /// information.
633 ///
634 /// ## Thread safety
635 /// It is safe to call this function from any thread.
636 ///
637 /// ## Availability
638 /// This function is available since SDL 3.2.0.
639 pub fn SDL_GetRectUnionFloat(
640 A: *const SDL_FRect,
641 B: *const SDL_FRect,
642 result: *mut SDL_FRect,
643 ) -> ::core::primitive::bool;
644}
645
646unsafe extern "C" {
647 /// Calculate a minimal rectangle enclosing a set of points with float
648 /// precision.
649 ///
650 /// If `clip` is not NULL then only points inside of the clipping rectangle are
651 /// considered.
652 ///
653 /// ## Parameters
654 /// - `points`: an array of [`SDL_FPoint`] structures representing points to be
655 /// enclosed.
656 /// - `count`: the number of structures in the `points` array.
657 /// - `clip`: an [`SDL_FRect`] used for clipping or NULL to enclose all points.
658 /// - `result`: an [`SDL_FRect`] structure filled in with the minimal enclosing
659 /// rectangle.
660 ///
661 /// ## Return value
662 /// Returns true if any points were enclosed or false if all the points were
663 /// outside of the clipping rectangle.
664 ///
665 /// ## Thread safety
666 /// It is safe to call this function from any thread.
667 ///
668 /// ## Availability
669 /// This function is available since SDL 3.2.0.
670 pub fn SDL_GetRectEnclosingPointsFloat(
671 points: *const SDL_FPoint,
672 count: ::core::ffi::c_int,
673 clip: *const SDL_FRect,
674 result: *mut SDL_FRect,
675 ) -> ::core::primitive::bool;
676}
677
678unsafe extern "C" {
679 /// Calculate the intersection of a rectangle and line segment with float
680 /// precision.
681 ///
682 /// This function is used to clip a line segment to a rectangle. A line segment
683 /// contained entirely within the rectangle or that does not intersect will
684 /// remain unchanged. A line segment that crosses the rectangle at either or
685 /// both ends will be clipped to the boundary of the rectangle and the new
686 /// coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
687 ///
688 /// ## Parameters
689 /// - `rect`: an [`SDL_FRect`] structure representing the rectangle to intersect.
690 /// - `X1`: a pointer to the starting X-coordinate of the line.
691 /// - `Y1`: a pointer to the starting Y-coordinate of the line.
692 /// - `X2`: a pointer to the ending X-coordinate of the line.
693 /// - `Y2`: a pointer to the ending Y-coordinate of the line.
694 ///
695 /// ## Return value
696 /// Returns true if there is an intersection, false otherwise.
697 ///
698 /// ## Thread safety
699 /// It is safe to call this function from any thread.
700 ///
701 /// ## Availability
702 /// This function is available since SDL 3.2.0.
703 pub fn SDL_GetRectAndLineIntersectionFloat(
704 rect: *const SDL_FRect,
705 X1: *mut ::core::ffi::c_float,
706 Y1: *mut ::core::ffi::c_float,
707 X2: *mut ::core::ffi::c_float,
708 Y2: *mut ::core::ffi::c_float,
709 ) -> ::core::primitive::bool;
710}
711
712#[cfg(doc)]
713use crate::everything::*;