Drawing on a TImage and save [Solved]

Re: Drawing on a TImage and save [Solved]

Postby Enrico Maria Giordano » Wed Apr 02, 2014 5:41 pm

Cristobal,

Code: Select all  Expand view  RUN
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
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 5: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
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 5:51 pm

Cristobal,

if the problem is inside CaptureAnImage() then there is nothing that I can do to help you, 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 Enrico Maria Giordano » Wed Apr 02, 2014 6:00 pm

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

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 6:58 pm

Enrico
Code: Select all  Expand view  RUN

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

@ 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
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 9: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
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 10:58 pm

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
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 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
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 » Thu Apr 03, 2014 8: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: Select all  Expand view  RUN

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Drawing on a TImage and save [Solved]

Postby cnavarro » Thu Apr 03, 2014 5: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: Select all  Expand view  RUN

lAnd( oImg:nStyle, WS_BORDER )
 


Code: Select all  Expand view  RUN

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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Drawing on a TImage and save

Postby Enrico Maria Giordano » Thu Apr 03, 2014 6: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
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 csincuir » 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: Select all  Expand view  RUN

@ 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
csincuir
 
Posts: 408
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala

Re: Drawing on a TImage and save [Solved]

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests