FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Drawing on a TImage and save [Solved]
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 05:41 PM
Cristobal,

Code (fw): Select all Collapse
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 05:47 PM

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
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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 05:51 PM

Cristobal,

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

EMG

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 06:00 PM

Wait! I think I saw the problem. I'll try to fix it.

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 06:58 PM
Enrico
Code (fw): Select all Collapse
@ 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)
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 07:14 PM
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
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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 07:30 PM
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 (fw): Select all Collapse
@ 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



but doesn't work.
Any idea ?

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.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 09:09 PM
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
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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 10:58 PM
Christobal,

I finished testing !!! :-)

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.



The comboboxes



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.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Wed Apr 02, 2014 11:35 PM

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

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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Drawing on a TImage and save [Solved]
Posted: Thu Apr 03, 2014 08:35 AM
Christobal,

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

Code (fw): Select all Collapse
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 :-)
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.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Drawing on a TImage and save [Solved]
Posted: Thu Apr 03, 2014 05:40 PM
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 (fw): Select all Collapse
lAnd( oImg:nStyle, WS_BORDER )


Code (fw): Select all Collapse
if  ExistStyle( oImg, WS_BORDER )
.../...

Function ExistStyle( oCtrl, nEstilo )
Return lAnd( oCtrl:nStyle, nEstilo )
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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Drawing on a TImage and save
Posted: Thu Apr 03, 2014 06:00 PM

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

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

EMG

Posts: 476
Joined: Sat Feb 03, 2007 06:36 AM
Re: Drawing on a TImage and save [Solved]
Posted: Fri Sep 20, 2019 11:21 AM
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 (fw): Select all Collapse
@ 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



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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Drawing on a TImage and save [Solved]
Posted: Fri Sep 20, 2019 12:54 PM
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.