1. Neil graphics library

I'm trying to figure out to draw to a virtual screen and then blit it to 
the screen.  Or, a way to create a mask so that drawing functions only 
draw within a defined rectangle on the screen. (I used to do this in 
QBasic with the VIEW command).

I don't want a fancy game library like Exotica, just something small and 
simple. Can win32lib do this? I know how to draw shapes to the screen, 
but is it possible to use these same functions to draw directly to a 
bitmap in memory?

~rywilly~

new topic     » topic index » view message » categorize

2. Re: Neil graphics library


new topic     » goto parent     » topic index » view message » categorize

3. Re: Neil graphics library

>I'm trying to figure out to draw to a virtual screen and then blit it to
>the screen.  Or, a way to create a mask so that drawing functions only
>draw within a defined rectangle on the screen. (I used to do this in
>QBasic with the VIEW command).

Neil has quite good documentation thanks to Pete Eberlein :)
But to speed you up , here's maybe some useful stuff for you:

<EX 1 easy way to use build-in sub_screen func in Neil>

include neil.e
atom virtualscr_handle, subscr_handle

--go to graphics mode
if vesa_mode(320,200,8) then
  puts(1,"Graphics mode not supported!")
  abort(0)
end if

--make 200x200 virtual screen:
virtualscr_handle=virtual_screen(200,200)

--make 100x100 sub screen in virtual screen position 10,10:
subscr_handle=sub_screen({virtualscr_handle,10,10,100,100})
-- *** do not poke around on the memory address returned ***
-- *** do not use sub-screens with pixel or get_pixel ***
-- now u can use this handle like the way u asked.

while get_key()=-1 do end while
free_screen(virtualscr_handle)
free_screen(subscr_handle)
restore_mode()
puts(1,"Bye!\n")


<EX 2 a bit more complicated but useful, if u need that pixel routine>

include neil.e
constant SCRX=320, SCRY=200, SCRBPP=8
atom handle              --virtual_screen or screen handle
integer subx,suby,subw,subh   --x,y position, width,height

procedure sub_pixel(atom handle, integer x, integer y, object color)
if x>subw or x<0 then return end if
if y>subh or y<0 then return end if
if sequence(color) and length(color)+x-1>subw then color=color[1..subw-x] 
end if
if handle=0 then
    pixel(color,{x+subx, y+suby})
  else
     pixel(color, {x+subx, y+suby,handle})
  end if
end procedure

--go to graphics mode
if vesa_mode(SCRX,SCRY,SCRBPP) then
  puts(1,"Graphics mode not supported!")
  abort(0)
end if
if SCRBPP=8 then
  make_rgb_map()
end if

handle=0 --make sub screen into screen
subx=10 suby=10 subw=100 subh=100
sub_pixel(handle,0,0, WHITE)  --color constants are defined in neil.e
while get_key()=-1 do end while --wait user input

handle=virtual_screen(200,200)
subx=10 suby=10 subw=100 subh=100
sub_pixel(handle,0,0, BLUE)
display_image({0,0})

while get_key()=-1 do end while  --wait user input
free_screen(handle)
restore_mode()
puts(1,"Bye!\n")



< EX 3 ok, and of course you can do it as easy as here with display_image:>

--go to graphic mode,etc.

virtual1=virtual_screen(100,100)
pixel(WHITE, {0,0,virtual1})

--copy this "sub screen" to display:
display_image({10,10},virtual1)

--copy this "sub screen" to another virtual screen:
virtual2=virtual_screen(320,200)
diplay_image({10,10,virtual2},virtual1)

--free screen, restore mode, etc.


<END OF EXAMPLE SOURCE>

hope this helps u :) remember that in graphics things and programming 
generally,
only limitation is own imagination ;)
If your coding to DOS32 then I warmly recommend use of Neil. It's really 
great!

--Talvitie
mailto: tapueu at hotmail.com

PS. sorry this took so long, but I had little problems with hotmail working 
in Outlook Express

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu