Drawing on a TImage and save [Solved]

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

Re: Drawing on a TImage and save [Solved]

Post by Enrico Maria Giordano »

Cristobal,

Code: Select all

Error E2140 imagen2.prg 162: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 226: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 227: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 241: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 246: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 247: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 257: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 265: Declaration is not allowed here in function CaptureAnImage
Error E2140 imagen2.prg 276: Declaration is not allowed here in function CaptureAnImage
Please take my working sample and modify it to show the problem.

EMG
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include > b32.bc
echo %1.c >> b32.bc
%bcdir%\bin\bcc32 -M -c -O2 -P @b32.bc
Add option -P and try
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Drawing on a TImage and save [Solved]

Post by Enrico Maria Giordano »

Cristobal,

if the problem is inside CaptureAnImage() then there is nothing that I can do to help you, sorry.

EMG
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

Enrico

Code: Select all

@ 15, 5 IMAGE oImg PIXEL NOBORDER FILE "EAGLE.JPG" OF oDlg
 
If this line add the clause NOBORDER you will see that now the two images FW and C, yes you are the same (identical)

Si en esta linea añades la claúsula NOBORDER comprobarás que ahora las dos imágenes FW y C, sí son iguales (idénticas)
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

Enrico Maria Giordano wrote: if the problem is inside CaptureAnImage() then there is nothing that I can do to help you, sorry.
EMG
I think the problem is not routine in C
Creo que el problema no es de la rutina en C
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Drawing on a TImage and save [Solved]

Post by ukoenig »

Cristobal,

I don't use any capturing !!!

I would like to change the image-border at runtime.
From class TBitmap I use :nStyle, because there is no method
in class TImage like oImage:lBorder := .F.

Code: Select all

@ 55, 430 COMBOBOX oCbx1 VAR cImgBorder  ITEMS { "Border", "NO border" } ;
SIZE 50, 50 OF oSDlg  PIXEL FONT oFont1 ;
ON CHANGE ( IIF( oCbx1:nAt = 1, ( cImgBorder := "Border", lNoBorder := .F. ), ;
          ( cImgBorder := "NO border", lNoBorder := .T. ) ), ;
          oDrawImg:nStyle := nOR( If( ! lNoBorder, WS_BORDER, 0 ) ), ;
          oDrawImg:Refresh() )
 
Added BORDER / NOBORDER ( combobox to switch BORDER / NOBORDER )

tested export to different formats
Exported to PNG

Image

but doesn't work.
Any idea ?

Best regards
Uwe :?:
Last edited by ukoenig on Wed Apr 02, 2014 10:56 pm, edited 1 time 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
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

ukoenig wrote:Cristobal,

I don't use any capturing !!!

I would like to change the image-border at runtime.
From class TBitmap I use :nStyle, because there is no method
in class TImage like oImage:lBorder := .F.


but doesn't work.
Any idea ?

