ça marche tres bien ...sauf pour la transparence que je ne sais pas comment trouver dans une Image vu que Drawingbuffer ne marche pas avec ImageOutput() et que point(x,y) ne retourne que la couleur

Si quelqu'un a une idée...car là ça fait plusieur jour que je cherche en vain sur tout les forums ...
Voici le code qui me sert pour transformer une image en .ico
Code : Tout sélectionner
Procedure convert2ico(image.l)
ResizeImage(image,16,16)
Debug ImageDepth(image)
hauteur=ImageHeight(image)
largeur=ImageWidth(image)
;saveicon(filename$,hauteur,largeur, ColorKey)
buffer=AllocateMemory(10000)
If buffer
;-------------------------------ICONDIR structure
offset=poke(buffer,offset,0,1) ;reserved must be 0 (WORD)0
offset=poke(buffer,offset,1,1) ;ressource type icon=1 (WORD)2
offset=poke(buffer,offset,1,1) ;how many images 1 (WORD)4
;-------------------------------ICONDIR ENTRY
offset=poke(buffer,offset,largeur,0) ;width in pixel of the picture (BYTE)6
offset=poke(buffer,offset,hauteur,0) ;height in pixel of the picture (BYTE)7
offset=poke(buffer,offset,0,0) ;#color in image 0 if >8bpp (BYTE)8
offset=poke(buffer,offset,0,0) ;reserved must be 0 (BYTE)9
offset=poke(buffer,offset,1,1) ;color planes (WORD)10
offset=poke(buffer,offset,32,1) ;bit per pixel (WORD)12
bytecount=((largeur*hauteur)*4);x,y*4 bytes
offset=poke(buffer,offset,bytecount+40+(largeur*hauteur)/8,2) ;how many bytes in this ressource (DWORD)14
offset=poke(buffer,offset,offset+4,2) ;where in the file is the bitmap data (DWORD)18
;--------------------------------DIB header
offset=poke(buffer,offset,40,2) ;lenght of the header (DWORD)22
offset=poke(buffer,offset,largeur,2) ;width in pixel of the picture (DWORD)26
offset=poke(buffer,offset,hauteur*2,2) ;width in pixel of the picture (DWORD)30
offset=poke(buffer,offset,1,1) ;color planes 1 in most case (WORD)34
offset=poke(buffer,offset,32,1) ;bit per pixel (WORD)36
offset=poke(buffer,offset,0,2) ;compression value (DWORD)38
offset=poke(buffer,offset,bytecount,2) ;pixeldata size (DWORD)42
offset=poke(buffer,offset,0,2) ;ppm (DWORD)46
offset=poke(buffer,offset,0,2) ;ppm (DWORD)50
offset=poke(buffer,offset,0,2) ;number of color 0=max (DWORD)54
offset=poke(buffer,offset,0,2) ;number of color indice importants 0=max(DWORD)58
StartDrawing(ImageOutput(image))
For y=0 To Hauteur -1
For x=0 To Largeur -1
a=Point(x,y)
;Read a.l
b=(a <<8)>>24
g=(a <<16)>>24
r=(a <<24)>>24
Alpha=50;Alpha(a)
;If RGB(r, g, b) = ColorKey: Alpha = 0: Else: Alpha = 255: EndIf
offset=poke(buffer,offset,B,0)
offset=poke(buffer,offset,G,0)
offset=poke(buffer,offset,R,0)
offset=poke(buffer,offset,Alpha,0)
Next x
Next Y
StopDrawing()
EndIf
For a=1 To bytecount/8
offset=poke(buffer,offset,0,0)
Next
CatchImage(image,buffer)
;sav=OpenFile(0,filename$)
;WriteData(0,buffer,offset)
;CloseFile(0)
FreeMemory(buffer)
EndProcedure
Procedure poke(mem,offset,value,typ)
Select typ
Case 0;byte
PokeB(mem+offset,value):offset=offset+1
Case 1;word
PokeW(mem+offset,value):offset=offset+2
Case 2;long
PokeL(mem+offset,value):offset=offset+4
EndSelect
ProcedureReturn offset
EndProcedure