🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #19389

Re: Converting Bitmap -> Region

#19389
From: David Phillip Oster
Date: Tue, 22 Sep 1987 21:17
33 lines
2473 bytes
In article <932@mntgfx.MENTOR.COM> tomc@mntgfx.MENTOR.COM (Tom Carstensen) writes:
>What is a good way to convert a BitMap (ie. icon) to a
>region?  - or is there a way? (with out adding to a region
>pixel by pixel.

You might consider why you want to do this. If you merely want to do some
clipping, then you should read the tech note on drawing with ICN#s. If you
want do to a drag gray region kind of thing, then consider this:

Allocate a 34x34 offscreen bitmap. Clear it. CopyBits your icon into it:
1.) using "or" drawing at 0,0 of the offscreen bitmap
2.) using "or" drawing at 0,2 of the offecreen bitmap
3.) using "or" drawing at 2,0 of the offscreen bitmap
4.) using "or" drawing at 2,2 of the offscreen bitmap
5.) using "bic" drawing at 1,1 of the offscreen bitmap

What this does, is create an "outline" of your original icon. You can
drag this offscreen bitmap around on your screen by drawing it to the screen
using CopyBits in XOR mode, and to move it, erase it by drawing over it in
XOR, and draw it in the new position with XOR.

Note: These XOR drawing techniques only work if all changing objects do
their drawing using XOR. In general, in a multi-tasking environment they
will not work, but the special case: you are drawing only in your own
window, and no one else is drawing in your window, is common enough
for this still to be a useful technique.  (Also, if you use this
technique only to track the mouse during a mousedown, you won't be
calling WaitNextEvent(), so other tasks won't run during the drag
anyway.)

--- David Phillip Oster            -The goal of computer science is to build
Arpa: oster@dewey.soe.berkeley.edu -something that will last,'til we finish it
Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu
Technical Details
Message-ID: <20905@ucbvax.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!zen!ucbvax!dewey.soe.berkeley.edu!oster
References: <932@mntgfx.MENTOR.COM>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!zen!ucbvax!dewey.soe.berkeley.edu!oster
From: oster@dewey.soe.berkeley.edu (David Phillip Oster)
Newsgroups: comp.sys.mac
Subject: Re: Converting Bitmap -> Region
Message-ID: <20905@ucbvax.BERKELEY.EDU>
Date: Tue, 22-Sep-87 17:17:28 EDT
Article-I.D.: ucbvax.20905
Posted: Tue Sep 22 17:17:28 1987
Date-Received: Thu, 24-Sep-87 07:01:59 EDT
References: <932@mntgfx.MENTOR.COM>
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster)
Organization: School of Education, UC-Berkeley
Lines: 33
Keywords: region bitmap