Page 1 sur 1

ResizeImage et icônes

Publié : sam. 09/oct./2004 12:58
par Anonyme2
J'ai fait quelques essais avec des icônes 16x16, 32x32, 48x48 et les imagesgadgets et c'est Ok

Mais en redimensionnant les icônes avec ResizeImage() en 16x16, ca ne fonctionne pas.

Le code qui suit permet de vérifier.

Pour afficher les images redimensionnéés, j'ai utilisé UseImage(#Image) et ca m'affiche des carré de 16x16 noirs

Mais si j'utilise le handle retournée par Catchimage, j'ai l'image qui s'affiche telle quelle était lors de sa création; cela semble vouloir dire que resizeimage génère un autre handle (?)

Ai-je bien utilisé la commande resizeimage ?

Code : Tout sélectionner

Enumeration
  #MainWindow
  #Image_Position_32_32
  #Image_Croix_48_48
  #Image_Gadget_Position_32_32
  #Image_Gadget_Croix_48_48
  #Image_Gadget_Position_16_16
  #Image_Gadget_Croix_16_16
  #TextGadget1
  #TextGadget2
EndEnumeration


;- Programme principal
If OpenWindow(#MainWindow, 100, 150, 300, 300, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered, "Images")
  If CreateGadgetList(WindowID())

;- les icônes
  Position = CatchImage(#Image_Position_32_32, ?Icone_Preference)
  Croix = CatchImage(#Image_Croix_48_48, ?Icon_Croix)

;- les ImagesGadget normale
  ImageGadget(#Image_Gadget_Position_32_32, 40, 50, 0, 0, Position)
  UseImage(#Image_Position_32_32)
  Debug ImageWidth() 
  
  ImageGadget(#Image_Gadget_Croix_48_48, 140, 50, 0, 0, Croix)
  UseImage(#Image_Croix_48_48)
  Debug ImageWidth() 
  
  TextGadget(#TextGadget1, 40, 120, 200, 25,"ImageGadget et commande Catchimage")

;- les Images redimensionnées en 16x16 avec ResizeImage()
  ResizeImage(#Image_Position_32_32, 16, 16)
  UseImage(#Image_Position_32_32)
  Debug ImageWidth() 
  ImageGadget(#Image_Gadget_Position_16_16, 40, 200, 0, 0, UseImage(#Image_Position_32_32)) 
;  ImageGadget(#Image_Gadget_Position_16_16, 40, 200, 0, 0, Position) 

  ResizeImage(#Image_Croix_48_48, 16, 16)
  UseImage(#Image_Croix_48_48)
  Debug ImageWidth() 
  ImageGadget(#Image_Gadget_Croix_16_16, 140, 200, 0, 0, UseImage(#Image_Croix_48_48)) 
;  ImageGadget(#Image_Gadget_Croix_16_16, 140, 200, 0, 0, Croix) 

  TextGadget(#TextGadget2, 40, 270, 240, 25,"ImageGadget après utilisation de ResiseImage()")


    ;- Boucle evenements
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
    
  EndIf
EndIf
End

DataSection
  Icone_Preference :
    Data.l $00010000, $20200002, $00000010, $02E80000, $00260000, $10100000
    Data.l $00000010, $01280000, $030E0000, $00280000, $00200000, $00400000
    Data.l $00010000, $00000004, $02800000, $00000000, $00000000, $00000000
    Data.l $00000000, $00000000, $00000000, $80000080, $80000000, $00800080
    Data.l $00800000, $80800080, $80800000, $C0C00080, $000000C0, $FF0000FF
    Data.l $FF000000, $00FF00FF, $00FF0000, $FFFF00FF, $FFFF0000, $000000FF
    Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
    Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
    Data.l $FF080000, $000000F0, $00000000, $00000000, $FB8B0000, $0000F0FF
    Data.l $00000000, $00000000, $BFBF0800, $00B0FFFB, $00000000, $00000000
    Data.l $FBFB0B00, $F0FFFFFF, $00000000, $00000000, $BFBF8F00, $FFBFBFBF
    Data.l $000000B0, $00000000, $F3FBFB00, $FFFFFB8B, $0000B0FF, $00000000
    Data.l $B8BFBF08, $BFBF8888, $00B0FFBF, $00000000, $83FBFB0B, $FF8B8B87
    Data.l $B0FFFFFF, $00000000, $BFBFBF8F, $B83F3838, $FFFFFBBF, $000000B0
    Data.l $FB83FBFB, $83FB83FB, $BFFFFF8B, $080070FF, $3878BFBF, $7FB8BFBF
    Data.l $FFBFBF87, $0B0070FF, $878BFBFB, $8BFB8B8B, $FB8F838F, $8F0000F7
    Data.l $B8B8BFBF, $B8BF3878, $FF883F38, $FB000070, $F3FB8BFB, $FB888783
    Data.l $FB8BF3FB, $BF080070, $BFB878B8, $7838B8BF, $F7FFF8BF, $FB0B0000
    Data.l $8B878BF3, $77F3FBFB, $F7FBFB88, $BF8F0000, $38B8B8BF, $B8BFBF7F
    Data.l $70FFBF38, $FB8B0000, $83FBFBFB, $FBFB8B8B, $70FBFBF3, $BF770000
    Data.l $87B8BFBF, $BF3F38BF, $00B7BFBF, $77000000, $FBFBFBFB, $8B87FBF3
    Data.l $00F7FB8B, $00000000, $BFBFBF77, $78B738BF, $0070BFBF, $00000000
    Data.l $FBFB7700, $83FBFBFB, $0070FBFB, $00000000, $BF770000, $BFBFBFBF
    Data.l $0000B7BF, $00000000, $77000000, $FBFBFBFB, $0000F7FB, $00000000
    Data.l $00000000, $BFBFBF77, $000070BF, $00000000, $00000000, $FBFB7700
    Data.l $000070FB, $00000000, $00000000, $BF770000, $000000B7, $00000000
    Data.l $00000000, $77000000, $00000070, $00000000, $00000000, $00000000
    Data.l $00000000, $FFFF0000, $FFFFFFFF, $87FFFFFF, $01FFFFFF, $00FEFFFF
    Data.l $00FCFF7F, $00FCFF1F, $00F8FF07, $00F8FF01, $00F07F00, $00F01F00
    Data.l $00E00700, $00E00100, $00C00100, $00C00100, $00800300, $00800700
    Data.l $00000700, $00000F00, $00000F00, $00001F00, $00001F00, $00C03F00
    Data.l $00F03F00, $00FC7F00, $00FF7F00, $C0FFFF00, $F0FFFF00, $FCFFFF01
    Data.l $FFFFFF01, $FFFFFF03, $FFFFFFC7, $0028FFFF, $00100000, $00200000
    Data.l $00010000, $00000004, $00C00000, $00000000, $00000000, $00000000
    Data.l $00000000, $00000000, $00000000, $80000080, $80000000, $00800080
    Data.l $00800000, $80800080, $C0C00000, $808000C0, $00000080, $FF0000FF
    Data.l $FF000000, $00FF00FF, $00FF0000, $FFFF00FF, $FFFF0000, $000000FF
    Data.l $00000000, $00000000, $00000000, $00000000, $0000B00F, $00000000
    Data.l $00F0FB0B, $00000000, $B0BFBFBF, $00000000, $FBFB88FB, $0F0000F0
    Data.l $BF88BFBF, $0B00B0BF, $88FB8BF8, $BF0080FB, $BF8FB8BF, $FB0000B8
    Data.l $8BF8FB88, $8F0800F8, $BFBF88BF, $08000080, $FB88FB8B, $00000080
    Data.l $B8BF8F08, $00000000, $F88B0800, $00000000, $80080000, $00000000
    Data.l $00000000, $FFFF0000, $FFF90000, $7FF00000, $1FF00000, $07E00000
    Data.l $01E00000, $00C00000, $01C00000, $03800000, $03800000, $07800000
    Data.b 0, 0, -32, 7, 0, 0, -8, 15, 0, 0, -2, 15, 0, 0, -1, -97, 0, 0, -1
    Data.b - 1, 0, 0
  
  Icon_Croix :
Data.l $00010000, $20200001, $00000004, $02E80000, $00160000, $00280000
Data.l $00200000, $00400000, $00010000, $00000004, $02000000, $00000000
Data.l $00000000, $00100000, $00000000, $00000000, $00000000, $80000080
Data.l $80000000, $00800080, $00800000, $80800080, $C0C00000, $808000C0
Data.l $00000080, $FF0000FF, $FF000000, $00FF00FF, $00FF0000, $FFFF00FF
Data.l $FFFF0000, $000000FF, $00000000, $00000000, $00000000, $77070000
Data.l $77777777, $77777777, $77777777, $77077077, $77777777, $77777777
Data.l $77777777, $77077077, $77779779, $77777777, $77777777, $77077077
Data.l $77977979, $77777777, $77777777, $77077077, $77977779, $77777777
Data.l $77777777, $77077077, $77799777, $77777377, $77777777, $77077077
Data.l $97997977, $77777777, $77777777, $77077077, $97797777, $77777777
Data.l $77777777, $77077077, $99777777, $77777777, $77777777, $77077077
Data.l $79777777, $77779799, $77773777, $77077077, $79777777, $77979977
Data.l $99997777, $77077077, $77777777, $99797797, $79779999, $77077097
Data.l $77377777, $79777797, $99999999, $77077077, $77777777, $99777799
Data.l $77777797, $77077077, $77777777, $77797799, $77777777, $77077077
Data.l $77777777, $77999779, $77773777, $77077077, $77777777, $77979979
Data.l $77777777, $77077077, $37777777, $77779977, $77777777, $77077077
Data.l $77777777, $77779977, $77777777, $77077077, $77777777, $77779979
Data.l $77777777, $77077077, $77777777, $77777979, $77777777, $77077077
Data.l $77777777, $77777999, $77777777, $77077077, $77777777, $77777999
Data.l $77777777, $77077077, $77777777, $77777999, $77777777, $77077077
Data.l $77777777, $77779779, $77777777, $77077077, $77777777, $77777777
Data.l $77777777, $77077077, $77777777, $77777777, $77777777, $00007077
Data.l $00000000, $00000000, $00000000, $00000000, $70700000, $70707070
Data.l $00007070, $00000000, $00070000, $00077070, $00007077, $00000000
Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
Data.l $00000000, $00000000, $00000000, $00000000, $00000000, $00000000
Data.b  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
EndDataSection