TXImage from resources

TXImage from resources

Postby Enrico Maria Giordano » Fri Oct 23, 2015 9:54 am

I noticed that there are not Redefine() method in TXImage so we cannot replace TImage with TXImage yet. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8328
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TXImage from resources

Postby Enrico Maria Giordano » Fri Oct 23, 2015 12:36 pm

I've tried to replace FILOADIMAGE() with GDIP_IMAGEFROMFILE() in TImage. It works but the image I get has a very bad quality (with FILOADIMAGE() the quality was very good).

Any ideas?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8328
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TXImage from resources

Postby mastintin » Sat Oct 24, 2015 5:56 am

Enrico , use WndReadPalBmpEx( Self, uBmp, aReSize ) -> aBmp // format: { hBitmap, hPalette, nBmpWidth, nBmpHeight, lAlpha, cName, lResource }
This function is in btnbmp.prg for substitution in test .
In my tests gdi+ it gives equal and often better quality than freeimage ( especially with png ) .
You can put a self-contained example where you see the lack of quality (with an Image which can access) and see how we can fix it,
I have some files and tgdiplus.prg gdiplis.cpp with more features and modifications as the original if you need to send them a private message.
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm

Re: TXImage from resources

Postby Enrico Maria Giordano » Sat Oct 24, 2015 9:53 am

The problem might come from the lack of resize in my code. With FreeImage we don't need to resize the image. I'll experiment further and report back, thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8328
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TXImage from resources

Postby Enrico Maria Giordano » Sat Oct 24, 2015 12:36 pm

Solved, it was my fault. Now it's ok, thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8328
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TXImage from resources

Postby mastintin » Sat Oct 24, 2015 1:01 pm

all right :D .
To resize, I prefer to do it from GDI +, the result is better.
Now in fwh the image is collected and returned your HBITMAP and resize with classics functions.
It is better to collect GDI + image, GDI + resize and return HBITMAP from resized image
Code: Select all  Expand view

function resizeImage( cFile ,nWith, nHeight)
local hbitmap
local ogdi:=gdibmp():new(  cFile  )
      ogdi:resize(  nWith, nHeight )
      hbitmap := ogdi:GetGDIHbitmap()
      ogdi:end()
return hbitmap

 
User avatar
mastintin
 
Posts: 1516
Joined: Thu May 27, 2010 2:06 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests

cron