Antonio,
how can we paint faster an alpha-channel image with resize?
EMG
Antonio Linares wrote:FWH function ABPaint() just calls Windows API function AlphaBlend()
SetStretchBltMode (hdcDest, COLORONCOLOR);
STATIC FUNCTION DRAWIMG( cFile, hDC, nWidth, nHeight, lImg )
LOCAL hImg := LoadresizedImage( cFile ,nWith, nHeight)
// LOCAL hImg2
// IF lImg
// hImg2 = RESIZEIMG( hImg, nWidth, nHeight )
// ELSE
// hImg2 = RESIZEBMP( hImg, nWidth, nHeight )
// ENDIF
ABPAINT( hDC, 0, 0, hImg, 255 )
// DELETEOBJECT( hImg2 )
DELETEOBJECT( hImg )
RETURN NIL
function LoadresizedImage( cFile ,nWith, nHeight)
local hbitmap
local ogdi:=gdibmp():new( cFile )
ogdi:resize( nWith, nHeight )
hbitmap := ogdi:GetGDIHbitmap()
ogdi:end()
return hbitmap
STATIC FUNCTION DRAWIMG( cFile, hDC, nWidth, nHeight, lImg )
LOCAL hgdiImg := GdiPlusImageLoadCachedFile( cFile )
LOCAL gdinewhBmp := GdiPlusImageResize(hgdiImg , nWidth, nHeight )
LOCAL hImg2 := GdiPlusCreateHBitmapImage( gdinewhBmp )
ABPAINT( hDC, 0, 0, hImg2, 255 )
DELETEOBJECT( hImg2 )
GdiPlusImageDispose( gdinewhBmp )
gdinewhBmp = nil
RETURN NIL
mastintin wrote:If you go to call gdi + pictures, you redimensionaleas also from GDI + ...
Antonio Linares wrote:Enrico,
I already sent you function ABPaint() source code by email
Function GdiResizeImage( hImg , nwidth, nHeight)
local hGdiBmp:= GdiPlusCreateImageFrom32hBitmap( hImg )
LOCAL gdinewhBmp := GdiPlusImageResize(hgdibmp, nWidth, nHeight )
LOCAL hImg2 := GdiPlusCreateHBitmapImage( gdinewhBmp )
GdiPlusImageDispose( hGdiBmp )
GdiPlusImageDispose( gdinewhBmp )
Return hImg2
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 14 guests