and & xor merge

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

Jushua Milligan wrote:

>  I was also wondering if there was a way in Euphoria of displaying images on t
he
>  screen (display_image()) that would merge images and backgrounds (like Qbasic
's
>  XOR or AND).


With the new bitwise functions you can cook your own, e.g.:

procedure and_image(sequence s1, sequence s2)
   integer w
   w=length(s2[1])
   for r=1 to length(s2) do
      pixel(and_bits(s2[r],get_pixel({s1[1],s1[2]+r-1,w})), {s1[1],s1[2]+r-1})
   end for
end procedure

procedure xor_image(sequence s1, sequence s2)
   integer w
   w=length(s2[1])
   for r=1 to length(s2) do
      pixel(xor_bits(s2[r],get_pixel({s1[1],s1[2]+r-1,w})), {s1[1],s1[2]+r-1})
   end for
end procedure

Use these routines the same way as you would use display_image(). I have not
tested them, but they should be ok in any pixel graphics resolution supported by
Euphoria.  Jiri

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

Search



Quick Links

User menu

Not signed in.

Misc Menu