Solved

Drawing using XOR mode

Posted on 2003-12-04
2
1,552 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 35 total points
Comment Utility
try using a color other than black
0
 
LVL 2

Expert Comment

by:odissey1
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now