Or not? I'll make some experiment and let you know, thank you.
EMG
Enrico Maria Giordano wrote:Too slow.
EMG
LineTo( hDc,x,y )
cnavarro wrote:Enrico Maria Giordano wrote:Too slow.
EMG
Has probado con lineas enteras?
Have you tried with whole lines?
- Code: Select all Expand view
LineTo( hDc,x,y )
#include "Fivewin.ch"
#define SRCCOPY 13369376
FUNCTION MAIN()
LOCAL oDlg, oImg
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 0, 0 IMAGE oImg;
SIZE 100, 100;
FILE "TEST.JPG";
ADJUST
@ 15, 0 BUTTON "Draw";
ACTION DRAWIMG( oImg )
@ 15, 20 BUTTON "Save";
ACTION oImg:SaveImage( "MYIMAGETEST.JPG", 2 )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
STATIC FUNCTION DRAWIMG( oImg )
LOCAL hDC := oImg:GetDC()
LOCAL nWidth := oImg:nWidth()
LOCAL nHeight := oImg:nHeight()
LOCAL hMemDC := CREATECOMPATIBLEDC( hDC )
LOCAL hMemBmp := CREATECOMPATIBLEBITMAP( hDC, nWidth, nHeight )
LOCAL hBmpOld := SELECTOBJECT( hMemDC, hMemBmp )
LOCAL hBitmap := oImg:hBitmap
LOCAL hPalette := oImg:hPalette
LOCAL x, y
PALBMPDRAW( hMemDC, 0, 0, hBitmap, hPalette, nWidth, nHeight )
FOR y = 0 TO 999
FOR x = 0 TO 999
SETPIXEL( hMemDC, x, y, CLR_HRED )
NEXT
NEXT
SELECTOBJECT( hMemDC, hBmpOld )
DELETEDC( hMemDC )
oImg:hBitmap = hMemBmp
PALBMPFREE( hBitmap, hPalette )
PALBMPNEW( oImg:hWnd, oImg:hBitmap, oImg:hPalette )
oImg:Refresh()
RETURN NIL
cnavarro wrote:
- Code: Select all Expand view
Function DrawOver( oImg )
Local x
Local y
For x = 10 to 50
//For y = 10 to 50
DrawImg( oImg, x )
SysWait( 0.009 )
//Next y
Next x
Return Nil
STATIC FUNCTION DRAWIMG( oDrawImg, hDC, hPen, nPensize, nPenColor, cDrawStyle, c_Path1 )
LOCAL nWidth := oDrawImg:nWidth()
LOCAL nHeight := oDrawImg:nHeight()
LOCAL hMemBmp, hBmpOld
LOCAL hBitmap := oDrawImg:hBitmap
LOCAL hPalette := oDrawImg:hPalette
hMemDC := CREATECOMPATIBLEDC( hDC )
hMemBmp := CREATECOMPATIBLEBITMAP( hDC, nWidth, nHeight )
hBmpOld := SELECTOBJECT( hMemDC, hMemBmp )
PALBMPDRAW( hMemDC, 0, 0, hBitmap, hPalette, nWidth, nHeight )
// ------ STYLES -----------
IF cDrawStyle = "Calc Lines"
DRAW_LINES( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Calc Pixel"
DRAW_PIXEL( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Calc Box"
DRAW_BOX( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Calc Fill"
DRAW_FILL( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Freehand"
DRAW_FREE( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Click Lines"
CLICK_LINES( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Click Box"
CLICK_BOX( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Click Fill"
CLICK_FILL( hMemDC, hPen, nPensize, nPenColor )
ENDIF
IF cDrawStyle = "Image"
DRAW_IMAGE( hMemDC, c_Path1 )
ENDIF
IF cDrawStyle = "Transp. Logo"
DRAW_LOGO( hMemDC, c_Path1 )
ENDIF
// -----------------
SELECTOBJECT( hMemDC, hBmpOld )
DELETEDC( hMemDC )
oDrawImg:hBitmap = hMemBmp
PALBMPFREE( hBitmap, hPalette )
PALBMPNEW( oDrawImg:hWnd, oDrawImg:hBitmap, oDrawImg:hPalette )
oDrawImg:Refresh()
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: nageswaragunupudi and 23 guests