Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Transparent TImage ??? - VERY IMPORTANT FOR ME

brunosanbrunosan Posts: 8Member
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

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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.
  • brunosanbrunosan Posts: 8Member
    : : 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
  • zibadianzibadian Posts: 6,349Member
    : : : 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:
    [code]
    Image1.Pixels[X, Y] := Image1.Pixels[X, Y] OR (Image2.Pixels[X, Y] div 3);
    [/code]
    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.
Sign In or Register to comment.