tomc@mntgfx.MENTOR.COM (Tom Carstensen) (09/22/87)
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. :------------------------------------------------------------: : Tom Carstensen Usenet: tomc@mntgfx.MENTOR.COM : : Mentor Graphics GEnie: : :------------------------------------------------------------:
oster@dewey.soe.berkeley.edu (David Phillip Oster) (09/23/87)
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