Re: Deprecated "Graphics" dropped

pidog <[email protected]> Sat, 22 Dec 2018 20:20:12 +0000 (UTC)
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
------------=_1545510012-22734-1015
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable

If you need an easy way to allow your current code to still work, you could=
 use canvas.backdrop as a stand-in for the old canvas.graphics

Add a module to your project and add a global method:

Public Function graphics(extends c As Canvas) as Graphics
 If c.Backdrop=3DNil Then c.Backdrop=3DNew Picture(c.Width,c.Height)
 c.Invalidate
 Return c.Backdrop.Graphics
End Function

This works in 2018r4 but I wouldn't guarantee it in the future.

You can also add checks for the width and height matching and maybe create =
a new picture and draw the current one into it and then swap the new one in=
 if the size changes. This is just the simplest.

Should at least get you going until you can get away from the old way of do=
ing it.

-Jim=

------------=_1545510012-22734-1015
Content-Type: text/html; charset="us-ascii"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

<html><body>
<p>If you need an easy way to allow your current code to still work, you co=
uld use canvas.backdrop as a stand-in for the old canvas.graphics</p>
<p>Add a module to your project and add a global method:</p>
<p>Public Function graphics(extends c As Canvas) as Graphics</p>
<pre>If c.Backdrop=3DNil Then c.Backdrop=3DNew Picture(c.Width,c.Height)
c.Invalidate
Return c.Backdrop.Graphics</pre>
<p>End Function</p>
<p>This works in 2018r4 but I wouldn't guarantee it in the future.</p>
<p>You can also add checks for the width and height matching and maybe crea=
te a new picture and draw the current one into it and then swap the new one=
 in if the size changes. This is just the simplest.</p>
<p>Should at least get you going until you can get away from the old way of=
 doing it.</p>
<p>-Jim</p>

<img src=3D"https://u9098352.ct.sendgrid.net/wf/open?upn=3DW5IIOHYh8Ix-2Flm=
NrgtTomW8ATk7pXvOSwl3ev5ZofJe-2BbffZRIgM-2FoSoMVn9Cz1H4lMCKxteom-2B0wG7FKuy=
cf-2B65vXiVAjuF5OnAGul6paWpzd-2BqaSDZRSI8-2FxBQBF8e9LIY0T5jmhHSNTuer-2BZDCv=
3k26y-2BcKMZp7oJst7vKWL9rLs1ka54AI-2BGM9OChRCny9YAz055raGGPCGhmnauRWGa9OvFg=
zRM9FGHv5en8O4-3D" alt=3D"" width=3D"1" height=3D"1" border=3D"0" style=3D"=
height:1px !important;width:1px !important;border-width:0 !important;margin=
-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;marg=
in-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;p=
adding-right:0 !important;padding-left:0 !important;"/>
</body></html>

------------=_1545510012-22734-1015--