Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1217 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Superposer 2 images avec gestion de transparence ...

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Superposer 2 images avec gestion de transparence ...

n°1402264
tomsoft
Posté le 06-07-2006 à 19:28:46  profilanswer
 

:hello:  
 
j'aurais voulut savoir s'il etait possible de superposer 2 images (.png ou autre) avec support de la couleur "transparente"
 
Je vous explique, il y a un fond ,et un personage qui se deplace dessus ,ca fait ca :
 
http://img190.imageshack.us/img190/392/picture14sz.jpg
 
je ne veut pas du blanc autour de l'image ...
 
ya t'i lpossibilité de faire ca dans Vbexpress ?
 

mood
Publicité
Posté le 06-07-2006 à 19:28:46  profilanswer
 

n°1402607
tomsoft
Posté le 07-07-2006 à 10:47:06  profilanswer
 
n°1402608
jpcheck
Pioupiou
Posté le 07-07-2006 à 10:49:08  profilanswer
 


sous vb editor tu as dans les propriétés de l'image la transparence ou l'opacité de dispo il me semlbe...

n°1402615
tomsoft
Posté le 07-07-2006 à 10:55:18  profilanswer
 

vb editor = la page design de ma form ?

n°1402650
jpcheck
Pioupiou
Posté le 07-07-2006 à 11:21:30  profilanswer
 

tomsoft a écrit :

vb editor = la page design de ma form ?


avec mes excuse, a marche pour les boutons seulement po pour les images :s

n°1402985
tomsoft
Posté le 08-07-2006 à 18:28:30  profilanswer
 

:( ca serait donc impossible ?

n°1427765
tomsoft
Posté le 19-08-2006 à 18:15:08  profilanswer
 

:cry:

n°1428346
kiki29
Posté le 21-08-2006 à 03:17:01  profilanswer
 
n°1428696
tomsoft
Posté le 21-08-2006 à 16:41:29  profilanswer
 

merci :jap:
 
mais j'y arrive tjs pas ,j'ai trouvé ca :
 
Title Overlay one image on another with a transparent color by using PSet
Description This example shows how to overlay one image on another with a transparent color by using PSet in Visual Basic 6.
Keywords PSet, overlay, transparent
Categories Graphics
 
This program simply loops through the pixels in the images. For each image in top-to-bottom order, the program looks for a color other than the one defined as transparent. When it finds such a color, it stops looking at the images and sets the output pixel's color using PSet.
 

Code :
  1. Private Sub cmdCombine_Click()
  2. Dim max_input As Integer
  3. Dim transparent As Long
  4. Dim wid As Single
  5. Dim hgt As Single
  6. Dim X As Single
  7. Dim Y As Single
  8. Dim i As Integer
  9. Dim clr As Long
  10.     cmdCombine.Enabled = False
  11.     MousePointer = vbHourglass
  12.     DoEvents
  13.     max_input = picInput.ubound
  14.     For i = 0 To max_input
  15.         picInput(i).AutoRedraw = True
  16.         picInput(i).ScaleMode = vbPixels
  17.     Next i
  18.     picResult.Width = picInput(0).Width
  19.     picResult.Height = picInput(0).Height
  20.     picResult.ScaleMode = vbPixels
  21.     transparent = picTransparent.BackColor
  22.     wid = picInput(0).ScaleWidth
  23.     hgt = picInput(0).ScaleHeight
  24.     For Y = 0 To hgt
  25.         For X = 0 To wid
  26.             For i = max_input To 0 Step -1
  27.                 clr = picInput(i).Point(X, Y)
  28.                 If clr <> transparent Then Exit For
  29.             Next i
  30.             picResult.PSet (X, Y), clr
  31.         Next X
  32.         DoEvents
  33.     Next Y
  34.     picResult.Picture = picResult.Image
  35.     cmdCombine.Enabled = True
  36.     MousePointer = vbDefault
  37.     Beep
  38. End Sub


 
 
Note that there are faster ways to access color values in V 6 and VB .NET, and that there are faster methods for merging images if you have an overlay mask. Note also that VB .NET provides tools for setting a transparent color for an image so this problem is trivial in VB .NET.
 

 
D'apres la derniere phrase on pourrai le faire sans code ... ??

n°1428717
kiki29
Posté le 21-08-2006 à 17:03:09  profilanswer
 

Voir Aide en Ligne Bitmap.MakeTransparent Method (Color)
ainsi que les exemples sur le site vb Helper
 
howto_net_translucent_text
howto_net_copy_transparent_image_shape
howto_net_analog_clock_transparent
howto_net_transparent_form
howto_net_maketransparent
howto_net_copy_transparent_image_shape


Message édité par kiki29 le 21-08-2006 à 17:13:37

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Superposer 2 images avec gestion de transparence ...

 

Sujets relatifs
Superposer des imagesProblème d'affichage d'images
Galerie d'images sans changement de pageGestion Plusieurs DataGridView
Images dans une liste deroulante est ce possible ?!?CSS et IE: Marges sous les images // Firefox: chargement en 2 temps
Gestion des sessions par PHP et SQL[CSS] hover avec des images? Positionnement, FF, IE
[Gestion du clavier] Mouvement fluide ? 
Plus de sujets relatifs à : Superposer 2 images avec gestion de transparence ...


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR