Commit Graph

20 Commits

Author SHA1 Message Date
Luke Wilde
df7a83ac0e LibWeb: Implement CanvasRenderingContext2D.transform 2022-04-10 19:59:14 +02:00
Idan Horowitz
bc0fafade9 LibWeb: Add all overloads of CanvasRenderingContext2D::drawImage() 2022-03-05 23:40:08 +01:00
Linus Groh
e890cd5464 LibWeb: Implement CanvasRenderingContext2D.getImageData()
The actual copying of the pixel values into the created ImageData object
is a bit ugly, but Gfx::Painter doesn't like the underlying RGBA8888
bitmap.
2022-03-04 23:03:29 +01:00
Linus Groh
08608932cc LibWeb: Change CanvasRenderingContext2D.createImageData() args to long
Not sure why these are doubles in the IDL definition, both the IDL in
the spec and the implementation in the CanvasRenderingContext2D class
use integers.
2022-03-04 23:03:29 +01:00
Linus Groh
3f3326f1dc LibWeb: Implement CanvasRenderingContext2D.drawImage() closer to spec
Also add support for HTMLCanvasElement for the image parameter, leading
to replacing HTMLImageElement with the CanvasImageSource Variant type.

Also stub out the 'check the usability of the image argument' and 'is
not origin-clean' operations, while taking into consideration that these
can throw (and require DOM::ExceptionOr).
2022-03-04 23:03:29 +01:00
Ali Mohammad Pur
a59800b4a0 LibWeb: Add imports to all IDL files that depend on others 2022-02-16 22:48:32 +03:30
Andreas Kling
926d5271b4 LibWeb: Forward CanvasRenderingContext.strokeText() to fillText()
This is a hack until we get an actual text stroking implementation.
2022-02-03 22:35:13 +01:00
Andreas Kling
dc3bf32307 LibWeb: Add barebones CanvasGradient object
Also add the CanvasRenderingContext2D APIs to go along with it.
Note that it can't be used for anything yet.
2022-02-03 22:35:13 +01:00
Andreas Kling
90a8744823 LibWeb: Add CanvasRenderingContext2D.bezierCurveTo() 2022-02-03 22:35:13 +01:00
sin-ack
9121cc7cae LibWeb: Implement CanvasRenderingContext2D.measureText
This requires an implementation of the "text preparation algorithm" as
specified here:

html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm

However, we're missing a lot of things such as the
CanvasTextDrawingStyles interface, so most of the algorithm was not
implemented. Additionally, we also are not able to use a LineBox like
the algorithm suggests, because our layouting infra is not up to the
task yet. The prepare_text function does nothing other than figuring out
the width of the given text and return glyphs with offsets at the
moment.
2022-01-04 22:41:07 +00:00
Linus Groh
1298c27ca9 LibWeb: Implement CanvasRenderingContext2D.isContextLost()
Note that we don't implement the "context lost steps" yet, so this will
always return the initial value (false).
2021-12-27 16:43:23 +01:00
Linus Groh
2576af5db1 LibWeb: Implement CanvasRenderingContext2D.reset() 2021-12-27 16:43:23 +01:00
Linus Groh
3e0e965f24 LibWeb: Implement CanvasRenderingContext2D.restore() 2021-12-27 16:43:23 +01:00
Linus Groh
7d435b5ada LibWeb: Implement CanvasRenderingContext2D.save() 2021-12-27 16:43:23 +01:00
Idan Horowitz
00114ab01d LibWeb: Add a naive implemention of CanvasRenderingContext2D::fill_text
This doesnt actually account for several unimplemented attributes
(like ltr/rtl, alignment, etc) yet, so this should be expanded in
the future.
2021-04-15 20:22:08 +02:00
AnotherTest
801daf47f0 LibGfx+LibWeb: Wire up CanvasRenderingContext2D.ellipse()
Note that this is *extremely* naive, and not very good at being correct.
2021-04-15 17:50:16 +02:00
Idan Horowitz
aab99d5945 LibWeb: Implement the CanvasRenderingContext2D::rect path method
This method adds a rectangle to the current 2D path.
2021-04-14 23:01:23 +02:00
Idan Horowitz
4c0937225e LibWeb: Make CanvasRenderingContext2D::fill's fillRule argument optional
As defined by the specification (and used by the website i am testing):
interface mixin CanvasDrawPath {
  undefined fill(optional CanvasFillRule fillRule = "nonzero");
}
2021-04-14 23:01:23 +02:00
Andreas Kling
d434ae71b3 LibWeb: Add CanvasRenderingContext2D.clearRect()
Similar to fillRect, except this API fills with transparent black.
2021-03-15 21:20:33 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00