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

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Transformation bitmap & clipboard

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Transformation bitmap & clipboard

n°306496
[SDF]Poire
Vive Grumly
Posté le 11-02-2003 à 16:48:47  profilanswer
 

G une image dans un picture box, je veux lui fait une transformation via StretchBlt et je veux obtenir copier le résultat ds le clipboard sachant que je veux absolument que l'image résultat soit monochrome  :pt1cable:  
 
Merci


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
mood
Publicité
Posté le 11-02-2003 à 16:48:47  profilanswer
 

n°306703
[SDF]Poire
Vive Grumly
Posté le 11-02-2003 à 19:27:04  profilanswer
 

:bounce:

n°306894
Carbon_14
Posté le 11-02-2003 à 22:35:41  profilanswer
 

Peut-être voir sur http://www.vbfrance.com/article.aspx?Val=6107
 
Pour passer en N/B, il me semble qu'il y a une opération de bits avec l'API BitBlt() qui fait ça (vieux souvenirs d'une méthode pour déplacer image en faisant des masques, inversion vidéo, combinaison avec le fond, ..). Faudrait que je cherche quand énergie suffisante. :sleep:  :sleep:

n°307507
[SDF]Poire
Vive Grumly
Posté le 12-02-2003 à 14:46:52  profilanswer
 

En gros j'veux créer un bitmap (dib ?) pour foutre le résultat de mon StretchBlt et je comprend kedal... (vive le vb)
Pour le reste je me débrouillerais
 
 :bounce:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
n°308122
[SDF]Poire
Vive Grumly
Posté le 13-02-2003 à 09:24:42  profilanswer
 

:bounce:  :cry:


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
n°308303
[SDF]Poire
Vive Grumly
Posté le 13-02-2003 à 12:49:30  profilanswer
 

personne personne ? [:screamfr]


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:
n°308424
Carbon_14
Posté le 13-02-2003 à 14:51:12  profilanswer
 

Pas encore pu me replonger dans VB3, overbooké par soft d'acquisition multivoies.
 
L'image est chargée dans le PictureBox (inclu ds feuille FRM ou LoadImage) et le but est de la resizer puis coller en N/B ds presse papier ?

n°308668
[SDF]Poire
Vive Grumly
Posté le 13-02-2003 à 18:33:44  profilanswer
 

en gros C ça

n°309320
[SDF]Poire
Vive Grumly
Posté le 14-02-2003 à 14:17:30  profilanswer
 

Après de longues recherches, beaucoup de déductions (Delphi powa) j'en suis arrivé au code suivant (qui marche :)) :
 

Dim w As Integer, h As Integer
Dim iBitmap As Long, iDC As Long
     
    With Picture1
        w = Int(.ScaleWidth)
        h = Int(.ScaleHeight)
    End With
     
    iDC = CreateCompatibleDC(Picture1.hdc)
    'MsgBox iDC
    iBitmap = CreateBitmap(w, h, 1, 1, ByVal 0&)
    'MsgBox iBitmap
    SelectObject iDC, iBitmap
     
    With Picture1
        'StretchBlt Picture2.hdc, w, 0, -w, h, Picture1.hdc, 0, 0, w, h, vbSrcCopy
        SetMapMode Picture1.hdc, GetMapMode(Picture2.hdc)
        StretchBlt iDC, w, 0, -w, h, Picture1.hdc, 0, 0, w, h, vbSrcCopy
        BitBlt Picture2.hdc, 0, 0, w, h, iDC, 0, 0, vbSrcCopy
        Picture2.Refresh
    End With
     
    Clipboard.Clear
    'Clipboard.Clear
    'Call OpenClipboard(hwnd)
    'Call SetClipboardData(vbCFDIB, iBitmap)
    'Call CloseClipboard
    Clipboard.SetData Picture2.Image
     
    DeleteDC iDC
    DeleteObject iBitmap


 
Vive VB ! [:cobra84]  
 
Il y a tjs un truc qui me chagrine  

'Call OpenClipboard(hwnd)
'Call SetClipboardData(vbCFDIB, iBitmap)
'Call CloseClipboard


 
ne marche pas (celui ki me dit que C becose C en commentaire je le bute :D )
 
G essyé un peux tout (avec vbCFBitmap, en remplaçant iBitmap par iDib...) mais rien ne marche :'(
Donc je suis obligé de passer encore par une autre picture box (sic)
 
qq'1 à la solution à mon pb ?
 
Merci
 
 :pt1cable:  
 
[troll]
On peut dire tout ce qu'on veut, mais avec delphi pour obtenir une image B&N ou changé le nb de pixel, on a juste une propriété à modifier... on se tape pas 3 pages de codes et 20 appels d'API...
[/troll]


---------------
Des bons sites pour Delphi? http://forum.hardware.fr/forum2.php3?post=16838&cat=10 -- informaticien -- http://www.z0rglub.com/phpwebgallery/ -- Delphi :love:

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

  Transformation bitmap & clipboard

 

Sujets relatifs
(le retour de la quiche) concaténation et transformation d'entier...Question de GDI et de bitmap
Probleme avec des matrices de transformation 3D ...[ FLASH MX ] transformation d'une image existante en traits, c'est pos
transformation de fichierstransformation de fichier
rotation bitmap surface directdrawTransformation d'hexa en caractère dans une lecture de fichier
transformation prog java en applet java pr mettre sur internet please[SGBDR] les index 'BITMAP'
Plus de sujets relatifs à : Transformation bitmap & clipboard


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)