Solved

Tranparent Color

Posted on 2000-02-20
7
179 Views
Last Modified: 2010-04-04
Hi Guy's,

How can I create a transparent color, so that if I have say a white
Picture in an Image I can render the new color over to make it appear blue or red or whatever color I require.

Asw
0
Comment
Question by:Asw
7 Comments
 
LVL 17

Expert Comment

by:inthe
Comment Utility
Hi
maybe setting the brush style to bsclear; will do it..
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 200 total points
Comment Utility
hi

http://www.undu.com/DN970101/00000022.htm

you can also use the SetBkMode, but I'm not sure if this works for your purpose.

procedure TForm1.Button1Click(Sender: TObject);
var
  OldBkMode : integer;
begin
  with Image1.Canvas do begin
    Brush.Color := clRed;
    FillRect(Rect(0, 0, 100, 100));
    Brush.Color := clBlue;
    TextOut(10, 20, 'Not Transparent!');
    OldBkMode := SetBkMode(Handle, TRANSPARENT);
    TextOut(10, 50, 'Transparent!');
    Flood
    SetBkMode(Handle, OldBkMode);
  end;
end;

Zif.
0
 
LVL 1

Author Comment

by:Asw
Comment Utility
Hi Inthe, ZifNab,

Inthe bsClear just makes the canvas clear, not Transparent.

Zif your procedure works for text, but still not Transparent.

What I am doing is drawing a picture on the form canvas.

Then I want to color over the top of the form canvas and change the color of the picture.

Just like laying some transparent colored film over the top of the picture.

Andy
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 9

Expert Comment

by:ITugay
Comment Utility
If you draw picture stored in TBitmap, then look at property:

property TransparentColor: TColor;
Determines which color of the bitmap is to be transparent when the bitmap is drawn.

property Transparent:
TTransparentMode; Determines whether the TransparentColor property's value is automatically calculated or stored with the bitmap object.

When TransparentMode is set to tmAuto, the TransparentColor property returns the color of the bottom-leftmost pixel of the bitmap image.  When TransparentMode is set to tmFixed, the TransparentColor property refers to the color stored in the bitmap object.

Exactly from Delphi help;)

Cheers,
Igor.




0
 
LVL 3

Expert Comment

by:gandalf_the_white
Comment Utility
listening...
0
 
LVL 1

Author Comment

by:Asw
Comment Utility
Hi Zif,

The link you gave me  http://www.undu.com/DN970101/00000022.htm was just what I was looking for.

Many Thanks

Andy
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
I thought so :-), but wasn't fully sure if this was what you wanted.

Glad you can go further with coding.

see you, Zif.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video discusses moving either the default database or any database to a new volume.
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.

771 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

7 Experts available now in Live!

Get 1:1 Help Now