diff --git a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasImageSource.java b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasImageSource.java new file mode 100644 index 0000000000..e4ebb61287 --- /dev/null +++ b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasImageSource.java @@ -0,0 +1,21 @@ +/* + * Copyright 2020 Mirko Sertic + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.mirkosertic.bytecoder.api.web; + +import de.mirkosertic.bytecoder.api.OpaqueReferenceType; + +public interface CanvasImageSource extends OpaqueReferenceType { +} \ No newline at end of file diff --git a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasRenderingContext2D.java b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasRenderingContext2D.java index f52c09de9f..8f1947d42c 100644 --- a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasRenderingContext2D.java +++ b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/CanvasRenderingContext2D.java @@ -19,6 +19,8 @@ import de.mirkosertic.bytecoder.api.OpaqueReferenceType; public interface CanvasRenderingContext2D extends OpaqueReferenceType { + @OpaqueProperty + void setGlobalCompositeOperation(String type); @OpaqueProperty void setFillStyle(String aStyle); @@ -52,4 +54,16 @@ public interface CanvasRenderingContext2D extends OpaqueReferenceType { void arc(double x, double y, double radius, double startAngle, double endAngle, boolean anticlockwise); void stroke(); + + void fill(); + + void rect(int x, int y, int width, int height); + + void drawImage(CanvasImageSource image, int sx, int sy); + + void drawImage(CanvasImageSource image, int sx, int sy, int sWidth, int sHeight, int dx, int dy, int dWidth, int dHeight); + + void getImageData(int sx, int sy, int sw, int sh); + + void clearRect(int x, int y, int width, int height); } diff --git a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLCanvasElement.java b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLCanvasElement.java index 1e85c8bc40..9a17cb87fe 100644 --- a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLCanvasElement.java +++ b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLCanvasElement.java @@ -15,7 +15,15 @@ */ package de.mirkosertic.bytecoder.api.web; -public interface HTMLCanvasElement extends HTMLElement { +import de.mirkosertic.bytecoder.api.OpaqueProperty; + +public interface HTMLCanvasElement extends HTMLElement, CanvasImageSource { CanvasRenderingContext2D getContext(final String contextName); + + @OpaqueProperty + int width(); + + @OpaqueProperty + int height(); } diff --git a/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLImageElement.java b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLImageElement.java new file mode 100644 index 0000000000..6b45a6c47f --- /dev/null +++ b/classlib/bytecoder.web/src/main/java/de/mirkosertic/bytecoder/api/web/HTMLImageElement.java @@ -0,0 +1,22 @@ +/* + * Copyright 2020 Mirko Sertic + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.mirkosertic.bytecoder.api.web; + + +import de.mirkosertic.bytecoder.api.OpaqueReferenceType; + +public interface HTMLImageElement extends CanvasImageSource, OpaqueReferenceType { +} \ No newline at end of file