Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Dec 10, 2018 6:48 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:06 am 
Offline

Joined: Fri Feb 12, 2010 1:32 pm
Posts: 228
Location: Switzerland
Is it me doing something wrong or is this a bug? The following code does not paint anything in a WebCanvas...

dim p as new picture(50, 50, 32)

p.graphics.ForeColor = &c0013FF00
p.graphics.FillRect 0,0,p.Width,p.Height

g.DrawPicture p, 0, 0


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:14 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
That code is going to be much slower than necessary for absolutely no reason. Draw directly to "g", don't try to buffer it yourself.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:17 am 
Offline

Joined: Fri Feb 12, 2010 1:32 pm
Posts: 228
Location: Switzerland
This is just an example piece of code - I actually do the drawing in methods (called within the paint event) and then return a picture which I'd like to draw to the canvas.

Would you rather recommend to pass the graphics object (or portions of it) to these methods?


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:34 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
Yes. When you use a picture, the framework must send a bitmap. When you draw direct to graphics, we send client-side drawing commands. It is way faster.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:36 am 
Offline

Joined: Fri Feb 12, 2010 1:32 pm
Posts: 228
Location: Switzerland
Okay, cool. There's no clip function atm for the WebCanvas. Any plans to implement that - or an easy way to do it myself?


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Mon Dec 24, 2012 8:55 am 
Offline
Site Admin
User avatar

Joined: Tue May 06, 2008 1:07 pm
Posts: 1464
Location: NotEvenOnTheMap, CT
Honestly, not being the engineer behind it, I don't know. I know what we can support is limited entirely by what the browser canvas can support.

_________________
Thom McGrath - @tekcor
Web Framework Architect, Real Software, Inc.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Wed Dec 26, 2012 11:33 am 
Offline
User avatar

Joined: Mon Nov 29, 2010 7:01 pm
Posts: 446
I too have been having tons of problems with the webCanvas drawing. I'm thinking my problems have also been due to the fact that I buffer everything. (I ported all my code from my desktop version where buffering is necessary on Windows)

Let's say I want to make a game and have animations on the webCanvas. Would the best practice then be to send a sprite sheet over to the client to be cashed and then use the webCanvas to draw it? Would this work well?


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Wed Jan 02, 2013 11:17 am 
Offline
Real Software Engineer

Joined: Tue Jul 14, 2009 4:33 pm
Posts: 146
Location: Raleigh, NC
alexvs wrote:
Okay, cool. There's no clip function atm for the WebCanvas. Any plans to implement that - or an easy way to do it myself?


I'd file a feature request.

_________________
Greg O'Lone
Software Engineer
Real Software


Top
 Profile  
Reply with quote  
 Post subject: Re: WebCanvas.Graphics.Drawpicture not working
PostPosted: Sat Jan 05, 2013 3:37 pm 
Offline
Real Software Engineer

Joined: Tue Jul 14, 2009 4:33 pm
Posts: 146
Location: Raleigh, NC
neonash,

There's currently no way to reference images in a spritesheet from within WebCanvas. As for creating a game with animations, I would suggest using the WebSDK and making your game mostly client-side using javascript. Otherwise each event will have to be sent to the server and you'll probably find it a little slow.

_________________
Greg O'Lone
Software Engineer
Real Software


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group