Request for code:

Discussion among members of the development team.

Moderator: Forum Moderators

User avatar
Jetrel
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Request for code:

Post by Jetrel »

Make our campaign story pictures do the following:

This is now possible, where it was not before, because we now have a bilinear intepolation image scaling function.

• Make the image scale to fit the screen
• If it has a different aspect ratio, 'letterbox' the empty space by filling it with black.
• It might be useful to allow a flag to prevent an image from being scaled bigger, although images should always be scaleable to a smaller size.


This is something that would be truly useful.


There are several of Johann's new images in HttT's SVN, which lack the wooden border - those would work well for testing, and will be at a higher resolution (1024x768) in the final version.


Obvious props go to Craig Mullins for this test image I'm borrowing...
Attachments
testImage.jpg
testImage.jpg (243.9 KiB) Viewed 7371 times
User avatar
Jetrel
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Post by Jetrel »

Additionally, we can worry about the logistics of map "DOT/CROSS" placement later. That will need to be modified to compensate as well, but that can be done as a separate and subsequent task.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Excellent idea. Any coders want to have a shot at it? If it waits too long I guess I will have to step in and work out how to do it. :)

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
jab
Posts: 2
Joined: February 15th, 2006, 5:38 am

Post by jab »

I'm glad to hear people like the new image interpolation code. Nearest
neighbor (what Wesnoth had before) was really driving me crazy.

However, if one shrinks an image with very high spatial frequencies (lots
of sharp lines, think of very fine plaid shirt) it can produce a moire
pattern. Bilinear interpolation will not prevent this. This is probably not an
issue for Wesnoth images at the scale changes being considered; the
mermaid example can shrink down to 1/8 size without serious problems.
Airk
Posts: 90
Joined: January 31st, 2006, 5:26 pm

Post by Airk »

Would something like THIS be useful? It states that it's intended for more cartoony images, or sprites or things of that nature rather than photos, but it might work well with the Wesnoth artwork.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Request for code:

Post by Eleazar »

Jetryl wrote:Make our campaign story pictures do the following:
Good idea!
The trick to make it shine will be to get the best interaction between the letterboxing and the text overlay. For instance i think it would be un-good to have the picture extend half-way into the text overlay box. Also because of the various possible screen resolutions the artist won't be able to accurately predict how much of the image would be covered by the text. Maybe "Don't put important stuff at the bottom of the picture" would be enough, but then again saving black space under the picture for text might be better.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
jab
Posts: 2
Joined: February 15th, 2006, 5:38 am

Post by jab »

Airk> Would something like [fancier edge preserving interpolation algorithm] be useful?

Maybe, but it might take a decent amount of work to add alpha channel support. There's a lot of transparancy in Wesnoth graphics to support compositing, and I'd expect that trend to continue. Even for the simple bilinear interpolation, most of the implementation time was spent dealing with Wesnoth-specific transparancy issues.

http://svn.gna.org/viewcvs/wesnoth/trun ... estart=100
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Airk wrote:Would something like THIS be useful? It states that it's intended for more cartoony images, or sprites or things of that nature rather than photos, but it might work well with the Wesnoth artwork.
That algorithm is specifically designed for doubling the dimensions of the image. (Repeated applications could be used to make it scale to any power-of-2).

In this case, we want to be able to scale to any size, so that algorithm is unsuitable.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
Jetrel
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Re: Request for code:

Post by Jetrel »

Eleazar wrote:
Jetryl wrote:Make our campaign story pictures do the following:
Good idea!
The trick to make it shine will be to get the best interaction between the letterboxing and the text overlay. For instance i think it would be un-good to have the picture extend half-way into the text overlay box. Also because of the various possible screen resolutions the artist won't be able to accurately predict how much of the image would be covered by the text. Maybe "Don't put important stuff at the bottom of the picture" would be enough, but then again saving black space under the picture for text might be better.
Wise words. For the initial implementation, we can belay what you just said, but in later implementations, we'd should take that into account.

It's the 80/20 rule, as usual - 80% of the work goes into doing those final tweeks.
Sangel
Moderator Emeritus
Posts: 2232
Joined: March 26th, 2004, 10:58 pm
Location: New York, New York

Post by Sangel »

One solution might be to have the textbox always overlay the image (like in Jetryl's example). This means that no matter the resolution, no matter the letterboxing effect, there will never be odd instances where the image extends only partly into the text.

I would imagine this to give an effect much like movie subtitles - they could appear in the darkness of the letterboxing, but generally speaking, they don't.

Pros:
*Simple, clean, predictable.

Cons:
*The bottom of the image will always be partially covered.
"Pure logic is the ruin of the spirit." - Antoine de Saint-Exupéry
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Okay, I have implemented this. A screenshot of what it looks like is attached.
Attachments
preview
preview
intro-scaling.jpg (100.14 KiB) Viewed 6952 times
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Cool!
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Again, cool feature, but there appear to be bugs. Primarily, it appears that if you have a story [part] with no dialogue (used primarily for the bigmap), it will not display the [NEXT] or [SKIP] buttons, making hitting [esc] the only way to start the scenario. Also, I think that it would be better for now to have an option to not enlarge the image, and use it for all of the bigmaps. The dots on the bigmaps have been rather messed up by this change. :?
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Woodwizzle
Posts: 719
Joined: December 9th, 2003, 9:31 pm
Contact:

Post by Woodwizzle »

I think this would look 10x better if the text were justified. Is that possible? Also, Dave's screenshot looks like the black area is too big. I think it should only go as high as it needs to go + a little bit of a margin so the text is vertically centered in the black area.
Signature dropped due to use of img tag
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

turin wrote:Again, cool feature, but there appear to be bugs. Primarily, it appears that if you have a story [part] with no dialogue (used primarily for the bigmap), it will not display the [NEXT] or [SKIP] buttons, making hitting [esc] the only way to start the scenario. Also, I think that it would be better for now to have an option to not enlarge the image, and use it for all of the bigmaps. The dots on the bigmaps have been rather messed up by this change. :?
Yeah, these two problems were fixed with a commit a little after my original post. Please get the latest version and try again.
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Post Reply