Keeping the aspect ratio of static images.

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

jtracy
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Dec 20, 2006 17:20

Keeping the aspect ratio of static images.

Postby jtracy » Wed Dec 20, 2006 18:41

I am working on a screen that needs to be displayed on both a 4:3 and 16:10 aspect ratio monitors. Right now I have a bar (Default Window) of logos that is displayed on the right side of the screen. When I setup the screen it was using a 4:3 aspect ration, but when I use it on my 16:10 monitor the icons come out squished. Is their anyway to keep this from happening. I want the icons to scale if the resolution changes, but I want them to do that uniformly. If anyone know how to deal with this in CEGUI please let me know.

Judd

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Thu Dec 21, 2006 02:31

I think this has more something to do with your renderer, like DirectX or OpenGL, ... CEGUI doesn't even know of the ratio change, you have to tell CEGUI that it changed.

Unfortunately, I don't know how to detect these changes ^^

jtracy
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Dec 20, 2006 17:20

Postby jtracy » Tue Dec 26, 2006 21:20

Assuming I can detect the change what do I have to tell CEGUI in order to keep it from stretching the images when scaling?

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Tue Dec 26, 2006 21:28

jtracy wrote:Assuming I can detect the change what do I have to tell CEGUI in order to keep it from stretching the images when scaling?


Don't use the relative position or size. You can position all widgets with an absolute position, as well as size all widgets with an absolute size.

Also, you can ( should ) remove the 'AutoScaled="true" ' attribute from the <Imageset> tag in your .imageset file.

And finally, if you're making widgets based around images, you probably want to make sure that the specific parts in the .looknfeel file are set to either tile or stretch as appropriate for your case.

jtracy
Not too shy to talk
Not too shy to talk
Posts: 22
Joined: Wed Dec 20, 2006 17:20

Postby jtracy » Wed Dec 27, 2006 14:47

I have tried using absolute size and postition, but that casues problems at different resolutions. We have a requirement to run at low and high resolutions. I am not making widgets out of the images yet, this is just placing some logos on the opening screen.

By using the absolute position and size I either get really large logos on the small screen sizes (the logos interfere with the rest of the interface) and normal logos on the large widescreen resolutions or normal logos on the small screen sizes and tiny hard to read logos on the large widscreen resolutions.

If there is no way to scale an image and keep its aspect ratio then I would think that CEGUI is useless for widescreen resolutions.

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Wed Dec 27, 2006 17:11

You don't get large or small logos on bigger or smaller resolutions. If you are indeed using absolute sizes, then you are specifying the exact amount of pixels that thing will take.

If you are running at a low screen resolution, that amount of pixels will take up a proportionally larger amount of space.

Vice versa for a high screen resolution.

The problem isn't CEGUI. You cannot typically have any image scale and look good, whether scaling down or up [although you'll wind up with better results going down].

Likewise, if you want it to scale, the aspect ratio will of course cause the image to become skewed and look awkward. This isn't a problem with CEGUI.

If you want a clean cut interface at many resolutions, you have to make your graphics [whether they be images or colors or text] look good at the resolutions you're going to support. For unsupported resolutions, you just have to decide what the best way to handle things are, which is usually keeping things at fixed sizes.

There is no magic that can be done here to have something look good in an environment its not designed to handle.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sun Dec 31, 2006 12:19

I see what problem you have. The first idea that comes to my mind is maybe not the "nicest" ... Maybe you should simply create two layouts, one for the 16:9 aspect ratio and one for the 4:3 ?

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Mon Apr 02, 2007 18:29

I think the original poster's point is significant. I'm looking for a solution to this problem as well. The question is this:

How can an image be "Stretched" (in CEGUI/Falagard terms) and still maintain the original aspect ratio? CEGUI provides ways to align, tile, or stretch an image both horizontally and vertically, but how can we ensure that such resizing preserves the original aspect?
Arcanoria - a SMORPG project - http://www.arcanoria.com

User avatar
madmark
Just popping in
Just popping in
Posts: 6
Joined: Tue Jul 26, 2005 18:47

Postby madmark » Tue Apr 17, 2007 14:57

I came to this thread from a search.

I too have this question, and I think it is a CEGUI thing. I have a static image in the layout and dynamiclly swap the displayed image. These images are not always in the same size and shape, so I want the images "Stretched" but the original image's aspect ratio to be preserved.

Maybe the best short description is I want "BestFit" and an option for "VertFormat" and "HorzFormat".


Return to “Help”

Who is online

Users browsing this forum: No registered users and 29 guests