Re: Hints on Drawing in TASM

From: The Half A Wannabe (shit)Zulu_at_hotmail.com)
Date: 12/17/03


Date: Wed, 17 Dec 2003 13:52:47 +0100


"xteven" <stevedool@yahoo.com> wrote in message
news:7VODb.2022$Ts5.1237@newsread2.news.atl.earthlink.net...
> Anyone have any good tips on how to start drawing lines in assembly. I
> want to make boxes around numbers...
>
> -xteven

I guess you are asking about dos ? or something non windows ? Ask someone
else.

For Windows/Dos , from memory :

For a most "easy" to do approach (Windows) : GDI

ADC := GetDC( WindowHandleOfWindowToDrawIn);
  DrawPolyline( ADC , array of TPoints );
ReleaseDC( WindowHandleOfWindowToDrawIn, ADC);

see http://betov.free.fr/RosAsm.html for how to make that just as easy todo
in ANY assembler.

For more control :

Get Michael Abrashs book Graphics programming black book or something. I
read (long time ago) Zen of Graphics programming. But I would suspect, they
are allmost identical. Maybe a few things added.
Theres a few chapters there on speedy line drawing. He takes us from HHL
line drawing into asm, and then progressivly goes into "nut territory" by
drawing lines that are fast. 500 000 pixels/s on a 386 vga if I recall
correctly. It may pay off not to read only the new stuff. reading old stuff
may pay off in the long run.

For windows: Use DirectX backbuffer or a GDI BitmapSection to draw in. Then
blit it to the screen.
You can of course use MAbrash code to draw directly to the screen memory
buffer. (DirectX) but for GDI you must go via a BitmapSection and then blit
the result. (Irritating, maybe direct GDI is possible, but have not found it
to work yet, but at least you can save the pointers to the BitmapSection
memory, and use them again, as in clearing just whats needed from frame to
frame etc) GDI blitting is not extremly slow on modern hardware. I can blit
a few 1000 (FULLSCREEN) bitmaps/s on my Geforce2 if that is all that I do.
If they are small I can blit about 10000/frame at upto 20-30 frames/sec

At least it could get you started. Also DirectX tutorials all over the place
will help. Today some people use Hardware line drawing, by using 3D hardware
to draw a 3D vector. But a 3D vector is a 2D line onscreen, if the
viewfrustum and matrixes are properly ajusted, one can use 3D hardware to do
2D graphics, with the speed of hardware.

For info on how to get access to Windows API from assembly, read Betovs
short and to the point tutorials < http://betov.free.fr/RosAsm.html >

But in prinsiple its very easy :
push all parameters, and then call api function.



Relevant Pages

  • Re: Spritefile & BASIC OPENOUT (PRINT#) internal file format...
    ... platform for the PC version so I can make full use of the DirectX ... interface for fast rendering direct to the hardware. ... Windows I can't think of any advantage in converting it to .NET. ... access the Windows API, ...
    (comp.sys.acorn.programmer)
  • Re: Guillermitos Particles
    ... I actually had a lot of experience with assembler and DOS ... computer hardware required C++ and the learning of the ... Windows OS APIs, DLLs, DirectX etc. ...
    (alt.lang.asm)
  • Re: Went Back To Windows(R)...
    ... Linux and Linux does not use DirectX. ... So your reference to Windows was ... Windows works with the hardware you have and you can ...
    (Ubuntu)
  • Scratchbuilding notes
    ... Which is to say that it warps like a mother once you apply wet glue to it, or make significant cuts into or out of it. ... the thing that really makes or breaks a building such as this is the windows and doors. ... I used these to make a mechanical drawing, using pen & ink, which I then also scanned. ...
    (rec.models.railroad)
  • Re: Drawing on DC
    ... can you finally say me about a good guide to Windows ... for drawing in OnMouseMove is that the mouse is captured and the window ... The strokes are going into the container where it counts. ...
    (microsoft.public.vc.mfc)