FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Antonio - FIMakeThumbNailen timage
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Antonio - FIMakeThumbNailen timage
Posted: Sat Nov 29, 2014 02:14 PM
Antonio, por favor recuerda reincluir en fwh 14.11 FIMakeThumbNail, ya que desde hace unos meses no esta incluido en el source de timage.prg

de wathsnew.txt
* New: function FIMakeThumbNail( cSrcFile, cDstFile, nPixel ) --> lOk thanks to
Carlos Vargas:

viewtopic.php?p=155418#p155418
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Sat Nov 29, 2014 03:21 PM

Carlos,

incluido, muchas gracias! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Wed Dec 03, 2014 08:36 PM

Respecto a esto tengo una buena noticia ...para eso no necesitamos FreeImage , por lo menos en 32bits....

en gdiplus.cpp :

HB_FUNC( GDIPLUSIMAGECREATETHUMB )
{
Bitmap * newImage = ( Bitmap * ) hb_parnl( 1 );
int nWidth = hb_parni( 2 );
int nHeight = hb_parni( 3 );
Image * hThumb = newImage->GetThumbnailImage( nWidth , nHeight, NULL, NULL );
hb_retnl( ( HB_LONG ) hThumb );
}

en Tgdiplus.prg :

METHOD CreateThumbnail( nWidth, nHeight ) CLASS GDIBmp
local oThumb:= gdiBmp():new()
local hImage := GdiPlusImageCreateThumb( ::hbmp, nWidth, nHeight )
oThumb:hBmp := hImage
Return oThumb

Function GDIPlusSaveThumbnail( cImageIni, cImageEnd , nWhidth, nHeight )

local cExtIni := Upper(cFileExt( cImageIni ))
local oImage:= GDIBmp():New( cImageIni )
local oThumb
local nScan
if( nScan:= aScan( oImage:aExtIni, cExtIni )) == 0
Msginfo( " el archivo "+ cImageIni + " tiene un formato no soportado")
return .f.
endif

oThumb:= oImage:CreateThumbmail( nWhidth, nHeight )
oThumb:Save( cImageEnd )

oImage:Destroy()
oThumb:Destroy()

return nil

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Thu Dec 04, 2014 06:21 AM
mastintin wrote:Respecto a esto tengo una buena noticia ...para eso no necesitamos FreeImage , por lo menos en 32bits....

en gdiplus.cpp :

HB_FUNC( GDIPLUSIMAGECREATETHUMB )
{
Bitmap * newImage = ( Bitmap * ) hb_parnl( 1 );
int nWidth = hb_parni( 2 );
int nHeight = hb_parni( 3 );
Image * hThumb = newImage->GetThumbnailImage( nWidth , nHeight, NULL, NULL );
hb_retnl( ( HB_LONG ) hThumb );
}

en Tgdiplus.prg :

METHOD CreateThumbnail( nWidth, nHeight ) CLASS GDIBmp
local oThumb:= gdiBmp():new()
local hImage := GdiPlusImageCreateThumb( ::hbmp, nWidth, nHeight )
oThumb:hBmp := hImage
Return oThumb


Function GDIPlusSaveThumbnail( cImageIni, cImageEnd , nWhidth, nHeight )

local cExtIni := Upper(cFileExt( cImageIni ))
local oImage:= GDIBmp():New( cImageIni )
local oThumb
local nScan
if( nScan:= aScan( oImage:aExtIni, cExtIni )) == 0
Msginfo( " el archivo "+ cImageIni + " tiene un formato no soportado")
return .f.
endif

oThumb:= oImage:CreateThumbmail( nWhidth, nHeight )
oThumb:Save( cImageEnd )

oImage:Destroy()
oThumb:Destroy()

return nil


Manuel, quiz谩s esta funcion deber铆a quedar algo asi, porque si no en un caso devuelve un valor l贸gico y por otro nil :-)

Code (fw): Select all Collapse
Function GDIPlusSaveThumbnail( cImageIni, cImageEnd , nWhidth, nHeight )
local lSw     := .T.
local cExtIni := Upper(cFileExt( cImageIni ))
local oImage:= GDIBmp():New( cImageIni )
local oThumb
local nScan
 if( nScan:= aScan( oImage:aExtIni, cExtIni )) == 0 

    Msginfo( " el archivo "+ cImageIni + " tiene un formato no soportado") 
    //return .f.
    lSw  := .F.
 else

 oThumb:= oImage:CreateThumbmail( nWhidth, nHeight )
 oThumb:Save( cImageEnd )
 oImage:Destroy()
 oThumb:Destroy()

 endif 

return lSw
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Thu Dec 04, 2014 07:45 AM

Cristobal , tienes raz贸n , ya lo he cambiado en mi c贸digo . Gracias por el apunte.

Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Thu Dec 04, 2014 07:52 AM

Ahora falta conseguir que funcione la creacion de bitmaps gdi+ desde stream que abre muchas posibilidades ya que permitir铆a cargar Imagenes gdi+ desde una url y desde recursos y luego pasarlos a bmps gdi pero mi c++ no da para ello :( .Guardar imagenes png en recursos en vez bmps de 32bits y usarlos como si fueran bmps normales sin usar freeImage seria estupendo.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Antonio - FIMakeThumbNailen timage
Posted: Thu Dec 04, 2014 08:51 AM

Manuel,

Si publicas el c贸digo actualizado lo voy actualizando en FWH :-)

C++ ? Tu puedes con eso y mucho m谩s ;-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion