| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2023-01-19 19:10:00 +01:00
										 |  |  |  * Copyright (c) 2023, MacDue <macdue@dueutil.tech> | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:10:00 +01:00
										 |  |  | #include <LibGfx/PaintStyle.h>
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:17:45 +02:00
										 |  |  | #include <LibWeb/Bindings/PlatformObject.h>
 | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:17:45 +02:00
										 |  |  | class CanvasGradient final : public Bindings::PlatformObject { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(CanvasGradient, Bindings::PlatformObject); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-01-28 00:05:10 +00:00
										 |  |  |     static WebIDL::ExceptionOr<JS::NonnullGCPtr<CanvasGradient>> create_radial(JS::Realm&, double x0, double y0, double r0, double x1, double y1, double r1); | 
					
						
							| 
									
										
										
										
											2022-09-25 16:38:21 -06:00
										 |  |  |     static JS::NonnullGCPtr<CanvasGradient> create_linear(JS::Realm&, double x0, double y0, double x1, double y1); | 
					
						
							|  |  |  |     static JS::NonnullGCPtr<CanvasGradient> create_conic(JS::Realm&, double start_angle, double x, double y); | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-04 18:02:33 +00:00
										 |  |  |     WebIDL::ExceptionOr<void> add_color_stop(double offset, DeprecatedString const& color); | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ~CanvasGradient(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:10:00 +01:00
										 |  |  |     NonnullRefPtr<Gfx::PaintStyle> to_gfx_paint_style() { return m_gradient; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-01-19 19:10:00 +01:00
										 |  |  |     CanvasGradient(JS::Realm&, Gfx::GradientPaintStyle& gradient); | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:10:00 +01:00
										 |  |  |     NonnullRefPtr<Gfx::GradientPaintStyle> m_gradient; | 
					
						
							| 
									
										
										
										
											2022-02-03 20:08:27 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |