Uwe,
How do you do to draw lines or free hand, over the image?
Dou you have some examples?
Best regards.
Carlos.
Uwe,
How do you do to draw lines or free hand, over the image?
Dou you have some examples?
Best regards.
Carlos.
@ 15, 5 IMAGE oImg PIXEL FILE "EAGLE.JPG" OF oDlg //ADJUSTcnavarro wrote:Cómo hacer que el tamaño del control se adapte al tamaño de la imagen a mostrar
oImg:SetSize( oImg:nWidth(), oImg:nHeight() )
Enrico [write]
Thank you. Unfortunately, the image is out of alignment (ie. is slightly shifted)
Cristobal,
can you show me a little sample of the problem?
EMG
FUNCTION MAIN()
  Local oDlg
  Local oImg
  Local nOpt
  Local oFont
 Â
  DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0, -12
  DEFINE DIALOG oDlg SIZE 610, 410 ;
  COLOR CLR_WHITE, RGB(  51, 51, 51 )// ;
           //SIZE 150, 100 PIXEL Â
  @ 15, 5 IMAGE oImg PIXEL FILE "EAGLE.JPG" OF oDlg //ADJUST
  @ 168, 5 FLATBTN PROMPT "Draw " SIZE 40, 20 ;
  COLOR RGB(  51, 51, 51 ), CLR_WHITE ;
  FONT oFont //ACTION ( DrawImg( oImg ) )
     Â
  @ 168, 55 FLATBTN PROMPT "Save FW" SIZE 40, 20 ;
  COLOR RGB(  51, 51, 51 ), CLR_WHITE ;  Â
  FONT oFont //ACTION oImg:SaveImage( "IMGENFW.JPG", 2 )
  @ 168, 105 FLATBTN PROMPT "Save C" SIZE 40, 20 ;
  COLOR RGB(  51, 51, 51 ), CLR_WHITE ;
  FONT oFont //ACTION ( nOpt := CaptureImage( oImg:hWnd, "IMAGENC.BMP" ) )
  @ 168, 155 FLATBTN PROMPT "Exit" SIZE 40, 20;
  COLOR RGB(  51, 51, 51 ), CLR_WHITE ;  Â
  FONT oFont ACTION oDlg:End()
  ACTIVATE DIALOG oDlg CENTER //;
   //ON INIT ( oImg:SetSize( oImg:nWidth(), oImg:nHeight() ) )
  //oFont:End()
 Â
  RETURN NILCristobal,
your sample is not compilable. Please fix it and resend.
EMG
#include "Fivewin.ch"
FUNCTION MAIN()
  Local oDlg
  Local oImg
  Local nOpt
  Local oFont
 Â
  //DEFINE FONT oFont NAME "Lucida Console" SIZE 0, -12
  DEFINE DIALOG oDlg SIZE 610, 410 ;
  COLOR CLR_WHITE, RGB(  51, 51, 51 )// ;
           //SIZE 150, 100 PIXEL Â
  @ 15, 5 IMAGE oImg PIXEL FILE "EAGLE.JPG" OF oDlg //ADJUST
@ 168, 5 BUTTON "Draw " SIZE 40, 20 PIXEL
     Â
@ 168, 55 BUTTON "Save Fw" SIZE 40, 20 PIXEL
@ 168, 105 BUTTON "Save C " SIZE 40, 20 PIXEL
@ 168, 155 BUTTON "Exit" SIZE 40, 20 PIXEL ACTION oDlg:End()
  ACTIVATE DIALOG oDlg CENTER //;
   //ON INIT ( oImg:SetSize( oImg:nWidth(), oImg:nHeight() ) )
  //oFont:End()
 Â
  RETURN NILCristobal,
now I can compile the sample but, sorry, I don't understand what is the problem you are referring to. Can you explain, please?
EMG
Look
Original Image Size: 150 x 100
Tamaño original de la imagen: 150 x 100
https://www.dropbox.com/s/fy1jpxrqc4kkiop/TImage.png
When you create the control has twice the size of the image containing
I have to do the oImg: SetSize you've told me
Why the size of the control is not adjusted to the size of the image?
Cuando creas el control tiene el doble de tamaño que la imagen que contiene
Tengo que hacer el oImg:SetSize que me has explicado
Por qué no se ajusta el tamaño del control al tamaño de la imagen?

