Computer Science Canada

PicMerge not working properly

Author:  SuperGenius [ Sat Mar 27, 2004 3:56 pm ]
Post subject:  PicMerge not working properly

I decided to add graphics to my connect 4 game (yes im still working on that) so that it would look more professional. I thought I had it all nice and good, but I don't, and I'm confused. I have one picture which is the game board or grid, and one picutre each of a red and blue checker. I knew that i would have to use PicMerge so that i would not get white corners around the checker. But, using PicMerge causes it to also draw some white "fuzz" around the checker. I also tried PicUnderMerge, but the results were similar. There is actually not even a white background around the source pictures of the checkers.

Author:  Delos [ Sat Mar 27, 2004 4:22 pm ]
Post subject: 

Ah, picMerge...very nice.

Ok, here's your problem. You are using JPGs, and if you look carefully enough, white really isn't white. In fact, it's a strange blend of white and other off-white colours.
Thus being, picMerge will not and cannot work to its best form.
This is as it checks for colourbg and considers this transparent.

code:
setscreen ("graphics;nobuttonbar;position:middle;middle")

var pic1, pic2, pic3 : int
pic1 := Pic.FileNew ("board good.jpg")
View.Set ("graphics:" + intstr (Pic.Width (pic1))
    + ";" + intstr (Pic.Height (pic1)))
% Set screen size to correct size.

pic2 := Pic.FileNew ("bluechecker.jpg")
pic3 := Pic.FileNew ("redchecker.jpg")

Pic.Draw (pic1, 0, 0, picMerge)
% Board first, then checker.
Pic.Draw (pic3, 0, 0, picUnderMerge)
% Change x, y, here to draw it in the right place.


Theortetically, this should work.
And it does to some degree. To make it work better though, you will have to either manually edit the pic files to make sure that the white is where it should be, or save them as .bmps (in which such detail is not lost at the expense of increased file size).

So there you have it.
Another problem solved...hopefully.

Author:  SuperGenius [ Sat Mar 27, 2004 8:38 pm ]
Post subject: 

thanks. What i ended up doing was changing the pics to .bmp and putting a hard black edge around the checkers.


: