Drawing on a TImage and save [Solved]

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 10:34 am

Cristobal,

sorry, I still don't understand your problem. :-(

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

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 10:48 am

Enrico

Puedes ver otra vez los enlaces de mi post anterior?
Estan actualizadas
Disculpa mi ingles

You can see again the links of my previous post?
are updated
Sorry for my English
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 11:13 am

Cristobal,

what I understood is that you want to resize the TImage control so it gets the same size of the image, right? Now, can you build a little sample showing the exact problem?

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

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 11:53 am


En el ejemplo inicial que tu has puesto y en los que yo he añadido el tamaño del control no coincide con el tamaño de la imagen que se quiere mostrar
Yo puedo hacer que el tamaño del control sea igual al tamaño de la imagen si en el ON INIT del DIALOG añado el oImage:SetSize( .... ), pero el control deberia dibujarse con el mismo tamaño que la imagen que quieres cargar.

yes
In the initial example that you have set and in which I added the size of the control does not match the size of the image to be shown
I can make the size of the check is equal to the size of the image if the ON INIT of DIALOG add the oImage: SetSize (....), but the control should be drawn with the same size as the image you want to upload.
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby ukoenig » Wed Apr 02, 2014 12:00 pm

Cristobal,

this solution is included : a preview of the exported image.
I'm showing a little 3D-effect at the imageborder, but it can be flat.
Like You can see, it is the same size, embedded inside the dialog.

I got extended test as well, in case You want to show ALPABLENDED bmp's

Image

Code: Select all  Expand view  RUN

STATIC FUNCTION SHOW_IMGAGE(oDlg, cDestFile)
LOCAL oDlg1, oTest, nImgWidth, nImgHeight

DEFINE IMAGE oTest FILENAME c_Path1 + cDestFile

// needed for dialog-size
nImgWidth := oTest:nWidth
nImgHeight := oTest:nHeight

// is used, to make it possible, to show a image RESIZED
oBrush := TBrush():new( ,,,, ResizeBmp( oTest:hBitmap, nImgWidth, nImgHeight, .T. ) )
oTest:End()

DEFINE DIALOG oDlg1 TITLE "EXPORT-IMAGE" FROM 0, 0 TO nImgHeight, nImgWidth PIXEL

ACTIVATE DIALOG oDlg1 CENTER ;
ON INIT oDlg1:SetBrush( oBrush )

oBrush:End()

RETURN( NIL )
 


Best regards
Uwe :?:
Last edited by ukoenig on Wed Apr 02, 2014 8:08 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 12:22 pm

Cristobal,

cnavarro wrote:but the control should be drawn with the same size as the image you want to upload.


So do you want an AUTORESIZE clause for TImage (or sort of)? If yes, you have to ask to Antonio, sorry.

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

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 12:45 pm

Thanks for your interest
AUTORESIZE clause?
Well, it may be, I want to load an image of 150x100, for example, and the control that contains it also has the size 150x100, nothing more.

Gracias por tu interes
Claúsula AUTORESIZE?
Bien, puede ser, yo quiero cargar una imagen de 150x100, por ejemplo, y que el control que lo contiene tenga también ese tamaño 150x100, nada mas.
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 2:34 pm

Cristobal,

cnavarro wrote:Thanks for your interest
AUTORESIZE clause?
Well, it may be, I want to load an image of 150x100, for example, and the control that contains it also has the size 150x100, nothing more.


And please, why can't you use SetSize()? I still don't understand, I'm very sorry... :-(

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

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 2:46 pm

Enrico
Sure I'll use SetSize, I was just researching and asking if anyone knew that the monitoring was twice the size of the image, or was I knew not use the IMAGE command.
And also, by investigating the size of the image you get in C has 4 pixels less in width and height than that obtained in FWH
Thanks again

Claro que voy a usar SetSize, solo estaba investigando y preguntando si alguien sabia por que el control era doble de tamaño que la imagen, o era que yo no sabia usar el comando IMAGE.
Y tambien, investigaba por que el tamaño de la imagen que obtengo en C tiene 4 pixeles menos en ancho y alto que la que se obtiene en FWH
Gracias otra vez
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 2:52 pm

Cristobal,

cnavarro wrote:Enrico
Sure I'll use SetSize, I was just researching and asking if anyone knew that the monitoring was twice the size of the image, or was I knew not use the IMAGE command.


I already answered: TImage, as any other control, doesn't automatically resize to its content.

cnavarro wrote:And also, by investigating the size of the image you get in C has 4 pixels less in width and height than that obtained in FWH


I can't replicate this behavior, sorry. Can you show me a little sample?

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

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 3:17 pm

Enrico Maria Giordano wrote:Cristobal,

I already answered: TImage, as any other control, doesn't automatically resize to its content.

EMG


I already knew
But catches my attention that if we give the file to display, and the classe it calculates the size of the image before drawing the control, do not you draw with these dimensions
In other cases I have always understood that it was more complicated to adapt the size of the control to its content.
It's just curiosity.
Prepare an example you can compile

Eso ya lo sabia
Pero me llama la atencion que si le damos el fichero a mostrar, y en la classe él calcula el tamaño de la imagen antes de dibujar el control, por qué no lo dibujaba con esas dimensiones
En otros casos siempre he entendido que era mas complicado adaptar las dimensiones del control a su contenido.
Solo es curiosidad.
Preparo un ejemplo que puedas compilar
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 3:20 pm

ukoenig wrote:Cristobal,

this solution is included : a preview of the exported image.
I'm showing a little 3D-effect at the imageborder, but it can be flat.
Like You can see, it is the same size, embedded inside the dialog.

I got extended test as well, in case You want to show ALPABLENDED bmp's

Best regards
Uwe :?:


Uwe
thanks
I think the edge of the image, may be the problem I have

Uwe
Gracias
Creo que el borde de la imagen, puede ser el problema que tengo
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 3:27 pm

Cristobal,

cnavarro wrote:Prepare an example you can compile


Thank you, I'm curious now. :-)

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

Re: Drawing on a TImage and save [Solved]

Postby ukoenig » Wed Apr 02, 2014 4:27 pm

Cristobal,

1. the image was captured with BORDER
2. You can paint and capture without border
3. or You can adjust the dialog

the screenshot shows a captured image with border and dialog adjusted ( covering the border of the EXPORT-image.
I changed this line inside the posted function, to cover the border of the captured image :

DEFINE DIALOG oDlg1 TITLE "EXPORT-IMAGE" FROM 0, 0 TO nImgHeight - 5 , nImgWidth - 5 PIXEL

( Added some more options )

Image

Best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Wed Apr 02, 2014 5:34 pm

Enrico, Uwe
https://www.dropbox.com/s/08ktrtffzgl1fsx/IMAGEN2.zip

Esta preparado para compilar con Borland o con VS2012

This ready to compile with Borland or VS2012

Mira el fichero TImage2.png
https://www.dropbox.com/s/6607scps9ns3hf7/Timage2.png
View TImage2.png file

Ejecutas Imagen2.exe
Pulsa Draw
Pulsa Save Fw -> ( crea ImageFw.jpg )
Pulsa C -> ( crea ImageC.bmp )
Pulsa Exit

Abre los ficheros ImageFw.jpg e ImageC.bmp y comprueba las imágenes y los tamaños

Run Imagen2.exe
Click Draw
Click Save Fw ->(create ImageFw.jpg)
Press C ->(create ImageC.bmp)
Click Exit

Open ImageFw.jpg ImageC.bmp files and check the images and sizes
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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 29 guests

cron