Hi,
This is driving me nuts...
I have two images in an image list and use a simple routine to merge them into a new image, this works but the original also gets changed and I can't see what I am doing wrong, is anyone able to help?
As well as the code above all the files are included in the zip
This is driving me nuts...
I have two images in an image list and use a simple routine to merge them into a new image, this works but the original also gets changed and I can't see what I am doing wrong, is anyone able to help?
B4X:
Sub Globals
'Declare the global variables here.
Dim a(4)
End Sub
Sub App_Start
Init
frmDraw.Show
Msgbox("New Icon added to iLPic control at position " & imagemerge(0,1)& " Why has image at position 0 changed?")
End Sub
Sub Init
'do once
imageclass1.New1
End Sub
Sub ImageMerge(BGnd,FGnd)
im1.Image=ilpic.Item(bgnd)
im2.Image=ilpic.Item(fgnd)
frmdraw.Refresh
Msgbox("images before merging")
'ilpic.Item(result)=ilpic.Item(bgnd)
ilpic.Add(ilpic.Item(bgnd))' copy the background to a new position in the image list
imagenumber=ilpic.Count-1
For w=0 To 7
For h = 0 To 7
imageclass1.Image=ilpic.Item(fgnd) ' this is the overlay
a()=imageclass1.GetPixel(w,h)
imageclass1.Image=ilpic.Item(imagenumber) ' this is the item that will be modified
If a(0)>100 Then
imageclass1.SetPixel(w+8,h+8,a(0),a(1),a(2),a(3))
End If
Next
Next
im1.Image=ilpic.Item(bgnd) ' why does this image change?
im2.Image=ilpic.Item(fgnd)
im3.image=ilpic.Item(imagenumber)
frmdraw.Refresh
Return imagenumber
End Sub
As well as the code above all the files are included in the zip
Last edited: