Page 1 of 1

Xaml image atlas noobie question

Posted: 21 Feb 2014, 23:15
by rcalt2vt
I'm just getting started diving into Xaml and Noesis gui, and got to say really liking it so far. I'm running into something that isn't an issue with Noesis, but is causing me some heartache and thought those with experience might know what I am doing wrong.

The problem I am having is that in Blend and in Kaxaml, any Rectangle object using a fill from the image atlas is rendering in the preview as off, how off depends on the texture size used. It renders just fine using Noesis gui through unity though. I'm generating the image atlas using Texture Packer and the Xaml data format found on the Noesis gui github page.

Thoughts?

Also, how do I go about getting this forum account flagged as a Unity license user?

Re: Xaml image atlas noobie question

Posted: 21 Feb 2014, 23:39
by wckdspn
What's the DPI on the image?

Re: Xaml image atlas noobie question

Posted: 22 Feb 2014, 00:05
by rcalt2vt
72 dpi at 2048 x 2048, The odd part is, the way it looks (even though it's not correct) is the same in Blend and Kaxaml. Viewing it in Unity though with NoesisGUI and everything looks correct. Not a big deal, but slows down building UIs.

Xaml code is:
<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid>  
    <Grid.Resources>
      <ResourceDictionary Source="ArtTextureAtlas.xaml"/>
    </Grid.Resources>
  
    <Rectangle Fill="{StaticResource win_bkgr}" Width="454" Height="697"/>
    <Rectangle Fill="{StaticResource AbBar_Main}" Width="742" Height="120" VerticalAlignment="Bottom" />
  </Grid>
</Page>
Image Resource is:
<!-- Created using Noesis XAML exporter for TexturePacker (http://www.texturepacker.com) -->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ImageBrush x:Key="AbBar_Main" ImageSource="ArtTextureAtlasXaml.png" Viewbox="2,2,742,120" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="win_bkgr" ImageSource="ArtTextureAtlasXaml.png" Viewbox="1293,2,454,697" ViewboxUnits="Absolute" Stretch="Fill"/>
...
...
</ResourceDictionary>

Re: Xaml image atlas noobie question

Posted: 22 Feb 2014, 00:13
by wckdspn
WPF sizes everything by "virtual" pixels, such that 96 virtual pixels fit in one inch (then adjusts actual pixels when rendering). Try either A) removing DPI info from the image (if it is, for example, a PNG), or B) setting it to 96 DPI and see what effect that has.

Re: Xaml image atlas noobie question

Posted: 22 Feb 2014, 00:17
by rcalt2vt
I just have to say, I love you for that bit of info...and that has one of the more annoying things I've seen in a framework. Thanks man, switching the image to 96dpi resolved it.

Re: Xaml image atlas noobie question

Posted: 22 Feb 2014, 12:46
by jsantos
Also, how do I go about getting this forum account flagged as a Unity license user?
I have contacted you in private about this.