couleur sur StartDrawing()

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

couleur sur StartDrawing()

Message par venom »

bonsoir, voila je voie que dans l'aide de purebasic c'est notée que :
La couleur d'arrière plan est le noir (ie: RGB(0,0,0)) et la couleur d'avant plan est le blanc (ie: RGB(255,255,255)).
et il n'existe pas de fonction permettant de changer la couleur de fond d'un StartDrawing() ????
exemple:

Code : Tout sélectionner

If OpenWindow(0, 100, 200, 300, 200, "2D Drawing Test")

  If CreateImage(0, 300, 200)
    If StartDrawing(ImageOutput(0))

      BackColor(RGB(0,0,0))
      FrontColor(RGB(255,255,255)) 
      DrawText(10,50,"changer le fond actuellement noir ?")

      StopDrawing()
    EndIf
  EndIf
 
  CreateGadgetList(WindowID(0))
    ImageGadget(0, 0, 0, 0, 0, ImageID(0))

  Repeat
    EventID = WaitWindowEvent() 
  Until EventID = #PB_Event_CloseWindow 
  
EndIf



@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

En principe, non. Il faut dessiner une boite sur toute la surface de ton image, avec la couleur que tu veux.

Code : Tout sélectionner

If OpenWindow(0, 100, 200, 300, 200, "2D Drawing Test")
  
  If CreateImage(0, 300, 200)
    If StartDrawing(ImageOutput(0))
      
      ; BackColor(RGB(0,0,0))
      ; FrontColor(RGB(255,255,255)) 
      
      Box(0, 0, 300, 200, $FF0000)
      DrawingMode(#PB_2DDrawing_Transparent)
      FrontColor($00FFFF)
      
      DrawText(10,50,"changer le fond actuellement noir ?")
      
      StopDrawing()
    EndIf
  EndIf
  
  CreateGadgetList(WindowID(0))
  ImageGadget(0, 0, 0, 0, 0, ImageID(0))
  
  Repeat
    EventID = WaitWindowEvent()
  Until EventID = #PB_Event_CloseWindow
  
EndIf
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

ok je te remercie, sa ma traverser l'esprit cette nuit, maintenant je sais que c'est bien sa :wink:


@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Répondre