DrawingBufferPixelFormat()

Syntaxe

Resultat = DrawingBufferPixelFormat()
Description
Renvoie le format de pixel.

Arguments

Aucun.

Valeur de retour

Peut être la combinaison des valeurs suivantes:
  #PB_PixelFormat_8Bits       : 1 octet par pixel, palettisé
  #PB_PixelFormat_15Bits      : 2 octets par pixel
  #PB_PixelFormat_16Bits      : 2 octets par pixel
  #PB_PixelFormat_24Bits_RGB  : 3 octets par pixel (RRGGBB)
  #PB_PixelFormat_24Bits_BGR  : 3 octets par pixel (BBGGRR)
  #PB_PixelFormat_32Bits_RGB  : 4 octets par pixel (RRGGBB)
  #PB_PixelFormat_32Bits_BGR  : 4 octets par pixel (BBGGRR)
  #PB_PixelFormat_ReversedY   : Les lignes sont inversées en hauteur (la dernière ligne est la première)

Remarques

DrawingBuffer() doit être appelé avant d'utiliser cette fonction.

Exemple

Les exemples suivants montrent comment gérer différents formats:
  If DrawingBufferPixelFormat() = #PB_PixelFormat_32Bits_RGB | #PB_PixelFormat_ReversedY
    ; RGB 32 bits en mode inversé
  EndIf
  
  If DrawingBufferPixelFormat() = #PB_PixelFormat_32Bits_RGB
    ; RGB 32 bits
  EndIf
  
  If DrawingBufferPixelFormat() & #PB_PixelFormat_32Bits_RGB
    ; RGB 32 bits (mode inversé ou non)
  EndIf 

Exemple

  If OpenWindow(0, 0, 0, 200, 200, "Buffer Image", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateImage(0, 200, 200, 32) And StartDrawing(ImageOutput(0))
      DrawText(60,80,"PUREBASIC", RGB(255, 255, 0))
      Debug "Adresse mémoire : " + Str(DrawingBuffer())
      Debug "Longueur réelle d'une ligne en octet : " + Str(DrawingBufferPitch())    
      Debug "Format de pixel : " + Str(DrawingBufferPixelFormat())
      StopDrawing() 
      ImageGadget(0, 0, 0, 200, 200, ImageID(0))
    EndIf
    
    Repeat
      Event = WaitWindowEvent()      
    Until Event = #PB_Event_CloseWindow
  EndIf

Voir aussi

StartDrawing(), DrawingBufferPitch()

OS Supportés

Tous

<- DrawingBufferPitch() - 2DDrawing Index - DrawingFont() ->