Solved

Tranparent Color

Posted on 2000-02-20
7
181 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
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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 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