Consulta acerca de TBitmap/Timage/Ximage

Post Reply
User avatar
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

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
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by nageswaragunupudi »

XImage.
Regards

G. N. Rao.
Hyderabad, India
User avatar
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

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

#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

// 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
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by nageswaragunupudi »

It works, if we change the rc file like this:

Code: Select all

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

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

oImage:FitRect()
 
So, retain the existing behavior of your application, every time XImage is defined, please use this code:

Code: Select all

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
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

Thanks Mr. Rao, now it works perfectly.
It's a really impressive job, thank you.
Angel Salom
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by nageswaragunupudi »

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

http://forums.fivetechsupport.com/viewt ... er#p222736
Regards

G. N. Rao.
Hyderabad, India
User avatar
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

Very useful, thanks
Angel Salom
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
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

Post by augustogomes »

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
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

Angel Salom
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by concentra »

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

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

[[]] Maurício Faria
User avatar
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

Angel Salom
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by concentra »


Gracias Angel !

Según su ejemplo, escribí un método para la clase TImage:

Code: Select all

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
AngelSalom
Posts: 664
Joined: Fri Oct 07, 2005 7:38 am
Location: Vinaros (Castellón ) - España
Contact:

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by AngelSalom »

Excelente!
Angel Salom
http://www.visionwin.com
---------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.0
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Consulta acerca de TBitmap/Timage/Ximage

Post by karinha »

Excelente!
João Santos - São Paulo - Brasil
Post Reply