Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Transparent TImage ??? - VERY IMPORTANT FOR ME Posted by brunosan on 11 May 2004 at 5:54 PM
I joined two images in one TImage component with the properities Draw and StrechDraw, but I need that the second image to be transparent with the background of the first image.

Thanks,

Bruno
Report
Re: Transparent TImage ??? - VERY IMPORTANT FOR ME Posted by zibadian on 11 May 2004 at 9:05 PM
: I joined two images in one TImage component with the properities Draw and StrechDraw, but I need that the second image to be transparent with the background of the first image.
:
: Thanks,
:
: Bruno
:
Try to make the colors less intense (MOD operator) and then add those values to the first image (AND operator). This needs to be done on a pixel for pixel basis, since Delphi lacks statements, which can do that for you.
Report
Re: Transparent TImage ??? - VERY IMPORTANT FOR ME Posted by brunosan on 11 May 2004 at 9:28 PM
: : I joined two images in one TImage component with the properities Draw and StrechDraw, but I need that the second image to be transparent with the background of the first image.
: :
: : Thanks,
: :
: : Bruno
: :
: Try to make the colors less intense (MOD operator) and then add those values to the first image (AND operator). This needs to be done on a pixel for pixel basis, since Delphi lacks statements, which can do that for you.
:

Thanks for the help, but I can`t understant like this. If you could write some code I will be very gratefully.

Thanks anyway
Report
Re: Transparent TImage ??? - VERY IMPORTANT FOR ME Posted by zibadian on 11 May 2004 at 10:49 PM
: : : I joined two images in one TImage component with the properities Draw and StrechDraw, but I need that the second image to be transparent with the background of the first image.
: : :
: : : Thanks,
: : :
: : : Bruno
: : :
: : Try to make the colors less intense (MOD operator) and then add those values to the first image (AND operator). This needs to be done on a pixel for pixel basis, since Delphi lacks statements, which can do that for you.
: :
:
: Thanks for the help, but I can`t understant like this. If you could write some code I will be very gratefully.
:
: Thanks anyway
:
Here's an sample pseudo-code based on a single pixel:
  Image1.Pixels[X, Y] := Image1.Pixels[X, Y] OR (Image2.Pixels[X, Y] div 3);

It reduces the intensity of the Image2 pixel by 3 and then adds those values to the Image1 pixel. It's untested and it might not work as well as you planned. I made a mistake in the initial answer, since reducing the intensity requires the DIV operator and adding uses OR. In this case the color white ($FFFFFF) becomes gray ($555555). You might wish to fool around with the constant 3 to get the best results. It might also be necessary to transform the Image2 into a grayscale image instead of a colored one. I've left out several intermediate objects between the Image and the Pixels.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.