Re: Merging Of Images

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

> I'm attempting to overlay a W shaped graphics image (in the form of a
> chapter index list) over another graphics image that contains changing
> data. I've included the image as part of this letter in GIF format. My
> apologies to those who feel this is unnecessary overhead, but I feel
> studying the image will help you understand my problem. Because the image
> is W shaped, bits of the background screen should appear between the
> "fingers" of the image. This means simply doing a save_image() of the
> background followed by a display_image() won't work. I've gotten the W
> image to appear properly on the screen but it takes a little time because I
> merge bits of the background between the fingers before displaying. To do
> this takes 1 second on my P-90 but 4 seconds on a 486SX-25. Not acceptable.
>
> I've tried xor_bits(), and_bits() and or_bits() to merge the two images
> together. It works VERY fast but the resulting union causes the W image to
> appear in different colours. I have two alternatives left. One is to
> display the W image in 4 separate display_images() as rectangular shapes,
> but that would make the W image appear in steps, and would be particularly
> noticable on a slower machine. The other would be to redo the W image in
> false colours so the resulting and_bits(), or_bits() or xor_bits() would
> make it appear in the correct colours.
>
> Any help from the graphics experts of this listserv would be appreciated.
>
> Thanks
>
> David Gay

Check out this little routine I just wrote.

It works the same way as display_image(), except that you need to
give it three arguments, instead of just two. The first two are
exactly the same, and the third is just the color you want to see the
background through. With your picture I think it's color 13.

I timed it myself, and got about .22 to .33 seconds on my P-100.

Hope this helps.

Michael Bolin

---------------------------------------------------------
include graphics.e

procedure display_mask_image(sequence pos,sequence image,integer mask_color)
    sequence background,work
    integer draw_y,left_x,color

    draw_y = pos[2]
    left_x = pos[1]
    for y = 1 to length(image) do
        work=image[y]
        background = get_pixel({left_x , draw_y , length(work)})
        for x = 1 to length(work) do
            color = work[x]
            if color != mask_color then
                background[x] = color
            end if
        end for
        pixel(background , {left_x,draw_y})
        draw_y = draw_y + 1
    end for
end procedure
---------------------------------------------------------

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

Search



Quick Links

User menu

Not signed in.

Misc Menu