>>> 1) new pixels = (old pixels & mask1) | (new pixels & mask2)
>>>
>>> Where mask1 and mask2 are the negated forms of each other.
>
> That one only works for boolean masks, but it works on 386.

By boolean mask, do you mean something like all 1s over the colors for
opaque and all 0s for transparent? The way I've got it now is just 1 bit
in the color byte represents opacity. It's either opaque or transparent,
and then the remaining bits are for colors.


Happy Hacking,

David E. McMackins II
Supporting Member, Electronic Frontier Foundation (#2296972)
Associate Member, Free Software Foundation (#12889)

www.mcmackins.org www.delwink.com
www.eff.org www.gnu.org www.fsf.org

On 07/22/2018 06:41 PM, Eric Auer wrote:
> 
> Hi David,
> 
>>> 1) new pixels = (old pixels & mask1) | (new pixels & mask2)
>>>
>>> Where mask1 and mask2 are the negated forms of each other.
> 
> That one only works for boolean masks, but it works on 386.
> 
>>> This even works for alpha masks:
>>>
>>> 2) new pixels = (old pixels "*" mask1) "+" (new pixels "*" mask2)
> 
> That one needs a CPU and compiler which supports at least MMX
> or some newer vector unit, so you are right that there is no
> effective way to do this on 386 with real alpha masking.
> 
> You are right that you could first check your mask for areas
> which can be done the 1) boolean way and then only do the more
> costly computations with multiplications for those pixels where
> the mask is neither 0.0 nor 1.0, but whether that really helps
> will depend on which fraction of your pixels has 0.0 or 1.0
> (or 0 and 100 percent, if you prefer) alpha masks and which
> fraction has more complicated values...
> 
> Regards, Eric
> 
> PS: As http://locklessinc.com/articles/sat_arithmetic/ shows,
> even saturated addition is tricky to do without having actual
> hardware support for it (MMX has saturated operations, too).
> 
> Also notable: http://locklessinc.com/articles/booleans/
> (testing for 0, 1 or -1)
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to