[5.20] drawtext() transparent et gadget

Partagez votre expérience de PureBasic avec les autres utilisateurs.
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

[5.20] drawtext() transparent et gadget

Message par blendman »

salut

j'ai cherché comment afficher un texte sur un gadget avec transparence.

Voici le code pour ceux que cela intéresseraient :

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 200, 200, "Drawtext transparent", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  SetWindowColor(0,RGB(120,0,0)); couleur rouge  foncé pour la fenêtre pour voir la transparence
  If CreateImage(0, 200, 200,32,#PB_Image_Transparent) And StartDrawing(ImageOutput(0))
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Transparent)
    For i = 1 To 30
      DrawText(Random(200), Random(200), "Hello World!", RGBA(Random(255), Random(255), Random(255),255))
    Next i
    StopDrawing() 
    ImageGadget(0, 0, 0, 200, 200, ImageID(0))
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
Avatar de l’utilisateur
Micoute
Messages : 2584
Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière

Re: [5.20] drawtext() transparent et gadget

Message par Micoute »

Bonjour blendman et merci beaucoup pour ce partage
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 6.20 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Répondre