How to combine two images
Posted
#1
(In Topic #1212)
Regular

How can I merge them so that that are both shown in a new image?
Posted
Guru

should they be next to each other or one on top of the other.
do they have transparent backgrounds?
Can you not just use Paint.classs to paint one image on the other?
Code (gambas)
- Paint.Begin(hSquarePic)
- Paint.DrawPicture(hRoundPic, 0, 0, Paint.W, Paint.H)
- Paint.End
Posted
Regular

For x = 0 To hImageSquare.W - 1
For y = 0 To hImageSquare.H - 1
If hImageSquare[x, y] <> -16777216 Then hImageNew[x, y] = hImageSquare[x, y]
If hImageCircle[x, y] <> -16777216 Then hImageNew[x, y] = hImageCircle[x, y]
Next
Next
The value 16777216 is the colour of the background. 16777215 = White
Posted
Regular

Posted
Guru

does it have to be an image that you read/overlay?
you could just draw it
Code (gambas)
- Paint.Begin(p)
- ' draw a blue square with 10 px margin
- Paint.FillRect(10, 10, 280, 280, Color.blue)
- ' draw a green circle, centered and radius 10px less than image size
- Paint.Background = Color.green
- Paint.Arc(150, 150, 140)
- Paint.Fill()
- Paint.End
Posted
Regular

works just fine.
Thanks again
1 guest and 0 members have just viewed this.


