Recommended Posts

I have an emergency announcer gauge/light matrix in bitmap form. 

I wish to crop a single light from it to then display on a 2D cockpit graphic.

In XML how do I crop the bitmap image and then position it in the 2D instrument panel?

Share this post


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

As far as I can determine, there's no mechanism in XML to allow 'cropping' of a small section of a large bitmap.

Only two integer values are allowed for image objects, those being limited to the height and width of the bitmap.

Share this post


Link to post
Share on other sites

You can simply open the bitmap in paint  and crop the light you want. Then save as “my light”

position it on the background 2d panel in xml :

Position x = *** y = ***

usually the top left of the background  is  0,0

I use paint, to get a rough idea where I want the light. Place your mouse curser where you want the light and look at the lower left corner in the paint window, you’ll see something like 388,433.

enter those numbers in the position section of the xml , test and run, adjust as necessary 

MUCH more available online if you wanna learn it 👀

Share this post


Link to post
Share on other sites

Of course one can manually 'crop' out and isolate the image, but that isn't what was being asked about. :dry:

Dynamic cropping would require something like this (which doesn't exist!)

<Image> Name="3D_Altimeter_bgnd.bmp" X="320" Y="213" W="23" H="18"</Image>

 

Share this post


Link to post
Share on other sites
Posted (edited)

No that’s right it’s not what is being asked about but I have given a little light at the end of the tunnel🤗 instead of a slammed door ( as I know full well what it’s like in that kind of situation, asking at forums and getting nothing back, from certain Flight Sim development sites..)

 

because as you say what the op is asking doesn’t exist!

Edited by MaDDogz

Share this post


Link to post
Share on other sites
Posted (edited)

Image cropping can be done using Clip, whose attributes are Top, Left, Bottom, Right, Width, and Height.  For example:

<Element>
	<Position X="10" Y="300"/>			
		<Image Name="PictureA.bmp"/>
		<Clip Top="310" Left="20" Width="25" Height="25"/>
</Element>

It's not limited to bmp images.  One can Clip any individual Element display such as a gps map, or annunciator gauge elements if it's an XML gauge.  Clip is not dynamic in the sense that it's attributes are not variables that can be changed while the gauge is running.  The attributes are set when the gauge loads.

I get the idea that OP petfy may want one particular annunciator light from the annunciator gauge to be displayed, and functional, in the 2D gauge.  In that case, I suggest making the effort to figure out, if it is possible, what conditions trigger the light and write that into the 2D gauge.  And, if the code running the announcer gauge is hidden (e.g., .gau file), then there's nothing to apply Clip, or a Mask Image to, anyway.

 

Bob

Edited by Propwash

Share this post


Link to post
Share on other sites

Edit - Clip and RelClip height and width can be manipulated dynamically using <HeightCode> and <WidthCode>

See this FSDeveloper post

Bob

  • Upvote 1

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