View Issue Details

IDProjectCategoryView StatusLast Update
0034872pas2jsrtlpublic2019-01-16 13:36
ReportersilvioprogAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version1.4.0Fixed in Versiontrunk 
Summary0034872: [PATCH] Added new overloaded drawImage() methods to the TJSCanvasRenderingContext2D class
DescriptionHello,

patch in attachment.
Steps To ReproduceThe patch follows it: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage#Parameters

It is useful to pass any canvas image source without using cast to TJSObject. For example:

var
  img: TJSHTMLImageElement;
  context: TJSCanvasRenderingContext2D;
begin
  ...
  context.drawImage(img, 0, 0, width, height);


instead of:

var
  img: TJSHTMLImageElement;
  context: TJSCanvasRenderingContext2D;
begin
  ...
  context.drawImage(TJSObject(img), 0, 0, width, height);
TagsNo tags attached.
Fixed in Revision257
Attached Files
  • web.pas.diff (917 bytes)
    Index: packages/rtl/web.pas
    ===================================================================
    --- packages/rtl/web.pas	(revision 256)
    +++ packages/rtl/web.pas	(working copy)
    @@ -2468,6 +2468,9 @@
         procedure drawImage(image : TJSObject; dx,dy : TCanvasCoordType); overload;
         procedure drawImage(image : TJSObject; dx,dy,dwidth,dheight : TCanvasCoordType); overload;
         procedure drawImage(image : TJSObject; sx,sy,sWidth,sHeight,dx,dy,dwidth,dheight : TCanvasCoordType); overload;
    +    procedure drawImage(image : TJSElement; dx,dy : TCanvasCoordType); overload;
    +    procedure drawImage(image : TJSElement; dx,dy,dwidth,dheight : TCanvasCoordType); overload;
    +    procedure drawImage(image : TJSElement; sx,sy,sWidth,sHeight,dx,dy,dwidth,dheight : TCanvasCoordType); overload;
         procedure fill; overload;
         procedure fill(aRule : String); overload;
         procedure fill(aPath : TJSPath2D); overload;
    
    web.pas.diff (917 bytes)

Activities

silvioprog

2019-01-14 16:30

reporter  

web.pas.diff (917 bytes)
Index: packages/rtl/web.pas
===================================================================
--- packages/rtl/web.pas	(revision 256)
+++ packages/rtl/web.pas	(working copy)
@@ -2468,6 +2468,9 @@
     procedure drawImage(image : TJSObject; dx,dy : TCanvasCoordType); overload;
     procedure drawImage(image : TJSObject; dx,dy,dwidth,dheight : TCanvasCoordType); overload;
     procedure drawImage(image : TJSObject; sx,sy,sWidth,sHeight,dx,dy,dwidth,dheight : TCanvasCoordType); overload;
+    procedure drawImage(image : TJSElement; dx,dy : TCanvasCoordType); overload;
+    procedure drawImage(image : TJSElement; dx,dy,dwidth,dheight : TCanvasCoordType); overload;
+    procedure drawImage(image : TJSElement; sx,sy,sWidth,sHeight,dx,dy,dwidth,dheight : TCanvasCoordType); overload;
     procedure fill; overload;
     procedure fill(aRule : String); overload;
     procedure fill(aPath : TJSPath2D); overload;
web.pas.diff (917 bytes)

Michael Van Canneyt

2019-01-14 16:46

administrator   ~0113405

This should be fixed differently. All classes in web.pas should descend from TJSObject. I fixed all declarations I could find. please check and close if OK.

silvioprog

2019-01-16 13:36

reporter   ~0113437

It worked like a charm. Thank you very much! :-)

Issue History

Date Modified Username Field Change
2019-01-14 16:30 silvioprog New Issue
2019-01-14 16:30 silvioprog File Added: web.pas.diff
2019-01-14 16:37 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-01-14 16:37 Michael Van Canneyt Status new => assigned
2019-01-14 16:46 Michael Van Canneyt Fixed in Revision => 257
2019-01-14 16:46 Michael Van Canneyt Note Added: 0113405
2019-01-14 16:46 Michael Van Canneyt Status assigned => resolved
2019-01-14 16:46 Michael Van Canneyt Fixed in Version => trunk
2019-01-14 16:46 Michael Van Canneyt Resolution open => fixed
2019-01-14 16:46 Michael Van Canneyt Target Version => 1.4.0
2019-01-16 13:36 silvioprog Note Added: 0113437
2019-01-16 13:36 silvioprog Status resolved => closed