La j'en perd mon latin et je ne comprend pas d'ou vient l'erreur dans mon code. En gros mon code dessine un degrader tout les x et ce dans la taille maxi d'un gadget image. Et tout les x il fait des saut dans le dégrader, alors voila le code mais la je vois pas le pourquoi de l'erreur.
Code : Tout sélectionner
EnableExplicit
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; +--------------------------------------------------------------------------+
; | |
; +--------------------------------------------------------------------------+
Procedure setDrawDMXChannel(limagegadget.l, w.l, h.l)
;
Protected i.l
Protected j.l
Protected posx.f
Protected posy.f
Protected tmpa.f
Protected tmpb.f
Protected pasa.f
Protected pasb.f
Protected pasc.f
Protected mula.f
Protected mulb.f
Protected mulc.f
Protected numx.l = 32
Protected numy.l = 16
Protected Dim Couleur(2)
Couleur(0) = $8E6235
Couleur(1) = $E9D6C2
Couleur(2) = $D5B08C
If CreateImage(limagegadget, w, h)
If StartDrawing(ImageOutput(limagegadget))
tmpa = w/numx
tmpb = h/numy
Box(0, 0, w, h, $0000FF)
pasa = (Red(Couleur(2)) - Red(Couleur(1))) / tmpa
pasb = (Green(Couleur(2)) - Green(Couleur(1))) / tmpa
pasc = (Blue(Couleur(2)) - Blue(Couleur(1))) / tmpa
For j = 1 To numx
mula = Red(Couleur(1))
mulb = Green(Couleur(1))
mulc = Blue(Couleur(1))
For i = 1 To tmpa+1
mula = mula + pasa
mulb = mulb + pasb
mulc = mulc + pasc
LineXY(posx+i, 1, posx+i, h-2, RGB(mula,mulb,mulc))
Next i
posx + tmpa
Next j
StopDrawing()
EndIf
SetGadgetState(limagegadget, ImageID(limagegadget))
EndIf
EndProcedure
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; ****************************************************************************
; +--------------------------------------------------------------------------+
; | |
; +--------------------------------------------------------------------------+
Define event.l
Define hWnd.l = OpenWindow(0, 0, 0, 800, 500, "test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If hWnd <> 0
ImageGadget(26, 5, 5, 778, 400, 0)
setDrawDMXChannel(26, 778, 400)
Repeat
event = WaitWindowEvent(10)
Until event =#PB_Event_CloseWindow
EndIf
GallyHC