cnavarro wrote:Look
Original Image Size: 150 x 100
Tamaño original de la imagen: 150 x 100
https://www.dropbox.com/s/fy1jpxrqc4kkiop/TImage.png
When you create the control has twice the size of the image containing
I have to do the oImg: SetSize you've told me
Why the size of the control is not adjusted to the size of the image?
Cuando creas el control tiene el doble de tamaño que la imagen que contiene
Tengo que hacer el oImg:SetSize que me has explicado
Por qué no se ajusta el tamaño del control al tamaño de la imagen?
Carlos,
as soon it will be finished, I will add a DOWNLOAD-link
of the COMPLETE sample.
saves to a BMP with paintings works :
ACTION oImg:SaveToBmp( cDestFile )
doesn't work painting is not included !!!
ACTION oImg:SaveImage( cDestFile, 2, 25 )
Enrico Maria Giordano wrote:Cristobal,
Because it's not intended to work such way.
EMG
//-----------------------------------------------------------------------------
#include "Constant.ch"
//----------------------------------------------------------------------------//
#xcommand @ <nRow>, <nCol> IMAGEC [ <oImg> ] ;
       [ <resource: NAME, RESNAME, RESOURCE> <cResName> ] ;
       [ <file: FILENAME, FILE, DISK> <cBmpFile> ] ;
       [ <NoBorder:NOBORDER, NO BORDER> ] ;
       [ SIZE <nWidth>, <nHeight> ] ;
       [ <of: OF, WINDOW, DIALOG> <oWnd> ] ;
       [ <lClick: ON CLICK, ON LEFT CLICK> <uLClick> ] ;
       [ <rClick: ON RIGHT CLICK> <uRClick> ] ;
       [ <scroll: SCROLL> ] ;
       [ <adjust: ADJUST> ] ;
       [ CURSOR <oCursor> ] ;
       [ <pixel: PIXEL>  ] ;
       [ MESSAGE <cMsg>  ] ;
       [ <update: UPDATE> ] ;
       [ WHEN <uWhen> ] ;
       [ VALID <uValid> ] ;
       [ <lDesign: DESIGN> ] ;
    => ;
     [ <oImg> := ] TCImage():New( <nRow>, <nCol>, <nWidth>, <nHeight>,;
       <cResName>, <cBmpFile>, <.NoBorder.>, <oWnd>,;
       [\{ |nRow,nCol,nKeyFlags| <uLClick> \} ],;
       [\{ |nRow,nCol,nKeyFlags| <uRClick> \} ], <.scroll.>,;
       <.adjust.>, <oCursor>, <cMsg>, <.update.>,;
       <{uWhen}>, <.pixel.>, <{uValid}>, <.lDesign.>, [<(oImg)>] )
CLASS TCImage FROM TImage
METHOD New( nTop, nLeft, nWidth, nHeight, cResName, cBmpFile, lNoBorder,;
      oWnd, bLClicked, bRClicked, lScroll, lStretch, oCursor,;
      cMsg, lUpdate, bWhen, lPixel, bValid, lDesign, cVarName ) CONSTRUCTOR
ENDCLASS
METHOD New( nTop, nLeft, nWidth, nHeight, cResName, cBmpFile, lNoBorder,;
      oWnd, bLClicked, bRClicked, lScroll, lStretch, oCursor,;
      cMsg, lUpdate, bWhen, lPixel, bValid, lDesign, cVarName ) CLASS TCImage
 ::Super:New( nTop, nLeft, nWidth, nHeight, cResName, cBmpFile, lNoBorder, ;
       oWnd, bLClicked, bRClicked, lScroll, lStretch, oCursor,    ;
       cMsg, lUpdate, bWhen, lPixel, bValid, lDesign, cVarName )
Â
 if ! Empty( cResName ) .or. ! Empty( cBmpFile )
   DEFAULT nWidth  := Min( ::nWidth(), oWnd:nWidth() ),;
       nHeight := Min( ::nHeight(), oWnd:nHeight() )
 else
   DEFAULT nWidth  := 100, nHeight := 100
 endif
Â
 ::nTop   := If( lPixel, nTop, nTop * BMP_CHARPIX_H )  // 14
 ::nLeft   := If( lPixel, nLeft, nLeft * BMP_CHARPIX_W)  // 8
 Â
 if Upper( oWnd:ClassName() ) <> "TWINDOW"
 ::nBottom  := ::nTop + Int(nHeight/2) - 1 // Aqui
 ::nRight  := ::nLeft + Int(nWidth/2) - 1 // Aqui
 endif
Â
return Self