FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Consulta acerca de TBitmap/Timage/Ximage
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Consulta acerca de TBitmap/Timage/Ximage
Posted: Tue Jun 11, 2019 04:24 PM

Hola amigos, acabo de actualizar a fwh 19.05 y estoy tratando de decidir cual es la mejor forma de mostrar imágenes en los diálogos.
Actualmente trabajo con una variante de tImage (tZoomImage) adaptada por Jaime Irurzun y que consigue ajustar la imagen de forma proporcional.
He probado la clase tImage en la versión actual y sigue sin ajustar de forma proporcional la imagen.
La pregunta es, ¿sigo usando tZoomimage o hay alguna clase (he visto xImage) propia de FW que ajuste de forma proporcional las imagenes?

Gracias!

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Tue Jun 11, 2019 07:15 PM

XImage.

Regards



G. N. Rao.

Hyderabad, India
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Tue Jun 11, 2019 08:36 PM
Gracias, primer problema (o desconocimiento) con xImage.
Cuando se crea desde recurso no hace caso a las llamadas a bRClicked o bLClicked (ni tan sólo muestra su propio menú pop).
Code (fw): Select all Collapse
#include "fivewin.ch"

//----------------------------------------------------------------------------//

function Main()

   Local oDlg, oImage

   // Funciona bien
   DEFINE DIALOG oDlg FROM 0,0 TO 40,40 
   @ 0,0 XIMAGE oImage FILE "image.jpg" SIZE 0,0 OF oDlg
   oImage:bRClicked:={|| MsgInfo ('Hola')}
   ACTIVATE DIALOG oDlg CENTERED
   
  // No funciona el menú ni evalua mi bRClicked si lo defino
   DEFINE DIALOG oDlg RESOURCE "Dialogo" 
   REDEFINE XIMAGE oImage ID 4001 OF oDlg FILE "image.jpg"
   oImage:bRClicked:={|| MsgInfo ('Hola')}
   ACTIVATE DIALOG oDlg CENTERED 

return nil

//----------------------------------------------------------------------------//


El fichero rc
Code (fw): Select all Collapse
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 9.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

DIALOGO DIALOG DISCARDABLE 0, 0, 567, 274
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
  CONTROL "", 4001, "Static", SS_BITMAP|SS_CENTERIMAGE|WS_BORDER, 0, 1, 567, 232
}
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Wed Jun 12, 2019 01:37 AM
It works, if we change the rc file like this:
Code (fw): Select all Collapse
FONT 8 , "MS Sans Serif"
{
  CONTROL "", 4001, "TXImage", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 0, 0, 567, 232

}


With XImage, by default, the user can move the image by mouse-drag, zoom and unzoom with mouse-scroll (or by pinch and zoom on a touch screen) and also rotate the image by shift-mouse scroll (by fingers on a touch screen). I presume you do not want to let the user disturb the image. To disable these features you need to use:
Code (fw): Select all Collapse
oImage:nUserControl := 0


If the image is smaller than the size of the control, the image is centered. If the image is larger than the control size, the image is reduced to fit the size of the control. If you wan the image to fit whether the image is smaller or larger please use
Code (fw): Select all Collapse
oImage:FitRect()


So, retain the existing behavior of your application, every time XImage is defined, please use this code:
Code (fw): Select all Collapse
oImage:nUserControl := 0
oImage:FitRect()


Note: XImage always retains the proportions when zoomed or unzoomed.

With XImage, you can use jpg, png, ico, tiff, emf files without freeimage.dll.
You can remove freeimage.dll, if you are using now.
Regards



G. N. Rao.

Hyderabad, India
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Wed Jun 12, 2019 06:16 AM

Thanks Mr. Rao, now it works perfectly.
It's a really impressive job, thank you.

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Fri Jun 14, 2019 01:49 AM

Please see this post to see the copy/paste capabilities of ximage.

viewtopic.php?f=3t=36313p=222736hilit=if+you+want+the+user#p222736

&&&

Regards



G. N. Rao.

Hyderabad, India
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Fri Jun 14, 2019 06:23 AM

Very useful, thanks

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 23
Joined: Mon Jun 06, 2016 08:38 PM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Sat Aug 31, 2019 08:59 PM

Hello people

Do you know how to use ximage with Pelles C? What feature would you use?
I tried with the bitmap feature and it gets static, doesn't work ximage features

thankful
Augusto

Olá Pessoal

Vocês sabem como usar o ximage com Pelles C ? Qual recurso usaria?
Tentei com o recurso bitmap e ele fica statico, não funciona os recurso da ximage

Grato
Augusto

Augusto Gomes /Suprisystem Informática - Fivewin 16.08 - xharbour 123 - BCC70 - DBFNTX e PostGreSql
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Sun Sep 01, 2019 05:43 PM
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Wed Jan 08, 2020 01:44 PM
nageswaragunupudi wrote:
If the image is smaller than the size of the control, the image is centered. If the image is larger than the control size, the image is reduced to fit the size of the control. If you wan the image to fit whether the image is smaller or larger please use
Code (fw): Select all Collapse
oImage:FitRect()


Hi.
Is there an easy way to auto fit a TImage ( not a TXImage )?

[[]] Maurício Faria
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Wed Jan 08, 2020 01:57 PM
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Wed Jan 08, 2020 05:15 PM
AngelSalom wrote:http://forums.fivetechsupport.com/viewtopic.php?f=6&t=23229&p=124637&hilit=tzoomimage#p124637


Gracias Angel !

Según su ejemplo, escribí un método para la clase TImage:
Code (fw): Select all Collapse
method FitRect() CLASS TImage

   local nW_Bmp := nBmpWidth( ::hBitmap )
   local nH_Bmp := nBmpHeight( ::hBitmap )
   local aRect  := GetClientRect( ::hWnd )
   local nW_Wnd := aRect[4] - aRect[2]
   local nH_Wnd := aRect[3] - aRect[1]
   local nZoom 

   nZoom := ( nW_Wnd / nW_Bmp )
   if ( nH_Wnd / nH_Bmp ) < nZoom
      nZoom := ( nH_Wnd / nH_Bmp )
   endif

   ::Zoom( nZoom )
   ::Refresh()
   ::ScrollAdjust()

return nil


[[]] Maurício Faria
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Thu Jan 09, 2020 08:31 AM

Excelente!

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Consulta acerca de TBitmap/Timage/Ximage
Posted: Thu Jan 09, 2020 01:09 PM

Excelente!

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion