[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

wansch

12/3/2004 11:03:00 AM

Hello,

I try to create a retained mode graphics system where you can select
primitives and drag them around. So I created a selection frame from a
rectangel which I draw when the left mouse button is down and moving. When I
move over the canvas surface with the mouse always the hole rectangle region
of the selection frame is invalidated. That doesn't seem to be very
performant , all primitives in the region are redrawn.
My question:
What is the right concept for drawing a selection frame?
4 Answers

monroe

12/3/2004 4:56:00 PM

0

Well, I'm absolutely no expert, I've been struggling with GDI+ for a
fairly short time, but I think there's some approaches you might want
to check. The first of them is probably automatic double-buffering.
Check Bob Powell's site for that. If flickering is not a problem and
only performance is, try Invalidating only the necessary part of the
"canvas"...a very simple way to accomplish this would be the
following.

Dim r As New Rectangle (primitive.X-10, primitive.Y-10,
primitive.Width+20, primitive.Height+20)
Me.Invalidate (r)

But probably someone else will have a better answer in no time :)


wansch <wansch@discussions.microsoft.com> wrote in message news:<491485D2-C829-4AF2-83DE-1864D38C53B6@microsoft.com>...
> Hello,
>
> I try to create a retained mode graphics system where you can select
> primitives and drag them around. So I created a selection frame from a
> rectangel which I draw when the left mouse button is down and moving. When I
> move over the canvas surface with the mouse always the hole rectangle region
> of the selection frame is invalidated. That doesn't seem to be very
> performant , all primitives in the region are redrawn.
> My question:
> What is the right concept for drawing a selection frame?

wansch

12/5/2004 4:21:00 PM

0

Hi,

flickering is no problem, the problem is that I invalidate a region and all
primitives in this region are then redrawn. So it looks like the more
primitives the selection frame contains the redrawn takes longer. When I look
at other applications like MS-Excel such a frame opened over hundreds of
objects takes quite small amount of cpu time, if the number of objects in the
frame increases the amount of cpu time doesn't seem to rise. In my region
invalidation scenario I need about 60-80 percent cpu time wich increases fast
when the frame contains more objects (primitives).
So my question must be:
Is there another technique to draw the frame as with invalidating a region?


"Samuel Caparros" wrote:

> Well, I'm absolutely no expert, I've been struggling with GDI+ for a
> fairly short time, but I think there's some approaches you might want
> to check. The first of them is probably automatic double-buffering.
> Check Bob Powell's site for that. If flickering is not a problem and
> only performance is, try Invalidating only the necessary part of the
> "canvas"...a very simple way to accomplish this would be the
> following.
>
> Dim r As New Rectangle (primitive.X-10, primitive.Y-10,
> primitive.Width+20, primitive.Height+20)
> Me.Invalidate (r)
>
> But probably someone else will have a better answer in no time :)
>
>
> wansch <wansch@discussions.microsoft.com> wrote in message news:<491485D2-C829-4AF2-83DE-1864D38C53B6@microsoft.com>...
> > Hello,
> >
> > I try to create a retained mode graphics system where you can select
> > primitives and drag them around. So I created a selection frame from a
> > rectangel which I draw when the left mouse button is down and moving. When I
> > move over the canvas surface with the mouse always the hole rectangle region
> > of the selection frame is invalidated. That doesn't seem to be very
> > performant , all primitives in the region are redrawn.
> > My question:
> > What is the right concept for drawing a selection frame?
>

nick

12/5/2004 11:17:00 PM

0

This is the best article I have found on the subject of drawing primitives.

http://msdn.microsoft.com/library/?url=/library/en-us/dndotnet/html/designs...

