Page 1 sur 1

Pb image avec la 6.30 (résolut)

Publié : lun. 09/févr./2026 20:54
par Bmld76
Bonjour,
Avec la 6.30, Createimage crée une image vide alors que cela fonctionne avec la 6,21. Testé sur Mac Intel et Mac M1
Même l'exemple de la doc ne fonctionne plus.
En connaissez-vous la raison

Cordialement

programme exemple

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 256, 256, "CreateImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ImageGadget(0, 0, 0, 256, 256, 0)
    
    If CreateImage(0, 256, 256, 32, RGB(255,255,255))
      StartDrawing(ImageOutput(0))
      Ellipse(70, 50, 30, 10, RGB(0,0,255))
      Ellipse(186, 50, 30, 10, RGB(0,0,255))
      LineXY(128, 80, 128, 150, RGB(255, 0, 255))
      RoundBox(70, 200, 110, 30, 20, 20, RGB(255, 0, 0))
      StopDrawing()
    EndIf
    
    SetGadgetState(0, ImageID(0)) ; Affichage
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
   EndIf
   

Re: Pb image avec la 6.30

Publié : lun. 09/févr./2026 21:55
par falsam
La réponse est dans la documentation de la version 6.30. Si tu crées une image 32bits, ce qui est ton cas, tu dois utiliser des couleurs RGBA() lors de la création.
Touche F1 sur l'instruction 'CreateImage' a écrit :The backcolor used when the image is created.
If the image is 24-bit, use RGB() to get a valid color.
If the image is 32-bit, use RGBA() to get a valid color. For 32-bit image, special constants can be used as well:
- #PB_Image_Transparent which is similar to RGBA(255,255,255,0), white background which can help for light antialiasing.
- #PB_Image_TransparentBlack which is similar to RGBA(0,0,0,0), black background which can help for dark antialiasing.
➡️ Ton code corrigé

Code : Tout sélectionner

If OpenWindow(0, 0, 0, 256, 256, "CreateImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ImageGadget(0, 0, 0, 256, 256, 0)
    
    If CreateImage(0, 256, 256, 32, RGBA(255,255,255, 255))
      StartDrawing(ImageOutput(0))
      Ellipse(70, 50, 30, 10, RGB(0,0,255))
      Ellipse(186, 50, 30, 10, RGB(0,0,255))
      LineXY(128, 80, 128, 150, RGB(255, 0, 255))
      RoundBox(70, 200, 110, 30, 20, 20, RGB(255, 0, 0))
      StopDrawing()
    EndIf
    
    SetGadgetState(0, ImageID(0)) ; Affichage
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
   EndIf

Re: Pb image avec la 6.30 (résolut)

Publié : mar. 10/févr./2026 9:40
par Bmld76
Super, Merci, j'ai cherché mais je n'ai pas pensé à cette doc, c'était évident.