[Resolu]Petit soucis de BoxedGradient

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
Ar-S
Messages : 9477
Inscription : dim. 09/oct./2005 16:51
Contact :

[Resolu]Petit soucis de BoxedGradient

Message par Ar-S »

Salut

Il m'arrive un truc surement tout con mais qui commence à prendre plus de temps qu'il ne mérite.
Je veux créer un carré avec un dégradé allant de BAS_GAUCHE couleur $505050 à HAUT_DROIT couleur $FFFFFF
Cependant je me retrouve avec une image toute noire... Il me semble pourtant avoir bien adapté l'exemple de la doc.

Ou me trompe-je ? :roll:
D'avance merci

Code : Tout sélectionner

Procedure CreatGradi()
   Protected LC = 400, HC = 256

   CreateImage(10,LC,HC)
   StartDrawing(ImageOutput(10))
   DrawingMode(#PB_2DDrawing_Gradient)  
   BackColor($505050)
   FrontColor($FFFFFF)
   BoxedGradient(0,0,LC,HC)
   StopDrawing()
  
EndProcedure

CreatGradi()

If OpenWindow(0, 0, 0, 400, 256, "BoxedGradient", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(1, 0, 0, 400, 256, ImageID(10))
EndIf


Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Christophe
Messages : 43
Inscription : lun. 22/oct./2018 19:34
Localisation : Haisnes (62)

Re: Petit soucis de BoxedGradient

Message par Christophe »

Ar-s, tu n'appliques pas ton BoxedGradient à une surface donc ton image est vide

Code : Tout sélectionner

Procedure CreatGradi()
   Protected LC = 400, HC = 256

   CreateImage(10,LC,HC)
   StartDrawing(ImageOutput(10))
   DrawingMode(#PB_2DDrawing_Gradient) 
   BackColor($505050)
   FrontColor($FFFFFF)
   BoxedGradient(-LC,0,LC*2,HC*2)
   Box(0,0,LC,HC)  ; Surface sur laquelle le gradient s'applique
   StopDrawing()
 
EndProcedure

CreatGradi()

If OpenWindow(0, 0, 0, 400, 256, "BoxedGradient", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(1, 0, 0, 400, 256, ImageID(10))
EndIf


Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Avatar de l’utilisateur
Ar-S
Messages : 9477
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: [Resolu]Petit soucis de BoxedGradient

Message par Ar-S »

Merci Christophe !
Je trouve cette commande pas vraiment logique (enfin pas claire).. Pour moi BoxedGradient était une box que l'on remplissait via les back et front color en partant de l'origine.
En plus je viens de me rendre compte que je voulais un LinearGradient(0, HC, LC, 0) au lieu d'un BoxGradient.
Merci pour cet éclairage.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Répondre