Sign in to follow this  
Guest Vorlin

Scaling images in XML revisited ( imagesizes is not the answer)

Recommended Posts

All,A forum search drew a blank while looking for an answer about how to scale and image in xml as can be done in C. I now understand that the imagesizes tag is actually used to refer to the different sizes of identical bitmaps that are for larger and smaller resolutions when two versions are used, so there seems to be nothing that will help there.I went to that DTD I made from 20,000 lines of combined code and this is what's listed in the image section:According to this, not one single image in any of the files I used to make the DTD had been scaled. I checked the Element tag to see if it was a case of scaling the parent of the image, but there's nothing there either.I'm beginning to wonder if the capability was accidently left out of the XML implementation for FS9... maybe they were rushed to meet a deadline and overlooked it.Has anyone had any luck with scaling an image in any way? The ability to scale X and Y seperately, as in C gauges, would be best but any sort of ability to scale at all would be something.Oh, yes I will be adding the Alpha attribute in by hand a little later today. I'm in the process of many things, including a PDF explaination to help those not fluent in DTD to understand how refering to it can help make their lives easier.Scott / Vorlin

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Keep in mind Scott, that the actual drawing is being done 'behind the scenes' using plain-vanilla GDI pens and brushes. You should be able to resize any XML gauge without having to explictly "do" anything yourself.

Share this post


Link to post
Share on other sites

*Chuckle*Bill, I wish that I knew enough about GDI to understand what you just said!I *should* be around on HoverControl's Teamspeak tomorrow afternoon. I have an ortho appt at 7:30 AM and see zero chance that they'll allow me to work with my shoulder the way it is right now. Of course, I may have to spend the day beginning the workman's comp battle.If we're both around, maybe you could explain a little of the above to me?Thanks,Scott / Vorlin

Share this post


Link to post
Share on other sites

Its a tad hard to determine what it is you're asking. When you say scale, what do you mean precisely?For an XML gauge, the image size is irrelevent. I could write all my XML gauges to use 1024x1024 bitmaps if I wanted too. What is relevent is the code that interacts with the components is written to match the size of the gauge bitmaps. The gauge is "Scaled" by the sizing information in the panel config, thus ensuring that all elements of the gauge are scaled at the same time to the same degree.This contrasts with GDI (or vector drawn) gauges wherein you define the size of the drawn elements directly but they are in relation to the overall elemental definition. There are no "bitmaps" per say in this type of gauge as the drawing is done at runtime (though a bitmap backgrounds are possible). It still scales like above though.This make any sense? :)CheersShad

Share this post


Link to post
Share on other sites

It makes good sense but here's a scenario for you:You're building a whatchamacallit gauge... you have, from other efforts, many bitmaps that you can combine to make a really cool gauge. However, all of them but one are 256x256 while the other one is some odd size, perhaps it's a cropped photo or something like that.Do you have to resize that image with another program and resave or can you use xml to specify that you want this image displayed at a size other than it's original size.Or...You want to change the aspect of some text, make it taller. You could just scale the Y size of the image while leaving the X size alone to make them taller and skinnier. This is possible in C gauges, in fact it's easy. But I see no way to accomplish the same thing in XML.Scott / Vorlin

Share this post


Link to post
Share on other sites

Nod, the problem is C gauges are compiled dlls that use regular libraries. The XML used in FS is a subset of real XML (and MS-ized) and relies on the quality of the interpreter built within the sim itself.To be honest, Scott, I have not tried to scale images within XML as I create them all from scratch now. When I make a new one, I will see whats going on with the interpreter.So the short answer is, I would be rescaling the off-sized image with PSP or photoshop.CheersShad

Share this post


Link to post
Share on other sites

Yea, that's what I was afraid of. In that case, I think I'm going to do a batch conversion of all my originals into an RGBA mode, lossless format to ensure that manipulating and resaving several times as I reuse them doesn't degrade the quality of the image. Once I have it the size, alpha, perspective, etc. that I need, then I can convert the format into something usable by FS.Scott / Vorlin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this