Hi
I'm standing on my feet at the moment and need a little power from you.
I have a image, that is used as background. Then I have a image which should be shaped by a polygon as form and then inserted at a given position on the image. The Image should be saved after that. That is no gaming handling, so no sprites are usable. Images come from outside. I load the background image in an image handle. Then the same with the second image. Last would be resized like wanted. Then I make a new image as mask with the polygon lines with the same size. Then I should merge all together. That is the point where it stops at the moment for me. I don't get it working.
Have you any tipp how to do that? Or a message in this board where I find a solution? Thanks in advance.
Sigi
Last edited by MyTrial on Sat May 14, 2011 1:11 pm, edited 1 time in total.
Added:
Or how to merge the second image and the mask image to get a image where the image is visible inside the polygon and the rest of the image is transparency, so I can position it on the background?
Hi
@Demivec: No matter what images are used ...
I think I have the solution:
a) Load background image to image handle. Resize if neccessary.
b) Load second image to next image handle. Resize if neccessary.
c) Create new mask image with size like second image.
d) Make transparent background on mask image.
e) Draw filled polygon with any color on mask image like wanted.
f) DrawAlphaImage() second image on mask image with alpha = 255 at position 0,0.
g) DrawAlphaImage() mask image on background image with alpha = 255 on wanted position.
h) Save image.
If someone knows a better way, I would be happy to get that solution. Thanks.
Sigi
Hi Demivec
Thank you for that information. But I am used to write readable code and therefor I write the two steps as they are. On the other part I had some major problems by using some combined actions like that in the past. So I don't want to use them. Sorry. But thanks for the information. Maybe someone would use it.
Sigi
MyTrial wrote:Thank you for that information. But I am used to write readable code and therefor I write the two steps as they are. On the other part I had some major problems by using some combined actions like that in the past. So I don't want to use them. Sorry. But thanks for the information. Maybe someone would use it.
Well, to put the suggestion another way, the CreateImage() function has a parameter to make the image transparent when it's created. I see it as self documenting. The way you had suggested the actions would require using CreateImage(), DrawingMode(), and then Box() before you accomplished it. I agree that if the simplification causes you problems that you should avoid using it and take the longer route.
Hi Demivec
as "self documenting" you mean the transparency information for CreateImage() in the Help I think ...
You are right, the transparency include would be the better way. But my application is not time dependent, so nobody waits, because nobody knows that it could run quicker.
Have a good time. And thanks, Demivec.
Sigi