"wansch" <wansch@discussions.microsoft.com> wrote in message
news:AE7E06B5-E6EC-485E-A8D7-883F0267D43A@microsoft.com...
> Hi,
>
> flickering is no problem, the problem is that I invalidate a region and
> all
> primitives in this region are then redrawn. So it looks like the more
> primitives the selection frame contains the redrawn takes longer. When I
> look
> at other applications like MS-Excel such a frame opened over hundreds of
> objects takes quite small amount of cpu time, if the number of objects in
> the
> frame increases the amount of cpu time doesn't seem to rise. In my region
> invalidation scenario I need about 60-80 percent cpu time wich increases
> fast
> when the frame contains more objects (primitives).
> So my question must be:
> Is there another technique to draw the frame as with invalidating a
> region?
>
>
> "Samuel Caparros" wrote:
>
>> Well, I'm absolutely no expert, I've been struggling with GDI+ for a
>> fairly short time, but I think there's some approaches you might want
>> to check. The first of them is probably automatic double-buffering.
>> Check Bob Powell's site for that. If flickering is not a problem and
>> only performance is, try Invalidating only the necessary part of the
>> "canvas"...a very simple way to accomplish this would be the
>> following.
>>
>> Dim r As New Rectangle (primitive.X-10, primitive.Y-10,
>> primitive.Width+20, primitive.Height+20)
>> Me.Invalidate (r)
>>
>> But probably someone else will have a better answer in no time :)
>>
>>
>> wansch <wansch@discussions.microsoft.com> wrote in message
>> news:<491485D2-C829-4AF2-83DE-1864D38C53B6@microsoft.com>...
>> > Hello,
>> >
>> > I try to create a retained mode graphics system where you can select
>> > primitives and drag them around. So I created a selection frame from a
>> > rectangel which I draw when the left mouse button is down and moving.
>> > When I
>> > move over the canvas surface with the mouse always the hole rectangle
>> > region
>> > of the selection frame is invalidated. That doesn't seem to be very
>> > performant , all primitives in the region are redrawn.
>> > My question:
>> > What is the right concept for drawing a selection frame?
>>


wansch

12/6/2004 9:13:00 AM

0

Hi nick,

I think the performance of this example is realy bad.

"nick" wrote:

> This is the best article I have found on the subject of drawing primitives.
>
> http://msdn.microsoft.com/library/?url=/library/en-us/dndotnet/html/designs...
>
> "wansch" <wansch@discussions.microsoft.com> wrote in message
> news:AE7E06B5-E6EC-485E-A8D7-883F0267D43A@microsoft.com...
> > Hi,
> >
> > flickering is no problem, the problem is that I invalidate a region and
> > all
> > primitives in this region are then redrawn. So it looks like the more
> > primitives the selection frame contains the redrawn takes longer. When I
> > look
> > at other applications like MS-Excel such a frame opened over hundreds of
> > objects takes quite small amount of cpu time, if the number of objects in
> > the
> > frame increases the amount of cpu time doesn't seem to rise. In my region
> > invalidation scenario I need about 60-80 percent cpu time wich increases
> > fast
> > when the frame contains more objects (primitives).
> > So my question must be:
> > Is there another technique to draw the frame as with invalidating a
> > region?
> >
> >
> > "Samuel Caparros" wrote:
> >
> >> Well, I'm absolutely no expert, I've been struggling with GDI+ for a
> >> fairly short time, but I think there's some approaches you might want
> >> to check. The first of them is probably automatic double-buffering.
> >> Check Bob Powell's site for that. If flickering is not a problem and
> >> only performance is, try Invalidating only the necessary part of the
> >> "canvas"...a very simple way to accomplish this would be the
> >> following.
> >>
> >> Dim r As New Rectangle (primitive.X-10, primitive.Y-10,
> >> primitive.Width+20, primitive.Height+20)
> >> Me.Invalidate (r)
> >>
> >> But probably someone else will have a better answer in no time :)
> >>
> >>
> >> wansch <wansch@discussions.microsoft.com> wrote in message
> >> news:<491485D2-C829-4AF2-83DE-1864D38C53B6@microsoft.com>...
> >> > Hello,
> >> >
> >> > I try to create a retained mode graphics system where you can select
> >> > primitives and drag them around. So I created a selection frame from a
> >> > rectangel which I draw when the left mouse button is down and moving.
> >> > When I
> >> > move over the canvas surface with the mouse always the hole rectangle
> >> > region
> >> > of the selection frame is invalidated. That doesn't seem to be very
> >> > performant , all primitives in the region are redrawn.
> >> > My question:
> >> > What is the right concept for drawing a selection frame?
> >>
>
>
>