Re: Is it possible to take that ugly border out ?

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

>         The problem is that almost all the images in my program use the
> palette entry 16 (17 in an Euphoria sequence) so when I set palette[17] to
> {0,0,0}, these images are displayed incorrectly.
>         (All the images in my program have the same palette, where index 16
> is red).
>         How can I fix this problem without having to change the index 16 to
> black and reassigning this global palette to all the images ?
>         More exactly: Is there a fast way to change all references to color
> 17 to an unused color ?

If you have a sequence S, and you want to change value X to value Y:

S = S + (Y - X) * (S = X)

This will work for sequences of any size or depth, so you could
change an entire sequence of images at once like this.

A faster way that only works on a single image (a sequence of
sequences) is this:

function change(sequence s, atom x, atom y)
    sequence one_row

    for i = 1 to length(s) do
        one_row = s[i]
        for j = 1 to length(one_row) do
            if one_row[j] = x then
                one_row[j] = y
            end if
        end for
        s[i] = one_row
    end for
    return s
end function

Regards,
              Michael Bolin

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

Search



Quick Links

User menu

Not signed in.

Misc Menu