User avatar
stonstad
Topic Author
Posts: 170
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

ResourceDictionary Texture Optimization

25 Aug 2021, 16:30

Hello! Hoping you are all well. Noesis is terrific and it is a joy to work with. I have an optimization question.

If I have a resource dictionary with definitions as follows:
<ImageBrush x:Key="Window_0_TL" ImageSource="Images/window chrome/popup/background_x1.png" ViewboxUnits="Absolute" Viewbox="0,0,20,20"/>
<ImageBrush x:Key="Window_0_T" ImageSource="Images/window chrome/popup/background_x1.png" ViewboxUnits="Absolute" Viewbox="20,0,426,20"/>
<ImageBrush x:Key="Window_0_TR" ImageSource="Images/window chrome/popup/background_x1.png" ViewboxUnits="Absolute" Viewbox="446,0,20,20"/>
...

Is this internally stored as a single texture? More specifically, is it 1x or 3x memory usage?


If I have a resource dictionary with definitions as follows:
<ImageBrush x:Key="Fwd Light_Light" ImageSource="Images/context menu/actions/light/light.png" Stretch="None"/>
<ImageBrush x:Key="Lnd Light_Light" ImageSource="Images/context menu/actions/light/light.png" Stretch="None"/>
Is this internally stored as one texture or two? More specifically, is it 1x or 2x memory usage?

Thanks!

Tags:
 
User avatar
jsantos
Site Admin
Posts: 3309
Joined: 20 Jan 2012, 17:18
Contact:

Re: ResourceDictionary Texture Optimization

26 Aug 2021, 17:45

We don't create extra textures. so if you have one texture in Unity, that the one we are using internally. So, in both examples you provided we are always using one texture and 1x memory usage.

Note that since 3.1, Sprites are supported in DataContexts and accessible to ImageSource properties in XAML using data-binding. See our Inventory sample.
Or if you prefer you can also use CroppedBitmap in XAML.
 
User avatar
stonstad
Topic Author
Posts: 170
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: ResourceDictionary Texture Optimization

27 Aug 2021, 16:15

Understood, thank you!

Who is online

Users browsing this forum: Google [Bot] and 2 guests