Xojo Conferences
XDCMay2019MiamiUSA

Off-Screen-Painting (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Cross-Platform GroupBox Display Bug?
Next thread: [RB List] IsCMMClick on LeftButton?


RB Database   -   tom.russell transport.alstom.com
  Off-Screen-Painting   -   Marc-Hendrik Bremer
   Re: Off-Screen-Painting   -   Joseph J. Strout
   Re: Off-Screen-Painting   -   Eirik Karlsen
   Re: Off-Screen-Painting   -   Joseph J. Strout
   Re: Off-Screen-Painting   -   Eirik Karlsen
   Re: Off-Screen-Painting   -   Joseph J. Strout
   Re: Off-Screen-Painting   -   Marc-Hendrik Bremer
   Re: Off-Screen-Painting   -   FFL
   Re: Off-Screen-Painting   -   Joseph J. Strout
   Re: Off-Screen-Painting   -   Joseph J. Strout
   Reloading extrenal picture file   -   FFL

Off-Screen-Painting
Date: 10.02.05 22:43 (Thu, 10 Feb 2005 22:43:00 +0100)
From: Marc-Hendrik Bremer
Hello,

I have some methods painting some graphics-stuff in a canvas. That works
fine but is quite slow.
Now I want to use an extra buffer as mentioned here and in the docs. I have
"Offg" (of class picture) as a property of my canvas-class and build it with
a NewPicture(x,y,0) in an early method. But if I try to pass Offg.graphics
to my painting methods, the Parameter they get is always "Nil" and I (of
course) get an exception when they try to use the graphics-methods on it.
Passing the parameter ByRef did not work either.

What am I doing wrong?

Any help would be realy nice!

Regards,

Marc-Hendrik

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

Re: Off-Screen-Painting
Date: 10.02.05 22:48 (Thu, 10 Feb 2005 15:48:38 -0600)
From: Joseph J. Strout
At 10:43 PM +0100 2/10/05, Marc-Hendrik Bremer wrote:

>I have some methods painting some graphics-stuff in a canvas. That works
>fine but is quite slow.

It shouldn't be slow unless you're doing a LOT of work, or doing
something less efficiently than necessary (or both).

>Now I want to use an extra buffer as mentioned here and in the docs. I have
>"Offg" (of class picture) as a property of my canvas-class and build it with
>a NewPicture(x,y,0) in an early method.

A bit depth of 0?

> But if I try to pass Offg.graphics to my painting methods, the
>Parameter they get is always "Nil" and I (of course) get an
>exception when they try to use the graphics-methods on it.

Right. There is no Graphics object for a picture with a bit depth of
0; such a picture con only contain vector graphics. Try 32 instead.

Best,
- Joe

Re: Off-Screen-Painting
Date: 10.02.05 23:15 (Thu, 10 Feb 2005 23:15:53 +0100)
From: Eirik Karlsen
Maybe I can contribute my 2 pennies worth.....

Play a bit with this code, it works for me:
'********************
GraphFront=newPicture(CanvasGraph.width,CanvasGraph.height,16) 'This is the
Graphs

GraphFront.graphics.ForeColor=GraphBackColor 'if you want color
GraphFront.graphics.FillRect 0,0,GraphFront.width,GraphFront.height 'fill
with color

'''''''''''''''
'your code here, i.e:
'GraphFront.graphics.drawline (GX1),(GY2),(GX2),(GY2)
'''''''''''''

CanvasGraph.graphics.DrawPicture GraphFront,0,0 'Draw modified (buffered)
picture to Graphcanvas
'**********************

Also note that there is a huge difference in speed depending on colordepth,
obviously 32bit is the slowest.
A quick test showed that at
32bit I got 41 frames/sec
8bit I got 122 frames/sec
1bit I got 583 frames/sec



Marc-Hendrik Bremer wrote:

> Hello,
>
> I have some methods painting some graphics-stuff in a canvas. That works
> fine but is quite slow.
> Now I want to use an extra buffer as mentioned here and in the docs. I have
> "Offg" (of class picture) as a property of my canvas-class and build it with
> a NewPicture(x,y,0) in an early method. But if I try to pass Offg.graphics
> to my painting methods, the Parameter they get is always "Nil" and I (of
> course) get an exception when they try to use the graphics-methods on it.
> Passing the parameter ByRef did not work either.
>
> What am I doing wrong?
>
> Any help would be realy nice!
>
> Regards,
>
> Marc-Hendrik

Re: Off-Screen-Painting
Date: 10.02.05 23:22 (Thu, 10 Feb 2005 16:22:43 -0600)
From: Joseph J. Strout
At 11:15 PM +0100 2/10/05, Eirik Karlsen wrote:

>Also note that there is a huge difference in speed depending on colordepth,
>obviously 32bit is the slowest.

That's not obvious to me. Assuming your monitor is set to 32-bit
color, then drawing a 32-bit picture can be done directly, while
anything else requires remapping of each pixel. Of course this is
offset by having more source data to push around.

>A quick test showed that at
>32bit I got 41 frames/sec
>8bit I got 122 frames/sec
>1bit I got 583 frames/sec

Try it with g.UseOldRenderer=true, and include 16-bit color in the test.

Best,
- Joe

Re: Off-Screen-Painting
Date: 10.02.05 23:32 (Thu, 10 Feb 2005 23:32:47 +0100)
From: Eirik Karlsen
I'm using a win box so OldRenderer has no effect.
Resolution is 1024x768 32bit.

A test with 16bit gave 57 frames/sec using the same 680x370 canvas.

"Joseph J. Strout" wrote:

> At 11:15 PM +0100 2/10/05, Eirik Karlsen wrote:
>
> >Also note that there is a huge difference in speed depending on colordepth,
> >obviously 32bit is the slowest.
>
> That's not obvious to me. Assuming your monitor is set to 32-bit
> color, then drawing a 32-bit picture can be done directly, while
> anything else requires remapping of each pixel. Of course this is
> offset by having more source data to push around.
>
> >A quick test showed that at
> >32bit I got 41 frames/sec
> >8bit I got 122 frames/sec
> >1bit I got 583 frames/sec
>
> Try it with g.UseOldRenderer=true, and include 16-bit color in the test.
>
> Best,
> - Joe
>
> --
> REAL World 2005 - The REALbasic User Conference
> March 23-25, 2005, Austin, Texas
> <http://www.realsoftware.com/realworld>
> _______________________________________________
>

Re: Off-Screen-Painting
Date: 10.02.05 23:48 (Thu, 10 Feb 2005 16:48:40 -0600)
From: Joseph J. Strout
At 11:32 PM +0100 2/10/05, Eirik Karlsen wrote:

>I'm using a win box so OldRenderer has no effect.
>Resolution is 1024x768 32bit.
>
>A test with 16bit gave 57 frames/sec using the same 680x370 canvas.

Ah. On the Mac, same-depth blits are often faster than lower-bit
blits even though the amount of data pushed is greater. Interesting
to know that this is not the case on Windows.

Thanks,
- Joe

Re: Off-Screen-Painting
Date: 11.02.05 08:00 (Fri, 11 Feb 2005 08:00:34 +0100)
From: Marc-Hendrik Bremer
Joseph J. Strout wrote:
> It shouldn't be slow unless you're doing a LOT of work, or doing
> something less efficiently than necessary (or both).

Well, I know, I'm drawing a lot of things which are out of the bounds of the
canvas. That's why I want to draw them only once and copy only the part in
which is visible. There are some 10000 Polygons and Group2D. If necessary I
have some ideas for opimization, but that' another story.
>
>> Now I want to use an extra buffer as mentioned here and in the docs.
>> I have "Offg" (of class picture) as a property of my canvas-class
>> and build it with a NewPicture(x,y,0) in an early method.
>
> A bit depth of 0?
>

Yes, I only need vector graphics.

>> But if I try to pass Offg.graphics to my painting methods, the
>> Parameter they get is always "Nil" and I (of course) get an
>> exception when they try to use the graphics-methods on it.
>
> Right. There is no Graphics object for a picture with a bit depth of
> 0; such a picture con only contain vector graphics. Try 32 instead.
>

Well as I only need vectors, I figured it would be waste of memory to choose
another bit depth.

I'll try another depth so - but I don't know if this will not consume to
much memory. At an resolution of approx. 6000 to 5000 Pixel and 16 bit it
will take some 60MByte, no?

Thanks, Joseph an Eirik, for your help,

Marc-Hendrik

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

Re: Off-Screen-Painting
Date: 11.02.05 09:17 (Fri, 11 Feb 2005 09:17:19 +0100)
From: FFL
Joseph J. Strout dixit, le 10/02/05 à 16:22 :

> At 11:15 PM +0100 2/10/05, Eirik Karlsen wrote:
>
> >Also note that there is a huge difference in
>speed depending on colordepth,
> >obviously 32bit is the slowest.
>
> That's not obvious to me. Assuming your
>monitor is set to 32-bit color, then drawing a
>32-bit picture can be done directly, while
>anything else requires remapping of each pixel.
>Of course this is offset by having more source
>data to push around.
>
> >A quick test showed that at
> >32bit I got 41 frames/sec
> >8bit I got 122 frames/sec
> >1bit I got 583 frames/sec
>
> Try it with g.UseOldRenderer=true, and include 16-bit color in the test.

When pictures are used for unseen offscreen
calculations, and if a smaller depth is enough,
using a smaller depth should be faster ?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

Re: Off-Screen-Painting
Date: 11.02.05 15:44 (Fri, 11 Feb 2005 08:44:30 -0600)
From: Joseph J. Strout
At 9:17 AM +0100 2/11/05, FFL wrote:

>When pictures are used for unseen offscreen calculations, and if a
>smaller depth is enough, using a smaller depth should be faster ?

Not necessarily, if the picture is going to ultimately be drawn to the screen.

Best,
- Joe

Re: Off-Screen-Painting
Date: 11.02.05 15:45 (Fri, 11 Feb 2005 08:45:22 -0600)
From: Joseph J. Strout
At 8:00 AM +0100 2/11/05, Marc-Hendrik Bremer wrote:

>>It shouldn't be slow unless you're doing a LOT of work, or doing
>>something less efficiently than necessary (or both).
>
>Well, I know, I'm drawing a lot of things which are out of the
>bounds of the canvas. That's why I want to draw them only once and
>copy only the part in which is visible.

The only way to get benefit from that is to have an actual offscreen
pixel map. (Not just a picture containing vector graphics -- that's
no different from what you're doing now.)

>I'll try another depth so - but I don't know if this will not
>consume to much memory. At an resolution of approx. 6000 to 5000
>Pixel and 16 bit it will take some 60MByte, no?

Yep.

Best,
- Joe