SVG DrawPicture ignores rectangle

Joe_L

Member
Licensed User
Longtime User
SVG.DrawPicture (canvas As CanvasWrapper, destrect As android.graphics.Rect)
"Draw this picture on the specified canvas to fit into the dest rectangle."

The picture is drawn at the destination rectangle origin but not clipped or scaled to the rectangle edges (contrast with DrawBitmap which does)
Dim rect1 As Rect
rect1.Initialize(200dip, 200dip,100dip,100dip)

Dim s As SVG
s.Initialize(File.DirAssets,"mypicture.svg")
s.DrawPicture(cvs,rect1)

Dim bdw As Bitmap
bdw.Initialize(File.DirAssets,"Rose2.jpg")
cvs.DrawBitmap(bdw,Null,rect1)
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I exposed DrawBitmap as the standard Canvas doesn't expose it. The behaviour you see is what Canvas.DrawPicture does. The Android documentation, such as it is, says
public void drawPicture (Picture picture, Rect dst)

Draw the picture, stretched to fit into the dst rectangle.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…