Jump to content
Sign in to follow this  
petfy

XML crop bitmap

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

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.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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 👀


Luke Pype

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>

 


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

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

Luke Pype

Share this post


Link to post
Share on other sites

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...