Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tranparent Color

Posted on 2000-02-20
7
Medium Priority
?
186 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 800 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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