If we paint it into a memory hDC then we will just check if it works or not
Nothing will be seen
Bug in HasAlpha()
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in HasAlpha()
So, why not to make a function HasAlpha( hBmp ) using ABPaint() inside it?
EMG
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in HasAlpha()
Enrico,
Lets check if it works.
I have modified FWH function ABPaint() to return the result of the call to AlphaBlend()
I am emailing you the modified FWH library. I appreciate if you can test it
Lets check if it works.
I have modified FWH function ABPaint() to return the result of the call to AlphaBlend()
Code: Select all
function HasAlpha( hBitmap )
local hDC := CreateDC( "DISPLAY", "", "" )
local lHasAlpha := ABPaint( hDC, 0, 0, hBitmap )
DeleteDC( hDC )
return lHasAlpha
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in HasAlpha()
I get this:
Can you send me the libs for xHarbour, please?
EMG
Code: Select all
Harbour 3.2.0dev (r1605041350)
Copyright (c) 1999-2016, http://harbour-project.org/
Embarcadero C++ 7.20 for Win32 Copyright (c) 1993-2016 Embarcadero Technologies, Inc.
ALPHA.c:
Turbo Incremental Link 6.75 Copyright (c) 1997-2016 Embarcadero Technologies, Inc.
Error: Unresolved external '_pcre_config' referenced from E:\HARBOUR\LIB\HBRTL.LIB|hbregex
Error: Unresolved external '_pcre_stack_malloc' referenced from E:\HARBOUR\LIB\HBRTL.LIB|hbregex
Error: Unresolved external '_pcre_stack_free' referenced from E:\HARBOUR\LIB\HBRTL.LIB|hbregex
Error: Unable to perform link
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Bug in HasAlpha()
Are you linking hbpcre.lib ?
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Bug in HasAlpha()
Function HasAlpha() has never been changed and works the same way it was working all the time.
In the first post in this thread, hBmp is read wth the function GDIP_IMAGEFROMFILE(). This function uses GDI+. This does not require freeimage.dll, but the side-effect is this function converts even jpeg image as an alpha image and returns hBmp which has Alpha. Naturally HasAlpha( hBmp ) returns .T., because this hBitmap has Alpha channel. Even if the alpha channel is added ( 32-bit bitmap instead of 24-bit bitmap) there is no change in the content or rendering when painted with abpaint(). We knew this behavior from the time we started using GDI+.
Code: Select all
cFile := "c:\fwh\bitmaps\olga1.jpg"
hBmp := FILOADIMG( cFile ) // Source of function image.prg. Requires Freeimage.dll
? HasAlpha( hBmp ) // --> .F.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Bug in HasAlpha()
Thank you. This could explain why HasAlpha() is not working fine. Unfortunately there is another problem: images loaded with GDIP_IMAGEFROMFILE() seems to not paint correctly using ABPAINT(), at least with TPrinter's hDCOut.nageswaragunupudi wrote:Function HasAlpha() has never been changed and works the same way it was working all the time.
In the first post in this thread, hBmp is read wth the function GDIP_IMAGEFROMFILE(). This function uses GDI+. This does not require freeimage.dll, but the side-effect is this function converts even jpeg image as an alpha image and returns hBmp which has Alpha. Naturally HasAlpha( hBmp ) returns .T., because this hBitmap has Alpha channel. Even if the alpha channel is added ( 32-bit bitmap instead of 24-bit bitmap) there is no change in the content or rendering when painted with abpaint(). We knew this behavior from the time we started using GDI+.Code: Select all
cFile := "c:\fwh\bitmaps\olga1.jpg" hBmp := FILOADIMG( cFile ) // Source of function image.prg. Requires Freeimage.dll ? HasAlpha( hBmp ) // --> .F.
EMG