Je sais plus où je l'ai reprise. Mais je pense qu'elle vient de CodeArchive. Mais je suis pas sûr. Faudrait peut-être que je prenne l'habitude de le noter en commentaire dans le début du source.
Il y a ces deux autres procédures pour les images :
Faire un renversement de l'image. Voir sur code archive
Charger un image avec une transparence. Un code de Danilo (Merçi)
N.B. MirrorImage() s'effectue sur l'image en cours. Donc un UseImage(),Createimage(), ou un LoadImage() juste avant l'appel de cette procédure pour que la transformation fonctionne. Les mêmes Constantes que pour la fonction de dégradé : #Vertical et #Horizontal.
A+
Guimauve
Code:
ProcedureDLL MirrorImage(Orientation.b)
Width.l = ImageWidth()
Height.l = ImageHeight()
If Orientation = #Vertical
hDC = StartDrawing(ImageOutput())
StretchBlt_(hDC, 0, Height, Width, -Height, hDC, 0, 0, Width, Height, #SRCCOPY)
StopDrawing()
ElseIf Orientation = #Horizontal
hDC = StartDrawing(ImageOutput())
StretchBlt_(hDC, Width, 0, -Width, Height, hDC, 0, 0, Width, Height, #SRCCOPY)
StopDrawing()
EndIf
EndProcedure
ProcedureDLL LoadTransparentImage(Number, FileName$, TransColor, NewColor)
; >
; > Number = ImageNumber
; > FileName$ = File Name
; > TransColor = RGB: Transparent Color, -1 = First Color in Picture
; > NewColor = RGB: New Color for TransColor, -1 = System Window Background
; >
Structure _LTI_BITMAPINFO
bmiHeader.BITMAPINFOHEADER
bmiColors.RGBQUAD[1]
EndStructure
Structure _LTI_LONG
l.l
EndStructure
hBmp = LoadImage(Number, FileName$)
If hBmp
hDC = StartDrawing(ImageOutput())
If hDC
ImageWidth = ImageWidth()
ImageHeight = ImageHeight()
mem = GlobalAlloc_(#GMEM_FIXED | #GMEM_ZEROINIT, ImageWidth * ImageHeight * 4)
If mem
bmi._LTI_BITMAPINFO
bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
bmi\bmiheader\biWidth = ImageWidth
bmi\bmiheader\biHeight = ImageHeight
bmi\bmiheader\biPlanes = 1
bmi\bmiheader\biBitCount = 32
bmi\bmiheader\biCompression = #BI_RGB
If GetDIBits_(hDC, hBmp, 0, ImageHeight(), mem, bmi, #DIB_RGB_COLORS) <> 0
If TransColor = -1
*pixels._LTI_LONG = mem + ((ImageHeight - 1) * ImageWidth * 4)
TransColor = *pixels\l
Else
TransColor = RGB(Blue(TransColor), Green(TransColor), Red(TransColor))
EndIf
If NewColor = -1
NewColor = GetSysColor_(#COLOR_3DFACE)
EndIf
NewColor = RGB(Blue(NewColor), Green(NewColor), Red(NewColor))
*pixels._LTI_LONG = mem
For a = 1 To ImageWidth * ImageHeight
If * pixels\l = TransColor
*pixels\l = NewColor
EndIf
*pixels + 4
Next a
If SetDIBits_(hDC, hBmp, 0, ImageHeight(), mem, bmi, #DIB_RGB_COLORS) <> 0
Result = hBmp
EndIf
EndIf
GlobalFree_(mem)
EndIf
EndIf
StopDrawing()
EndIf
ProcedureReturn Result
EndProcedure