Initialise palette de couleur standard, optimale, ou personnalis�e
#include <GDIPlus.au3>
_GDIPlus_PaletteInitialize ( $iEntries [, $iPaletteType = $GDIP_PaletteTypeOptimal [, $iOptimalColors = 0 [, $bUseTransparentColor = True [, $hBitmap = Null]]]] )
$iEntries | Nombre d'entr�es. |
$iPaletteType | [optionnel] Constante PaletteType qui sp�cifie le type de palette ($GDIP_PaletteType*). |
$iOptimalColors | [optionnel] Entier qui sp�cifie le nombre de couleurs que vous voulez avoir dans une palette optimale bas�e sur un bitmap sp�cifi�. Si ce param�tre est sup�rieur � 0, le param�tre palettetype doit �tre r�gl� sur PaletteTypeOptimal et le param�tre bitmap doit pointer sur un objet Bitmap. |
$bUseTransparentColor | [optionnel] Valeur bool�enne qui sp�cifie s'il faut inclure la couleur transparente dans la palette. R�glez � TRUE pour inclure la couleur transparente; FALSE sinon. |
$hBitmap | [optionnel] Handle de l'objet Bitmap pour lequel une palette optimale sera cr��e. |
Succ�s: | Retourne une palette DllStruct: Flags - $iPaletteFlags Count - $iEntries ARGB - tableau de UINT de couleurs ARGB |
�chec: | D�finit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
@error: | -1 - GDIPlus.dll ne supporte pas cette fonction. 10 - Param�tres invalides. |
Consultez GdipInitializePalette dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() If Not _GDIPlus_Startup() Then MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available") Return EndIf Local $sFile = FileOpenDialog("S�lectionnez une image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)") If @error Or Not FileExists($sFile) Then Return Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) Local $iWidth = 600 Local $iHeight = _GDIPlus_ImageGetHeight($hImage) * 600 / _GDIPlus_ImageGetWidth($hImage) Local $hGui = GUICreate("GDI+ v1.1", $iWidth, $iHeight) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) GUISetState(@SW_SHOW) ; Convertit en bitmap 16 couleurs (4 bits par pixel) en utilisant le tramage diffusion Local $tPalette = _GDIPlus_PaletteInitialize(16, $GDIP_PaletteTypeOptimal, 16, False, $hImage) _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF04INDEXED, $GDIP_DitherTypeErrorDiffusion, $GDIP_PaletteTypeOptimal, $tPalette) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ;==>_Example