Best regards
Uwe :?:
Uwe,
He probado de varias formas y no funciona tampoco :( :(
Sigo investigando

I have tried several ways and does not work either
I keep researching
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Drawing on a TImage and save [Solved]

Post by ukoenig »

Christobal,

I finished testing !!! :roll:

Now any combination between Pensize, Color, freehand and line-size is possible.
Maybe a boxpainting is still needed ?
To make it 100 % complete, a Image-border-switch ON / OFF would be nice.
Otherwise it must be defined inside the prg.

Image

The comboboxes

Image

Best regards
Uwe :lol:
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
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

Uwe, thanks
It is a fantastic job
You can download it?
I will continue investigating the Border control, although it is not the most important.
If it is important to check that the image size is the same as the initial size of the image to save the image after being modified in the two possible cases. 1 - The image has a turnover or 2 - The image has no border.

Uwe, gracias
Es un fantástico trabajo
Se puede descargar?
Yo seguiré investigando lo del border del control, aunque no es lo más importante.
Si es importante comprobar que el tamaño de la imagen es el mismo que el tamaño inicial de la imagen al guardar la imagen despues de ser modificada en los dos posibles casos: 1.- La imagen tiene borde ó 2.- La imagen no tiene borde
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Drawing on a TImage and save [Solved]

Post by ukoenig »

Christobal,

I got it working changing the Image-border at runtime, using a C_FUNCTION.
Maybe later, we will still find another solution.

Code: Select all

IF lNoBorder = .T. // from INI
     @ 1, 1 IMAGE oDrawImg FILENAME NIL OF oSDlg ;
     SIZE 100, 100 PIXEL NOBORDER // any size, it will be adjusted
     oDrawImg:bPainted := { |hDC| GET_IMGSIZE(cWorkfile), ; // original size for RESIZING
     DRAW_IMAGE( hDC ) }
     oDrawImg:cTooltip := "selected Image"
ELSE
     @ 1, 1 IMAGE oDrawImg FILENAME NIL OF oSDlg ;
     SIZE 100, 100 PIXEL BORDER // any size, it will be adjusted
     oDrawImg:bPainted := { |hDC| GET_IMGSIZE(cWorkfile), ; // original size for RESIZING
     DRAW_IMAGE( hDC ) }
     oDrawImg:cTooltip := "selected Image"
ENDIF

....
....

IF lNoBorder = .F.
   cImgBorder := "Border"
ELSE
   cImgBorder := "NO border"
ENDIF

@ 55, 430 COMBOBOX oCbx1 VAR cImgBorder  ITEMS { "Border", "NO border" } ;
SIZE 50, 50 OF oSDlg  PIXEL FONT oFont1 ;
ON CHANGE ( IIF( oCbx1:nAt = 1, ( cImgBorder := "Border", lNoBorder := .F. ), ;
( cImgBorder := "NO border", lNoBorder := .T. ) ), ;
SAVE_INI(), oSDlg:End(), ; // SAVES the status to INI and RESTARTS
WINEXEC( "RESTART DRAW.exe " + Str( oSDlg:hWnd ), 0 ) ) // AUTO-restart with a C-FUNCTION !

 
Best regards
Uwe :lol:
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
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save [Solved]

Post by cnavarro »

Con esta function podemos saber si un control tiene BORDER, o cualquier otro estilo

With this function we can know if a control has BORDER, or any other style

Code: Select all

lAnd( oImg:nStyle, WS_BORDER )
 

Code: Select all

if  ExistStyle( oImg, WS_BORDER )
.../...

Function ExistStyle( oCtrl, nEstilo )
Return lAnd( oCtrl:nStyle, nEstilo )
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Drawing on a TImage and save

Post by Enrico Maria Giordano »

Dear friends, I removed [Solved] mark as this problem is not solved yet. :-(

Please, look at my early sample: that's my problem. :-)

EMG
csincuir
Posts: 305
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Contact:

Re: Drawing on a TImage and save [Solved]

Post by csincuir »

ukoenig wrote:Cristobal,

I don't use any capturing !!!

I would like to change the image-border at runtime.
From class TBitmap I use :nStyle, because there is no method
in class TImage like oImage:lBorder := .F.

Code: Select all

@ 55, 430 COMBOBOX oCbx1 VAR cImgBorder  ITEMS { "Border", "NO border" } ;
SIZE 50, 50 OF oSDlg  PIXEL FONT oFont1 ;
ON CHANGE ( IIF( oCbx1:nAt = 1, ( cImgBorder := "Border", lNoBorder := .F. ), ;
          ( cImgBorder := "NO border", lNoBorder := .T. ) ), ;
          oDrawImg:nStyle := nOR( If( ! lNoBorder, WS_BORDER, 0 ) ), ;
          oDrawImg:Refresh() )
 
Added BORDER / NOBORDER ( combobox to switch BORDER / NOBORDER )

tested export to different formats
Exported to PNG

Image

but doesn't work.
Any idea ?

Best regards
Uwe :?:
Hi Uwe, I wanted to ask you if you finished your work for drawing on an image and save the result? You will have an example of how to do, is that I need to make modifications with lines to an image and then save it

Best regards.

Carlos
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Drawing on a TImage and save [Solved]

Post by ukoenig »

Carlos,

can You show a image-sample or explain what You are trying to do.
I need to make modifications with lines to an image and then save it
As well I need Your FWH-release.
During the years we have better solutions for painting on images
like using GDIPLUS.

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.
Post Reply