![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

----- Original Message -----
From: "Schmitt Louis Jean-Pierre" <louis.schmitt_at_eif.ch>
To: <sftalk_at_forth.com>
Sent: Wednesday, November 21, 2001 2:05 PM
Subject: [sftalk] Help for graphic application with swiftforth
Bonjour Jean-Louis,
Il n'est pas aisé de répondre à cette question.
Le cas le plus simple est de dessiner dans la fenêtre de SwiftForth
en utilisant les fonctions du GDI de Windows.
Charles
___________________________________________________________________
0 VALUE (sfhdc)
: Begin-Draw ( -- )
HWND Z" TTY" GetProp GetDC TO (sfhdc) ;
: End-Draw ( -- )
(sfhdc) HWND ReleaseDC DROP ;
Function: LineTo ( hdc x y -- ret )
Function: MoveToEx ( hdc x y ppoint -- ret )
: DRAW ( x0 y0 x1 y1 -- )
2SWAP (sfhdc) -ROT LineTo DROP
( x1 y1) (sfhdc) -ROT 0 MoveToEx DROP ;
: TEST1
Begin-Draw
100 100 500 300 DRAW
End-Draw ;
\ ---- basic floating point graphic ----------
REQUIRES FPMATH
FVARIABLE FZOOM 1e FZOOM F!
100e FCONSTANT FDELTAX
100e FCONSTANT FDELTAY
: TRANSFO ( s: -- x' y' )( f: x y -- )
FZOOM F@ F* FDELTAY FSWAP F- F>S
FZOOM F@ F* FDELTAX F+ F>S
SWAP ;
: PU ( f: x y -- )
(sfhdc) TRANSFO 0 MoveToEx DROP ;
: PD ( f: x y -- )
(sfhdc) TRANSFO LineTo DROP ;
: TEST2
50e FZOOM F!
Begin-Draw
-1e 0e PU 7e 0e PD
0e 0e PU
628 0 DO I S>F 100e F/ FDUP FSIN PD LOOP
End-Draw ;
\\ THE-END
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Wed Nov 21 2001 - 08:03:19 PST
This archive was generated by hypermail 2.2.0 : Sat Nov 22 2008 - 03:04:20 PST