?
Solved

Drawing using XOR mode

Posted on 2003-12-04
2
Medium Priority
?
1,615 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 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