 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tanju ÖZGÜR Guest
|
Posted: Wed Jul 12, 2006 4:36 pm Post subject: How to overcome the problem of overlapping objects drawn wit |
|
|
hi all,
In my CAD application to select and deselect objects I use pmXor pen mode
and user defined brush color to be used as rubberpen. For the overlapping
objects rubberband is supposed to draw each object, but due to the pmXor
pen-mode (probably) the second object is directly reflecting the background.
Henceforth, as I can't change the Paint(), DrawObjecRubber, etc.. or other
algorithms in my application, how can I avoid the overlapping objects
reflecting the back-ground by making slight changes at the pen-mode or brush
style?
Best Regards, |
|
| Back to top |
|
 |
Roger Lascelles Guest
|
Posted: Wed Jul 12, 2006 5:53 pm Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
"Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote in message
news:44b4deb9$1 (AT) newsgroups (DOT) borland.com...
| Quote: | hi all,
Henceforth, as I can't change the Paint(), DrawObjecRubber, etc.. or other
algorithms in my application, how can I avoid the overlapping objects
reflecting the back-ground by making slight changes at the pen-mode or
brush |
Not sure what is your question. But I can say this:
Only the XOR mode lets you repeat a drawing operation to completely reverse
it. There are no substitutes. However, you can pick your XOR draw color
carefully.
If you draw multiple times in XOR, you can remove it all by repeating all
the drawing commands in XOR again.
If you draw a line, or shape in XOR on top of a background, the effect of
the background affects the color of the result. You can reduce this effect
if your background does not vary greatly - for example, drawing over a
series of pale, "washed out" (high white content) shapes can produce a
vivid fairly uniform XOR. I use this trick.
One solution is to go to the Graphics32 library which gives you the
abstraction of layers in your drawing, so that erasing a layer does not
erase the rest of the drawing on the other layers. With this, you can get
any effect you want - I think you finally get forced toward Graphics32 or
some other kind of offscreen bitmap management.
Roger Lascelles |
|
| Back to top |
|
 |
Tanju ÖZGÜR Guest
|
Posted: Wed Jul 12, 2006 6:29 pm Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
Hi Roger,
| Quote: | Not sure what is your question.
Sorry for my poor Eng.  |
| Quote: | Only the XOR mode lets you repeat a drawing operation to completely
reverse
it. There are no substitutes. However, you can pick your XOR draw color
carefully
|
well, I think that's the main problem that I couldn't overcome. What if the
objects are painted one on top of the other with the XOR pen-mode, if I draw
the 2 overlapping objects in my drawing with rubberpen (XOR pen mode) the
intersection area for these objects will be filled with background color,
because XOR pen-mode completely reverse it. ( Please see the attachment)
| Quote: | One solution is to go to the Graphics32 library which gives you the
abstraction of layers in your drawing, so that erasing a layer does not
erase the rest of the drawing on the other layers. With this, you can get
any effect you want - I think you finally get forced toward Graphics32 or
some other kind of offscreen bitmap management.
|
Although I didin't check the latest developments of it, I had tried to use
Graphics32 years ago when Alex Denisov has started to develop it. But I'm
afraid that it does deal with raster images rather than vector drawings. And
also for the CAD aplications performance is very slow.
P.S. I couldn't succed to send the attachments I'll upload to the
borland.public.attachments.
Best Regards,
"Roger Lascelles" <rogerlasAToptusnet.com.au>, haber iletisinde şunları
yazdı:44b4f0c0 (AT) newsgroups (DOT) borland.com...
| Quote: | "Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote in message
news:44b4deb9$1 (AT) newsgroups (DOT) borland.com...
hi all,
Henceforth, as I can't change the Paint(), DrawObjecRubber, etc.. or
other
algorithms in my application, how can I avoid the overlapping objects
reflecting the back-ground by making slight changes at the pen-mode or
brush
Not sure what is your question. But I can say this:
Only the XOR mode lets you repeat a drawing operation to completely
reverse
it. There are no substitutes. However, you can pick your XOR draw color
carefully.
If you draw multiple times in XOR, you can remove it all by repeating all
the drawing commands in XOR again.
If you draw a line, or shape in XOR on top of a background, the effect of
the background affects the color of the result. You can reduce this
effect
if your background does not vary greatly - for example, drawing over a
series of pale, "washed out" (high white content) shapes can produce a
vivid fairly uniform XOR. I use this trick.
One solution is to go to the Graphics32 library which gives you the
abstraction of layers in your drawing, so that erasing a layer does not
erase the rest of the drawing on the other layers. With this, you can get
any effect you want - I think you finally get forced toward Graphics32 or
some other kind of offscreen bitmap management.
Roger Lascelles
|
|
|
| Back to top |
|
 |
