Opened 9 years ago

Closed 7 years ago

#498 closed defect/bug (fixed)

XPM icons render to garbage in WinCE and Windows ports

Reported by: akashihi Owned by: number6
Priority: minor Milestone: version 0.2.0
Component: core Version: git master
Severity: Keywords: wince win32 gui OSD turn signal internal images XPM
Cc:, nick@…,



The subjects describes the problem :) When i add <osd enabled="yes" type="navigation_next_turn"/>. to my navit.xml, i see funny colored square instead of the next turn signs. Bug is easily reproducible with the latest nightly build on asus p525 (and i believe it would be reproducible on other wince devices)

Attachments (1)

navit_win_xpm.PNG (51.0 KB) - added by mvglasow (2) 7 years ago.
XPM rendering incorrectly on Win32 port

Download all attachments as: .zip

Change History (14)

comment:1 Changed 9 years ago by mvglasow

Reproduced with build 2952 on Mitac Mio 168 RS running Windows Mobile 2003 SE. Using navigation_next_turn with no icon_src value or one that references the PNG files results in the above behavior. Setting icon_src="$NAVIT_SHAREDIR/xpm/%s_32.xpm" results in a blank icon (although the file exists).

The weird thing is that the zoom buttons are OK once they're rendered (see bug #550). Corresponding navit.xml entry for zoom is:

<osd enabled="yes" type="button" x="0" y="32" command="zoom_out()" src="gui_zoom_out_32_32.png"/>
<osd enabled="yes" type="button" x="-32" y="32" command="zoom_in()" src="gui_zoom_in_32_32.png"/>

comment:2 Changed 9 years ago by mvglasow

I have now tried using SVG icons and they behave the same as PNG, i.e. they produce some irregularly colored square rather than the expected icon.

comment:3 Changed 9 years ago by polarbear_n

  • Cc added
  • Milestone set to version 0.2.0

Reproduced on build 3473 on a Wayteq-N800 WinCE 6.0 device. Tried also .png, .xpm as delivered in the nightly built zip file, and the .svg files from the svn, same results as above.

Other dynamic icons are rendered correctly, such as the satellite status, or the compass.

comment:4 Changed 8 years ago by mvglasow (2)

the trouble is that the code for drawing turn instructions is vastly different from that for drawing, say, buttons, and quite complex to boot as far as I remember (it's been 6 months since I looked at that particular piece of code), so I'm kind of lost. If someone with knowledge of the graphics output code could have a look at this piece, that would be very helpful.

comment:5 Changed 8 years ago by thomas0782

You can use

<osd enabled="yes" type="navigation_next_turn" x="0" y="86" w="110" h="90" align="12" icon_src="%s_wh_64_64.png" background_color="#00000000" />

without the path in icon_src. This path is relative to the xpm folder. Due to inconsistent path handling (bug/feature?) you have to set the icon_src of e.g. type="toggle_announcer" element with full path. You can check the logfile in the navit folder for messages about graphics navit could not open.

comment:6 Changed 8 years ago by mvglasow (2)

Well, the path thing may be another issue to fix, however it doesn't explain the rendering issue.

When the file isn't found, nothing is rendered - nothing special so far.

But when Navit finds the file it is supposed to render, the output is a square of garbage rather than the desired icon. And, strangely, this happens only on WinCE but apparently not on other platforms. It also affects only navigation_next_turn but not other bitmap-based controls such as buttons; this may be explained by the fact that the drawing code for navigation_next_turn differs from that used for, say, button.

Questions to answer are:

  • Why is drawing a "next turn" arrow so different from drawing a button (resulting in different code)? Or have the two simply been implemented by two different people at different times and nobody bothered to look at the other's code?
  • If there's a reason for two different implementations: what is different about the navigation_next_turn code (causing the above behavior)? (If there's no reason, it might help to just copy the drawing code over from button.)

comment:7 Changed 8 years ago by number6

  • Cc nick@… added
  • Keywords wince win32 gui OSD turn signal internal images added
  • Owner changed from Singesang to number6

<osd enabled="yes" type="navigation_next_turn" x="140" y="0" font_size="500" w="60" h="40" background_color="#000000c8" icon_src="%s_wh_32_32.png" />

WinCE doesn't handle SVG or XPM natively. Changing the navit.xml file to use .png fixes this problem.


