Hi all, I took a closer look at interpolation, and I'd like advice and feeback from someone who understands more about how the Wesnoth rendering system works. The function I am modifying is scale_surface in sdl_utils.c. I apologize for the lack of screenshots - Wesnoth is somehow thwarting my usual screen capture tool (Gimp).
-Jeff APPROACH #1 Standard bilinear interpolation, independently on all four channels (RGBA). Result was very noticible artifacts at hex edges - generally thin black or white lines along the diagonally oriented borders of every hex tile. This happens because the transpararent sections of the source image (used to produce the hex shape) contain bogus data in the R,G,B channels. The interpoloation was causing this bogus data to seep into the image. APPROACH #2 Bilear interpolation except in proximity to areas that are fully transparent, in that case switch to nearest neighbor interpolation. Worked perfectly, except that the edge of tiles (and characters, and houses...) were "lower-res" than everything else and stuck out like a sore thumb. Very annoying. APPROACH #3 Bilinear interpolate every channel, but don't trust any RGB data coming from a transparent pixel. Instead, pretend that those transparent pixels instead have RGB values equivalent to the average of nearby non-transparent pixels. This was kinda ok, but if I moved the mouse around, it left behind a trail of thin lit up hex edges. I guess having intermediate interpolated values in the alpha channel around hex edges was REALLY screwing things up. APPROACH #4 Same as approach as #3, but then threshold the entire alpha channel to 0 or 255. Best results so far. It looks a little cartoonish - as if things are painted on. For example, the edge of the path next to grass appears extra noticible and vibrant. The line where beach changes to sea is very sharp and draws the eye. Also, some tiles (like swamp) have a very very small hex border artifact along one small part of the border. I don't understand what is causing it, but you have to have really sharp eyes to see it. QUESTIONS: Do Wenoth graphic alpha channels sometimes have values other then 255 and 0? How about just along the edges of images; does the edge of some creature ever blend a little? Or is it always a 255->0 alpha transition? What do I need to know, but forgot to ask?
