[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Drawing using XOR mode

Posted on 2003-12-04
2
Medium Priority
?
1,659 Views
Last Modified: 2008-03-10
How can I draw XOR'ed line inside a bitmap ?

I load a .bmp (or .jpg) file into a TImage object like this :

   Image1.LoadFromFile(Filename);

Then, I want to draw a XOR'ed rectangle in that Image1. I tried like this :

   with Image1.Canvas do
   begin
      MoveTo(5, 5);
      Pen.Mode := pmXOR;
      Pen.Style := psSolid;
      Pen.Color := clBlack;
      LineTo(100,5);
      LineTo(100,200);
      LineTo(5,200);
      LineTo(5,5);
   end;

But I dont see anything. What should I add into the code ?

I need XOR'ed mode, because if I draw the second time, the rectangle will be gone (back to the original Image1).

Please help.
0
Comment
Question by:nova2002
2 Comments
 
LVL 1

Accepted Solution

by:
roknjohn earned 140 total points
ID: 9875521
try using a color other than black
0
 
LVL 2

Expert Comment

by:odissey1
ID: 9876934
Hi nova2002,

use  Pen.Mode := pmNOT;
it will work with clBlack also. With Pen.Color := clBlack (r=0, g=0, b=0) there are no bytes to XOR.

regards,
odissey1
 
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question