Re: Masking

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

I just thought of a better way

 sequence line,comp,run
 atom clear
 comp={}
 line=your line
 clear=0
 run={}
 for i = 1 to length(line) do
     if line[i]=CLEARCOLOR then clear+=1
     elsif clear=0 then run&=line[i]
     else comp&=clear&{run} clear=0 run={}
     end if
 end for

 And to display a compiled line do this
 atom x,y
 x=your x
 y=your y
 for i = 1 to length(comp) by 2 do
     x+=comp[i]
     pixel({x,y},comp[i+1])
 end for

Daniel, that should be faster

----- Original Message ----- 
From: "Daniel Kluss" <codepilot at netzero.net>
To: <EUforum at topica.com>
Sent: Saturday, November 08, 2003 2:41 PM
Subject: Re: Masking


>
>
> Here is a way try this, take the image and compile it like this
> this does only one line
> sequence line,comp
> atom clear
> comp={}
> line=your line
> clear=0
> for i = 1 to length(line) do
>     if line[i]=CLEARCOLOR then clear+=1
>     else comp&=clear&line[i] clear=0
>     end if
> end for
>
> And to display a compiled line do this
> atom x,y
> x=your x
> y=your y
> for i = 1 to length(comp) by 2 do
>     x+=comp[i]
>     pixel({x,y},comp[i+1]
> end for
>
> THATS ALL FOLKS
>
> Daniel Kluss
> ----- Original Message ----- 
> From: "Stewart MacKenzie-Leigh" <stewartml89 at msn.com>
> To: <EUforum at topica.com>
> Sent: Saturday, November 08, 2003 11:30 AM
> 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!
> >
> >
>
>
> 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