Consulta acerca de TBitmap/Timage/Ximage

Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Tue Jun 11, 2019 4: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
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby nageswaragunupudi » Tue Jun 11, 2019 7:15 pm

XImage.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Tue Jun 11, 2019 8: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: Select all  Expand view  RUN
#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: Select all  Expand view  RUN
// 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
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby nageswaragunupudi » Wed Jun 12, 2019 1:37 am

It works, if we change the rc file like this:
Code: Select all  Expand view  RUN
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: Select all  Expand view  RUN

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: Select all  Expand view  RUN

oImage:FitRect()
 


So, retain the existing behavior of your application, every time XImage is defined, please use this code:
Code: Select all  Expand view  RUN

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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Wed Jun 12, 2019 6: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
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby nageswaragunupudi » Fri Jun 14, 2019 1:49 am

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

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Fri Jun 14, 2019 6:23 am

Very useful, thanks
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby augustogomes » Sat Aug 31, 2019 8: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
User avatar
augustogomes
 
Posts: 23
Joined: Mon Jun 06, 2016 8:38 pm
Location: Ribeirão Preto - SP - Brasil

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Sun Sep 01, 2019 5:43 pm

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby concentra » Wed Jan 08, 2020 1: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: Select all  Expand view  RUN

oImage:FitRect()
 


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

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Wed Jan 08, 2020 1:57 pm

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby concentra » Wed Jan 08, 2020 5:15 pm



Gracias Angel !

Según su ejemplo, escribí un método para la clase TImage:
Code: Select all  Expand view  RUN

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
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby AngelSalom » Thu Jan 09, 2020 8:31 am

Excelente!
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Consulta acerca de TBitmap/Timage/Ximage

Postby karinha » Thu Jan 09, 2020 1:09 pm

Excelente!
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7872
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests