je partage le code car je me dis que ça peut servir !
Code : Tout sélectionner
If OpenWindow(0, 100, 100, 500, 300, "PureBasic - Image")
If CreateImage(0, 255, 255,32)
StartDrawing(ImageOutput(0))
*MemoryAddress = DrawingBuffer()
FillMemory(*MemoryAddress,DrawingBufferPitch()*ImageHeight(0),RGBA(0,0,0,0),#PB_Long)
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
Box(0,0,100,100,RGBA(255,0,0,255))
For k=0 To 255
FrontColor(RGB(k,0, k)) ; a rainbow, from black to pink
Line(0, k, 255, 0)
Next
;DrawingMode(#PB_2DDrawing_Transparent)
FrontColor(RGB(255,255,255)) ; print the text to white !
DrawText(40, 50, "An image created easely...",RGBA(255,255,255,255))
StopDrawing() ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Repaint
StartDrawing(WindowOutput(0))
DrawAlphaImage(ImageID(0), 20, 10)
StopDrawing()
EndIf
Until EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
EndIf
End ; All the opened