ResizeImage() "beschneidet" anstatt zu resizen.
Verfasst: 23.10.2005 23:33
Ist das ab und zu vorkommende Problem hier und da bekannt?
Inc.
Inc.
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
Procedure DisplayFrame(input_frame.l, input_imagehdl.l)
Structure myBITMAPINFO
bmiHeader.BITMAPINFOHEADER
bmiColors.RGBQUAD[1]
EndStructure
Global bmi.myBITMAPINFO, hBmp, ImgID2 , no
Protected bmi.myBITMAPINFO , input_imagehdl;, hBmp
If source_width
If d2v = #True ;// Displaying a d2v file
bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
bmi\bmiHeader\biWidth = source_width
bmi\bmiHeader\biHeight = -source_height ; Flip the RGB Image vertically!
bmi\bmiHeader\biPlanes = 1
bmi\bmiHeader\biBitCount = 24
bmi\bmiHeader\biCompression = #BI_RGB
*rgb24 = getRGBFrame(input_frame)
If *rgb24
hBmp = UseImage(videobmp)
hdc = StartDrawing(ImageOutput())
SetDIBits_(hdc, hBmp, 0, source_height, *rgb24, bmi, #DIB_RGB_COLORS)
StopDrawing()
SetGadgetState(input_imagehdl.l, hBmp)
Else
MessageRequester("Error!","No d2v RGB Imagedata could be received!",0)
ProcedureReturn #False
EndIf
ElseIf avi = #True ;// Displaying an avi file
*bih.BITMAPINFOHEADER = CallFunction(#Libavi, "AVIStreamGetFrame", pGetFrameObj, input_frame )
If *bih
hBmp = UseImage(videobmp)
hdc = StartDrawing(ImageOutput())
SetDIBits_(hdc, hBmp, 0, source_height, *bih + SizeOf(BITMAPINFOHEADER), *bih, #DIB_RGB_COLORS)
StopDrawing()
If source_width = 1280 Or source_width = 1920
hBmp = ResizeImage(videobmp, 720, 432)
EndIf
SetGadgetState(input_imagehdl.l, hBmp)
Else
MessageRequester("Error!","No avi imagedata could be received!",0)
ProcedureReturn #False
EndIf
EndIf
Else
MessageRequester("Error!","The Videodata in the Source contains NO width!?",0)
ProcedureReturn #False
EndIf
ProcedureReturn #True
EndProcedure