Re: mem routines

new topic     » goto parent     » topic index » view thread      » older message » newer message

David Cuny wrote:

>Jiri wrote:
>> Now, that we are allowed to have mem_set() & mem_copy() - very nice,
thank
>> you! - what about a complete set of goodies with mem_and(), mem_or() &
>> mem_xor()? Can I whip up any support, or am I too greedy already? Jiri
>
>Sounds like what Lucius needed for his routine. It would no doubt be
nice
>for drawing sprites, too.
>
> -- David Cuny

It is what I need.  It would be nice for drawing the sprites that I am
working
with.

I plan to release some image utilities soon.  They will be great for
drawing
sprites.

fore = a foreground image.
back = a background image.
--if fore is a 2D sequence 10x20 then
--back must be a 2D sequence 10x20
filter = filter image of fore.
mixed = fore with back showing through.

Code would look something like this.

filter = (fore = 0)--Create boolean filter
filter = fliter * 255--set filter to where back can show through.

mixed = and_bits(filter, back)--mixed will equal part of back to show.
mixed = or_bits(fore, mixed)--mixed equal fore with back showing.

NOTE: Multiplying by 255 is slow.
    I suggest creating the filter once and reusing it.
ALSO: My background changes according to where
    I am going to place fore.  SO I have to call
    and_bits & or_bits every time.

Please give credit where credit is due.
These are only 4 lines of code but it took me a few hours
to figure out just what order and how this would work.

I have another Idea that MIGHT be faster that uses xor_bits.
So far I haven't succeeded in getting it put together.

--Lucius Lamar Hilley III
--  E-mail at luciuslhilleyiii at juno.com
--  I support transferring of files less than 60K.
--  I can Decode both UU and Base64 format.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu