Transparent TImage ??? - VERY IMPORTANT FOR ME - Programmers Heaven

Howdy, Stranger!

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

Categories

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.