Forum | | | |  | Hallo, ich möchte ein Bildausschnitt von hwin1& einlesen, welches mit GDIPlus dargestellt wird. Links erscheint nur ein schwarze Viereck, kein Bild.
mfg KompilierenMarkierenSeparieren $H windows.ph
$H includes\Functions_GDIPLUS.ph
$H includes\GDIP_Imageging.ph
$I includes\GDIP_Helper.inc
Declare gdiplusToken&,ImageObject&,ImageObject1&,GraphicObject&,Attributes&
Declare Color_Matrix#,hwin&,hwin1&
declare bmi#,b#
declare Handle&,Neu&
gdiplusToken& = InitGDIPlus()GDIPlus starten
Window 20,20-200,200
cls
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
hWin1& = Create(text, hwin&, Test, 200, 20, 300,300)
ImageObject& = gdipLoadImage(eisbaer.jpg)
If ImageObject&
~GdipCreateFromHWND(hwin1&,ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,20,0)
~GdipCreateImageAttributes(Addr(Attributes&))
Endif
If ImageObject&
~GdipCreateFromHWND(hwin1&,ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,150,200)
~GdipCreateImageAttributes(Addr(Attributes&))
~GdipDisposeImageAttributes(Attributes&)
~GdipDisposeImage(ImageObject&)
~GdipDisposeImage(ImageObject1&)
~GdipDeleteGraphics(GraphicObject&)
Dispose Color_Matrix#
Endif
handle&=create(hpiccopy,hwin1&,0,0,128,128)
struct bmpHEADER=Size&,Width&,Height&,Planes%,BitCount%,Compression&,SizeImage&,X#(24)
dim bmi#,bmpHEADER
bmi#.Size&=sizeof(bmi#)------------------Größe von BITMAPINFOHEADER
~GetDIBits(%hdc,Handle&,0,0,0,bmi#,0)--Dummy-Aufruf, um bmpHeader zu füllen (Rückgabe: 1=OK)
print sizeof(bmi#)
dim b#,bmi#.SizeImage&-----------------Bereich für Bildinformationen (Pixel) bereitstellen
~GetDIBits(%hdc,Handle&,0,bmi#.Height&,b#,bmi#,0)--Eigendliche Bilddaten aus Handle ermitteln
Neu&=~CreateDIBitmap(%hdc,bmi#,4,b#,bmi#,0)------Neue DIB mit geänderten Farben erzeugen
startpaint hwin&
drawpic Neu&,10,10;0
endpaint
Waitinput
ExitGDIPlus(gdiplusToken&)
End
|
| | | | |
| |  Jörg Sellmeyer | ohne die zugehörigen Includes wird das wohl kaum jemand testen können. Zumindest ein Linkverweis wäre hilfreich. |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 05.03.2009 ▲ |
| |
| |  |
| | | | |
| |  Jörg Sellmeyer | | | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 05.03.2009 ▲ |
| |
| |  | Also ist GDIPlus für solche Sachen mist. derweil das Bild ja angezeigt wird im GDI-Aufruf.... |
| | | | |
| |  Jörg Sellmeyer | Tschuldigung - war ein Fehler meinerseits. Ich hatte das Bild falsch gespeichert. Worans liegt kann ich Dir aber auch nicht sagen. Vielleicht hat Andreas Miethe ja mal ein Auge drauf. |
| | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 05.03.2009 ▲ |
| |
| |  Andreas Miethe
 | Hallo Peter,
so sollte es gehen  KompilierenMarkierenSeparieren $H windows.ph
$H includes\Functions_GDIPLUS.ph
$H includes\GDIP_Imageging.ph
$I includes\GDIP_Helper.inc
Declare gdiplusToken&,ImageObject&,ImageObject1&,GraphicObject&,Attributes&
Declare Color_Matrix#,hwin&,hwin1&
declare bmi#,b#
declare Handle&,Neu&
gdiplusToken& = InitGDIPlus()GDIPlus starten
Window 20,20-200,200
cls
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
hWin1& = Create(text, hwin&, Test, 200, 20, 300,300)
ImageObject& = gdipLoadImage(eisbaer.jpg)
If ImageObject&
~GdipCreateFromHDC(~GetDC(hwin1&),ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,0,0)
Endif
Handle des Bismaps
~GdipCreateHBITMAPFromBitmap(ImageObject&,Addr(Handle&),0)
struct bmpHEADER=Size&,Width&,Height&,Planes%,BitCount%,Compression&,SizeImage&,X#(24)
dim bmi#,bmpHEADER
bmi#.Size&=sizeof(bmi#)------------------Größe von BITMAPINFOHEADER
Print ~GetDIBits(%hdc,Handle&,0,0,0,bmi#,0)--Dummy-Aufruf, um bmpHeader zu füllen (Rückgabe: 1=OK)
print sizeof(bmi#)
dim b#,bmi#.SizeImage&-----------------Bereich für Bildinformationen (Pixel) bereitstellen
~GetDIBits(%hdc,Handle&,0,bmi#.Height&,b#,bmi#,0)--Eigendliche Bilddaten aus Handle ermitteln
Neu&=~CreateDIBitmap(%hdc,bmi#,4,b#,bmi#,0)------Neue DIB mit geänderten Farben erzeugen
~StretchDiBits(~Getdc(hwin&),0,0,200,200,80,80,200,200,b#,bmi#,0,~SRCCOPY)
Waitinput
~GdipDisposeImage(ImageObject1&)
~GdipDeleteGraphics(GraphicObject&)
ExitGDIPlus(gdiplusToken&)
End
|
| | | Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...]  | 05.03.2009 ▲ |
| |
| |  | Nicht ganz. Ich habe im rechten Fenster 2 Bilder versetzt reingesetzt mit GDIPlus in hwin1& Dieses möchte ich auf der linken Seite mit Getdibits usw anzeigen im hwin&.
Schau dir das mal an, ob man das machen kann?
mfg KompilierenMarkierenSeparieren $H windows.ph
$H includes\Functions_GDIPLUS.ph
$H includes\GDIP_Imageging.ph
$I includes\GDIP_Helper.inc
Declare gdiplusToken&,ImageObject&,ImageObject1&,GraphicObject&,Attributes&
Declare Color_Matrix#,hwin&,hwin1&
declare bmi#,b#
declare Handle&,Neu&
gdiplusToken& = InitGDIPlus()
Window 20,20-200,200
cls
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
hWin1& = Create(text, hwin&, Test, 400, 20, 300,300)
ImageObject& = gdipLoadImage(eisbaer.jpg)
~GdipCreateFromHDC(~GetDC(hwin1&),ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,0,0)
~GdipCreateFromHDC(~GetDC(hwin1&),ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,30,30)
Handle des Bismaps
~GdipCreateHBITMAPFromBitmap(ImageObject&,Addr(Handle&),0)
struct bmpHEADER=Size&,Width&,Height&,Planes%,BitCount%,Compression&,SizeImage&,X#(24)
dim bmi#,bmpHEADER
bmi#.Size&=sizeof(bmi#)------------------Größe von BITMAPINFOHEADER
~GetDIBits(%hdc,Handle&,0,0,0,bmi#,0)--Dummy-Aufruf, um bmpHeader zu füllen (Rückgabe: 1=OK)
dim b#,bmi#.SizeImage&-----------------Bereich für Bildinformationen (Pixel) bereitstellen
~GetDIBits(%hdc,Handle&,0,bmi#.Height&,b#,bmi#,0)--Eigendliche Bilddaten aus Handle ermitteln
Neu&=~CreateDIBitmap(%hdc,bmi#,4,b#,bmi#,0)------Neue DIB mit geänderten Farben erzeugen
~StretchDiBits(~Getdc(hwin&),0,0,200,200,0,0,300,300,b#,bmi#,0,~SRCCOPY)
Waitinput
~GdipDisposeImage(ImageObject1&)
~GdipDeleteGraphics(GraphicObject&)
ExitGDIPlus(gdiplusToken&)
End
|
| | | | |
| |  Andreas Miethe
 | Hallo Peter,
also so ? KompilierenMarkierenSeparieren $H windows.ph
$H includes\Functions_GDIPLUS.ph
$H includes\GDIP_Imageging.ph
$I includes\GDIP_Helper.inc
Declare gdiplusToken&,ImageObject&,ImageObject1&,GraphicObject&,Attributes&
Declare Color_Matrix#,hwin&,hwin1&
declare bmi#,b#
declare Handle&,Neu&
gdiplusToken& = InitGDIPlus()
Window 20,20-200,200
cls
hWin& = Create(Window, %hWnd, Test, 250, 20, 650,500)
hWin1& = Create(text, hwin&, Test, 330, 100, 300,300)
ImageObject& = gdipLoadImage(eisbaer.jpg)
Warum 2 mal das Graphic-Object anlegen ?, einmal reicht !
#########################################################
~GdipCreateFromHWND(hwin1&,ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,0,0)
~GdipCreateFromHDC(~GetDC(hwin1&),ADDR(GraphicObject&))
~GdipDrawImageI(GraphicObject&,ImageObject&,30,30)
Temporär-Bimpap anlegen
Var TempDc& = ~CreateCompatibleDC(%hdc)
Handle& = ~CreateCompatibleBitmap(%hdc,width(hWin1&),height(hWin1&))
~SelectObject(TempDC&,Handle&)
Vom Fenster ( hWin1&) ins TempDC und damit ins Temporär-Bitmap
~Bitblt(TempDC&,0,0,width(hWin1&),height(hWin1&),~GetDC(hWin1&),0,0,~SRCCOPY)
Device-Context freigeben
~ReleaseDC(0,TempDC&)
struct bmpHEADER=Size&,Width&,Height&,Planes%,BitCount%,Compression&,SizeImage&,X#(24)
dim bmi#,bmpHEADER
bmi#.Size&=sizeof(bmi#)------------------Größe von BITMAPINFOHEADER
~GetDIBits(%hdc,Handle&,0,0,0,bmi#,0)--Dummy-Aufruf, um bmpHeader zu füllen (Rückgabe: 1=OK)
dim b#,bmi#.SizeImage&-----------------Bereich für Bildinformationen (Pixel) bereitstellen
~GetDIBits(%hdc,Handle&,0,bmi#.Height&,b#,bmi#,0)--Eigendliche Bilddaten aus Handle ermitteln
Neu&=~CreateDIBitmap(%hdc,bmi#,4,b#,bmi#,0)------Neue DIB mit geänderten Farben erzeugen
~StretchDiBits(~Getdc(hwin&),0,0,width(hWin1&),height(hWin1&),0,0,width(hWin1&),height(hWin1&),b#,bmi#,0,~SRCCOPY)
Waitinput
~DeleteDC(TempDC&)
~DeleteObject(Handle&)
~GdipDisposeImage(ImageObject1&)
~GdipDeleteGraphics(GraphicObject&)
ExitGDIPlus(gdiplusToken&)
End
|
| | | Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...]  | 06.03.2009 ▲ |
| |
| |  | Danke. Funktioniert klasse. Kannst man für Bitblt irgendwie ein original Profanbefehl nehmen?
mfg |
| | | | |
| |  Andreas Miethe
 | Da Du ein Bitmap-Handle brauchst für GetDiBits fällt mir im Moment kein passender Befehl ein. |
| | | Gruss Andreas ________ ________ ________ ________ _ Profan 3.3 - XProfanX2 Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher Homepage : [...]  | 06.03.2009 ▲ |
| |
| |  | Ich werde GDIs SelectObject & Co. wohl niemals verstehen... |
| | | | |
|
AntwortenThemenoptionen | 1.854 Betrachtungen |
ThemeninformationenDieses Thema hat 4 Teilnehmer: |