Re: Masking

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

The and or method I gave you is better.
but I give you this as an alternative.
--
I also give you the ofind version.  Ask me for ofind if you
don't know where to find it.

--
include ofind.e

integer s, e
sequence img_mask

img_mask = (img = MASK_COLOR)
for y = 1 to length(img) do
    s = ofind(0, img_mask[y], 1) -- Find pixel that starts visable area
    while (s) do
      e = ofind(0, img_mask[y], s+1)
      if (e = 0) then
            e = length(img_mask)
      end if
      pixel(img[y][s..e], {imgX + s, imgY + y})

      s = ofind(0, img_mask[y], e+1)
    end while
end for


-- Plain
integer s, e
img_mask = (img = MASK_COLOR)
for y = 1 to length(img) do
    s = find(0, img_mask[y]) -- Find pixel that starts visable area
    while (s) do
       -- the follwing crap is why I created ofind.
      e = find(0, img_mask[y][s+1..length(img_mask[y]])
      if (e) then
            e += s
      else
            e = length(img_mask)
      end if
      pixel(img[y][s..e], {imgX + s, imgY + y})

      s = find(0, img_mask[y][e+1..length(img_mask[y]])
      if (s) then
            s += e
      end if
    end while
end for


        Lucius L. Hilley III

----- Original Message ----- 
From: "Stewart MacKenzie-Leigh" <stewartml89 at msn.com>
To: <EUforum at topica.com>
Sent: Saturday, November 08, 2003 02:30 PM
Subject: Masking


>
>
> Is there a fster way to display a bitmap on the screen without the pixels
> which are the mask color, other than plotting each color individually in a
> loop?
>
> this is the code im using at the moment:
>
> for y = 1 to length(img) do
>     for x = 1 to length(img[y]) do
>         if img[y][x] != MASK_COLOR then
>             pixel(img[y][x], {imgX + x, imgY + y})
>         end if
>     end if
> end for
>
> this is too slow for what i am doing.
>
>
> thanks in advance
>
> StewartML
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu