Solved

Tranparent Color

Posted on 2000-02-20
7
183 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
[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
7 Comments
 
LVL 17

Expert Comment

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

Accepted Solution

by:
ZifNab earned 200 total points
ID: 2539517
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
ID: 2539611
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
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!

 
LVL 9

Expert Comment

by:ITugay
ID: 2539680
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
ID: 2542353
listening...
0
 
LVL 1

Author Comment

by:Asw
ID: 2544165
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
ID: 2544182
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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