BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pen Penmode Crossing Lines

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Markus Gronotte
Guest





PostPosted: Tue Aug 23, 2005 10:28 am    Post subject: Pen Penmode Crossing Lines Reply with quote



Image1.Canvas.Pen.Color := clBlack;
//Image1.Canvas.Pen.Mode := pmBlack;
//Image1.Canvas.Pen.Mode := pmCopy;
Image1.Canvas.MoveTo(xpaintpos-1,255-(oldvalue));
Image1.Canvas.LineTo(xpaintpos,255-(value));
oldvalue := value;

Hi,

In the Code shown at the Top I want to paint black Lines.
If one black Line crosses another black Line,
there is white color again. How do I avoid
white Pixels being created again?

I have tried several Penmodes but not anyone
seems to solve my Problem.

Can somebody help me?

Yours,

Markus



Hi,

In dem Code oben möchte ich schwarze Linien malen.
Wenn eine schwarze Linie eine andere schwarze
Linie überscheidet, kommt an der Überschneidung wieder weiß.
Wie änder ich den Pen so, dass zwei sich überdeckende
schwarze Linien auch schwarz bleiben?

Ich habs mit fast alles Penmodes probiert, aber daran
scheint es nicht zu liegen. Hab glaub ich grad nur
nen Brett vorm Kopf. Für Entfernung Dieses wäre ich
dankbar.

lg,

Markus

Back to top
Ivan Sivak Jr.
Guest





PostPosted: Thu Aug 25, 2005 9:06 am    Post subject: Re: Pen Penmode Crossing Lines Reply with quote




Quote:
If one black Line crosses another black Line,
there is white color again. How do I avoid
white Pixels being created again?

hi,
I've tried this , but have no white color ... :
image1.Canvas.Pen.Width := 3;
image1.Canvas.MoveTo(50,50);
image1.Canvas.LineTo(150,100);

image1.Canvas.MoveTo(200,50);
image1.Canvas.LineTo(50,90);

you probably mean white color at intersect point of these lines...
try to set no pen modes and styles...keep it default...maybe it can help..



Back to top
Gordon Whittam
Guest





PostPosted: Thu Aug 25, 2005 10:05 am    Post subject: Re: Pen Penmode Crossing Lines Reply with quote



In article <430afa33$1 (AT) newsgroups (DOT) borland.com>, Markus Gronotte
wrote:
Quote:
In the Code shown at the Top I want to paint black Lines.
If one black Line crosses another black Line,
there is white color again. How do I avoid
white Pixels being created again?

I have tried several Penmodes but not anyone


Image1.Canvas.Pen.Mode := pmNotXor; //erases the previous line
Image1.Canvas.MoveTo(xpaintpos-1,255-(oldvalue));
Image1.Canvas.Pen.Mode := pmCopy; //should draw new line in right
color.
Image1.Canvas.LineTo(xpaintpos,255-(value));

Gordon
--
MGCSoft Graphical and equation editors
http://www.mgcsoft.com/


Back to top
Ivan Sivak Jr.
Guest





PostPosted: Thu Aug 25, 2005 10:46 am    Post subject: Re: Pen Penmode Crossing Lines Reply with quote

hmm...I've tried it , but I see no white point at intersect point...
MoveTo+LineTo makes One line...

Quote:
Image1.Canvas.Pen.Mode := pmNotXor; //erases the previous line
Image1.Canvas.MoveTo(xpaintpos-1,255-(oldvalue));
Image1.Canvas.Pen.Mode := pmCopy; //should draw new line in right
color.
Image1.Canvas.LineTo(xpaintpos,255-(value));



Back to top
Jens Gruschel
Guest





PostPosted: Thu Aug 25, 2005 11:25 am    Post subject: Re: Pen Penmode Crossing Lines Reply with quote

Quote:
Image1.Canvas.Pen.Mode := pmNotXor; //erases the previous line

Although I didn't try your code, pmNotXor makes me suspicious. If you
are combine two lines with xor, of course the intersection is inverted,
because applying the same value with xor two times restores the original
value. It's hard to find a workaround, because you have to make sure the
intersection is only drawn once (or any odd number of times). Different
solutions come to my mind, all of them not very perfect:

1) if you know the intersection coordinates, you can invert it after
drawing the lines. But I think such details of the GDI line drawing
algorithmn are not documented and might also depend on the graphics
driver (except for horizontal and vertical lines). Another difficulty is
that the intersection might be more than a single pixel, at least if
your lines are not orthogonal.

2) draw your lines to a temporary bitmap using a "normal" mode, and
apply this bitmap to your canvas using whatever mode you like. Of course
this probably does slow down things very much.

3) Instead of two lines crossing each other, draw four lines (each "arm"
of the cross separately). Make sure only one of them covers the "center".

Jens

--
Jens Gruschel
http://www.pegtop.net

Back to top
Gordon Whittam
Guest





PostPosted: Thu Aug 25, 2005 11:28 am    Post subject: Re: Pen Penmode Crossing Lines Reply with quote

In article <430da9dd (AT) newsgroups (DOT) borland.com>, Jens Gruschel wrote:
Quote:
It's hard to find a workaround, because you have to make sure the
intersection is only drawn once (or any odd number of times). Different
solutions come to my mind, all of them not very perfect:


What I do is to use pmNotXor during a mouse move (or key move depending on
how you're drawing), then redraw it in MouseUp using pmCopy.

Gordon
--
MGCSoft Graphical and equation editors
http://www.mgcsoft.com/


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.