From: | Nick Lamburn |
Date: | 6 Jan 2000 at 15:20:54 |
Subject: | BitMap Clipping... (Help me now!):) |
Hello All Again....
*Ok, I sent this last week, but nobody has helped me yet (don't tell me that*
*nobody knows the answer), it's a simple question if you know how to setup a*
*clipping region for a BitMap, but I haven't got a clue...*
*The Message was: *
Only meee! Oh, before I start, I just want to say thank-you to Curt for
your code, I have finally got it running, and it works pretty well, and like
you say it's quite fast!!! I shall be tidying is up for PS2k sometime, but
it's a very nice piece of code. Oh, and it works great on my Graphics Card
if you were wondering!
Back to one of my other problems then... :) (Oh yes!) It's about BitMap
clipping, now all I need to know is how to introduce a clipping region for a
BitMap, because we wouldn't want to trash any other data in memory, would we
now.... :) Now wether we allocate a rastport and bitmap like:
(I'm using AmigaLibsII.res BTW) (Also, this is off the top of my head, so
there may be inaccuracies)
*DEFTYPE*._BitMap *bmp
*DEFTYPE*._RastPort rp
*InitRastPort_* &rp
*If* rp
*bmp=*AllocBitMap_*(2340,117,6,#BMF_DISPLAYABLE|#BMF_CLEAR,0)
*If* *bmp
rp\_BitMap=*bmp
..
*EndIf*
*EndIf*
_/OR/_
*DEFTYPE*._RastPort rp
*DEFTYPE*._BitMap *bmp
*BitMap* 0,2340,117,6
*InitRastPort_* &rp
*bmp=*Addr BitMap* (0)
*If* rp *AND* *bmp
rp\_BitMap=*bmp
*EndIf*
..
rp\_BitMap=0
*Free BitMap* 0
The fact is it doesn't matter! Just so that we have our BitMap structure
pointer (newtype, sorry, I've been doing a bit of unrelated C code of
late...) and a RastPort address. (so we can draw on it, which is nice... BTW
the HAM functions are just getting a good testing, I'll send 'em soon!) Now
in order to strip print, we need to offset objects on the Y1 Position, since
an object may not be completely drawn. e.g:
+- - - - - - - - - - - -+
| ___ |
/ \
| / /\ \ | Strip #1 Printed
/ / \ \
+--------- /- ����---\-------------+
| / /����\ \ |
| / / \ \ | Strip #2 To-Be Printed
| ��� ��� |
+----------------------------------+
Now say the A starts at position 47, and strip #1 is 117 pixels high, strip
#2 starts at 117 pixels down, as such, but only half the A has been printed,
so we need to start the A at a negative position which is equal to
117-47=70. Then because 117 is Y=0 on strip #2, we plot the Y1 position at
0-70= -70. Now, if we were to blatantly plot at x,-70, we risk trashing
memory that is not ours, hence the need for a clipping region.
I know I'm meant to use the *InstallClipRegion_*() command, but I have tried
to do so, but It either crashes (bad parameters) or nothing happens (it
doesn't install the clipping region...)
Can somebody show me how to create a clipping region, by placing the correct
code in the above example Blitz code (the two bits where I created a
RastPort and BitMap....), this is really annoying me, because it's soooo
crucial, but I can't get it to work! :-(
*Please help very very soon....*
#<snipped out-of-date new year ramble....:)>#
Kind regards
Nick
+-------------------------------------+
| Omega Research UK - Amiga� Software |
+-------------------------------------+
| email: oruk-amigan@free4all.co.uk |
|www: http://www.omegaresearchuk.co.uk|
+-------------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie