Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XML crop bitmap

Featured Replies

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?

  • Moderator

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

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

  • Moderator

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

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

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

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

See this FSDeveloper post

Bob

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.