I didnt do all the fancy stuff with registry keys and changing directory, although this probably is the best way to go if you are going to make lots of them...
I store images into arrays (eg dim picdata(x,y)) then read the colour data into them for each pixel
this is what i did, not perfect coding but it worked...
the ExtractBlue(rgb) , ExtractRed(rgb) , ExtractGreen(rgb) and makergb(rgb) functions were from the archive, i have forgotten who wrote them or the post, sorry....
you might make sense of it...i then selected all the debuglog and copy pasted it into a bb file as a collection of data staements...
I store images into arrays (eg dim picdata(x,y)) then read the colour data into them for each pixel
this is what i did, not perfect coding but it worked...
Graphics 800,600 Global butt1=LoadAnimImage("bug_butterfly01.png",32,32,0,20) Global butterfly Dim imagefr(20,31,31) For i=0 To 19 SetBuffer ImageBuffer(butt1,i) For x=0 To 31 For y=0 To 31 If y=0 Or y=16 li$="Data " EndIf GetColor x,y rgb=MakeRGB(ColorRed(),ColorGreen(),ColorBlue()) imagefr(i,x,y)=rgb If y=15 Or y=31 li$=li$+Str(rgb) DebugLog li$ Else li$=li$+Str(rgb)+"," EndIf Next Next Next makebutterfly() i=0 SetBuffer BackBuffer() Repeat Cls DrawImage butterfly,100,100,i If KeyHit(208) Then i=i+1 If KeyHit(200) Then i=i-1 If i>19 Then i=0 If i<0 Then i=19 Color 250,180,0 Text 200,200,i Flip Until KeyHit(1) End Function makebutterfly() butterfly=CreateImage (32,32,20) For i=0 To 19 SetBuffer ImageBuffer(butterfly,i) For x=0 To 31 For y=0 To 31 rgb=imagefr(i,x,y) Color ExtractRed(rgb),ExtractGreen(rgb),ExtractBlue(rgb) Plot x,y Next Next Next SetBuffer BackBuffer() End Function Function MakeRGB(r,g,b) r=r Shl 16 ; Move red component two bytes to the left g=g Shl 8 ; Move green component one byte to the left result=r+g+b ; Add them up Return result ; And send the result right back at ya' End Function Function ExtractRed(rgb) result = rgb And 16711680 ; 00FF0000 in Hex. Anding with this eliminates all non-red values. result=result Shr 16 ; Move red component two bytes to the right Return result ; And send the result right back at ya' End Function Function ExtractGreen(rgb) result = rgb And 65280 ; 0000FF00 in Hex. Anding with this eliminates all non-green values. result=result Shr 8 ; Move green component one byte to the right Return result ; And send the result right back at ya' End Function Function ExtractBlue(rgb) result = rgb And 255 ; 000000FF in Hex. Andin with this eliminates all non-blue values. Return result ; And send the result right back at ya' End Function
the ExtractBlue(rgb) , ExtractRed(rgb) , ExtractGreen(rgb) and makergb(rgb) functions were from the archive, i have forgotten who wrote them or the post, sorry....
you might make sense of it...i then selected all the debuglog and copy pasted it into a bb file as a collection of data staements...