Tanju ÖZGÜR Guest
|
Posted: Wed Jul 12, 2006 6:34 pm Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
Roger please see the "borland.public.attachments" newsgroup to see the image
the subject is same as this.
"Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com>, haber iletisinde şunları
yazdı:44b4f91d$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi Roger,
Not sure what is your question.
Sorry for my poor Eng. :)
Only the XOR mode lets you repeat a drawing operation to completely
reverse
it. There are no substitutes. However, you can pick your XOR draw color
carefully
well, I think that's the main problem that I couldn't overcome. What if
the
objects are painted one on top of the other with the XOR pen-mode, if I
draw
the 2 overlapping objects in my drawing with rubberpen (XOR pen mode) the
intersection area for these objects will be filled with background color,
because XOR pen-mode completely reverse it. ( Please see the attachment)
One solution is to go to the Graphics32 library which gives you the
abstraction of layers in your drawing, so that erasing a layer does not
erase the rest of the drawing on the other layers. With this, you can
get
any effect you want - I think you finally get forced toward Graphics32 or
some other kind of offscreen bitmap management.
Although I didin't check the latest developments of it, I had tried to use
Graphics32 years ago when Alex Denisov has started to develop it. But I'm
afraid that it does deal with raster images rather than vector drawings.
And
also for the CAD aplications performance is very slow.
P.S. I couldn't succed to send the attachments I'll upload to the
borland.public.attachments.
Best Regards,
"Roger Lascelles" <rogerlasAToptusnet.com.au>, haber iletisinde şunları
yazdı:44b4f0c0 (AT) newsgroups (DOT) borland.com...
"Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote in message
news:44b4deb9$1 (AT) newsgroups (DOT) borland.com...
hi all,
Henceforth, as I can't change the Paint(), DrawObjecRubber, etc.. or
other
algorithms in my application, how can I avoid the overlapping objects
reflecting the back-ground by making slight changes at the pen-mode or
brush
Not sure what is your question. But I can say this:
Only the XOR mode lets you repeat a drawing operation to completely
reverse
it. There are no substitutes. However, you can pick your XOR draw color
carefully.
If you draw multiple times in XOR, you can remove it all by repeating all
the drawing commands in XOR again.
If you draw a line, or shape in XOR on top of a background, the effect of
the background affects the color of the result. You can reduce this
effect
if your background does not vary greatly - for example, drawing over a
series of pale, "washed out" (high white content) shapes can produce a
vivid fairly uniform XOR. I use this trick.
One solution is to go to the Graphics32 library which gives you the
abstraction of layers in your drawing, so that erasing a layer does not
erase the rest of the drawing on the other layers. With this, you can
get
any effect you want - I think you finally get forced toward Graphics32 or
some other kind of offscreen bitmap management.
Roger Lascelles
|
|
|
| Back to top |
|
 |
somebody Guest
|
Posted: Wed Jul 12, 2006 10:18 pm Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
"Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote
| Quote: | In my CAD application to select and deselect objects I use pmXor pen mode
|
Easy answer to all question of the same sort: Don't ever use XOR drawing.
It's a remnant from the bad old days of slow graphics hardware and limited
color depth (indexed colors). If you need performance, use some sort of
spatial partitioning and back buffers. Headaches will instantly go away and
your application will be scalable instead of constantly hitting brick walls
when you need to update functionality. |
|
| Back to top |
|
 |
Tanju ÖZGÜR Guest
|
Posted: Wed Jul 12, 2006 10:37 pm Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
Actually I'm using the double-buffer to avoid flickering (performance is
quite satisfactory) and as I said on my previous posts it's not easy to
change all the framework of application because I've done a lot of work so
far. Isn't there other ways ( with pen-modes ).
"somebody" <A>, iletide şunu yazdı news:44b52ebd (AT) newsgroups (DOT) borland.com...
| Quote: | "Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote
In my CAD application to select and deselect objects I use pmXor pen
mode
Easy answer to all question of the same sort: Don't ever use XOR drawing.
It's a remnant from the bad old days of slow graphics hardware and limited
color depth (indexed colors). If you need performance, use some sort of
spatial partitioning and back buffers. Headaches will instantly go away
and
your application will be scalable instead of constantly hitting brick
walls
when you need to update functionality.
|
|
|
| Back to top |
|
 |
Roger Lascelles Guest
|
Posted: Thu Jul 13, 2006 4:15 am Post subject: Re: How to overcome the problem of overlapping objects drawn |
|
|
"Tanju ÖZGÜR" <tanjuozgur (AT) yahoo (DOT) com> wrote in message
news:44b4fa82$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Roger please see the "borland.public.attachments" newsgroup to see the
image > the subject is same as this. |
Nice clear drawing!
I am sorry, but the image cannot be made better with XOR.
CAD programs don't use XOR, instead they keep track of what needs to be
redrawn. For example, you can draw a line in selected color, then redraw it
in unselected color when you want to turn off the selection.
If your code is organised so you can paint each object separately, then you
can paint any object in any color.
CAD programs keep track of what needs to be redrawn, often as rectangular
areas. All objects which overlap the redraw area are redrawn.
I have used a compromise possible between XOR and COPY pens : draw the
whole image in COPY pen, and use XOR for objects which are being dragged.
Users can accept the unusual colors for dragging. When the drag is
finished, redraw the source rectangle and all objects overlapping it, so
that the moved item "disappears". Then redraw the moved object in its
normal colors.
People have posted to this newsgroup who mention using Graphics32 for line
drawing, so I think you need to look at it again. Apparently you can use
standard GDI drawing functions or special drawing functions with Graphics32,
so you can use your existing painting code.
You have done a lot of work to bring your CAD program this far! But there
is more work to come!
Roger Lascelles |
|
| Back to top |
|
 |
|
|
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 You cannot vote in polls in this forum
|
|