comment:8 Changed 8 years ago by number6

  • Resolution set to fixed
  • Status changed from new to closed

comment:9 Changed 7 years ago by mvglasow (2)

  • Cc added
  • Priority changed from major to minor
  • Resolution fixed deleted
  • Status changed from closed to reopened

I don't think this is completely gone yet...

I recently tried r4678 on a Transonic PNA-6000, Windows CE 4.2. I had modified the navit.xml, the turn instructions were defined as follows:

<osd type="navigation_next_turn" x="0" y="-56" w="56" h="29" icon_src="%s_wh_32_32.png" osd_configuration="1"/>

When I did a "dry run" on the terrace, I got the familiar colored square instead of an arrow. However, when I used in in practice, I would get correctly drawn arrows for different kinds of turns, roundabouts and "destination reached".

On one occasion I did notice the "garbage" icon reappearing: Navit was instructing me to do a U-turn (or sharp left turn) at the end of a dual carriageway section (basically telling me to go back). The voice instructions said "turn left"; I figure the icon should have been either nav_left_3 or nav_turnaround_left.

To me this looks as if it is just one icon file that's causing problems while all others work.

comment:10 Changed 7 years ago by mvglasow (2)

Yesterday I also noticed one of the icons in the POI search rendering as garbage (still have to find out which). Seems we have some bitmap images that will not render correctly on WinCE, while (most) others do.

comment:11 Changed 7 years ago by mvglasow (2)

  • Component changed from osd/core to core
  • Keywords XPM added
  • Summary changed from navigation_next_turn renders to garbage in wince port to XPM icons render to garbage in WinCE and Windows ports

Investigated more deeply into the issue, with the following results:

  • Both the WinCE and Win32 ports are affected (tested with r4710 on Windows XP).
  • The affected icon in POI search is the one for "other", which appears to be "unknown.xpm". I've also tried Android, where it renders correctly, but on the Windows ports it renders as garbage. Some features of the icon are still visible, but the dimensions seem incorrect (it appears to be twice as tall as it is wide, while the original icon should be square-sized).
  • The xpm directory of the Windows port contains some XPM images with no corresponding PNG icons, "unknown.xpm" is one of them.
  • When I open "unknown.xpm" with GIMP, convert it to PNG and save it as "unknown.png", then restart Navit, the icon renders correctly.
  • On Android, I sometimes get the "unknown" icon as a turn instruction.


  • It's not an OSD issue as it occurs also in internal GUI dialogs; hence I'm changing the component to "core".
  • The issue seems to occur whenever XPM icons are involved.
  • The WinCE/Win32 code does handle XPM, but the code is broken.
  • Unless icon files are explicitly specified, Navit tries a few extensions. XPM images will be used if PNGs are not available.
  • The Windows ports ship with some XPMs which have no PNG counterpart.
  • Bitmap images for some turn instructions seem to be missing, resulting in "unknown.*" being used as a substitute.

Possible solutions:

  • As a workaround: Make sure PNG versions of all images are available in the Windows ports. That way Navit will never need to fall back to XPM on those platforms, and Navit "as shipped" should not have any more issues. The underlying bug will still be there, though.
  • Permanent fix: Find and fix the bug in the XPM code for Windows.
  • Make sure we have icons for every possible turn instruction. (This is in fact a separate issue, see #925 for this.)

Changed 7 years ago by mvglasow (2)

XPM rendering incorrectly on Win32 port

comment:12 Changed 7 years ago by mvglasow (2)

Copied over from #967 on the same issue:


The problem seems to be related to [...] xpm/unknown.xpm. The file is not corrupted, but Navit apparently cannot display it properly. The problem appears to be that it is relatively small (13x14 pixels).

I tried replacing xpm/unknown.xpm by a magnified version:

  • If I scale unknown.xpm to 48x48 px (like the other icons on the screen, which appear correctly) and convert it to PNG, then it is shown correctly.
  • If I scale it to 48x48 px, but leave it as XPM, then it is also shown correctly, but in the wrong position (shifted to the right and down by about half its height/width). Apparently the origin is calculated differently for XPM files (?).

comment:13 Changed 7 years ago by tryagain

  • Resolution set to fixed
  • Status changed from reopened to closed

XPM images on Win* should be displayed correctly since r4859.

Note: See TracTickets for help on using tickets.