mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 07:22:45 +00:00 
			
		
		
		
	LibGfx: Add convenience method Point::constrained
This commit is contained in:
		
							parent
							
								
									790eacfbd1
								
							
						
					
					
						commit
						a43ba348e1
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -28,8 +28,8 @@ | |||
| 
 | ||||
| #include <AK/Forward.h> | ||||
| #include <AK/StdLibExtras.h> | ||||
| #include <LibGfx/Orientation.h> | ||||
| #include <LibGfx/Forward.h> | ||||
| #include <LibGfx/Orientation.h> | ||||
| #include <LibIPC/Forward.h> | ||||
| #include <math.h> | ||||
| #include <stdlib.h> | ||||
|  | @ -100,6 +100,12 @@ public: | |||
|     } | ||||
| 
 | ||||
|     void constrain(const Rect<T>&); | ||||
|     Point<T> constrained(const Rect<T>& rect) const | ||||
|     { | ||||
|         Point<T> point = *this; | ||||
|         point.constrain(rect); | ||||
|         return point; | ||||
|     } | ||||
| 
 | ||||
|     bool operator==(const Point<T>& other) const | ||||
|     { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Tom
						Tom