Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Texture brush? (Read 4956 times)
andy.w
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Mar 28th, 2013
Texture brush?
Apr 17th, 2013 at 6:59am
Print Post  
I need some help on how to achieve a texture brush?  Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Texture brush?
Reply #1 - Apr 17th, 2013 at 7:12am
Print Post  
Check WPF ImageBrush and DrawingBrush classes:
http://msdn.microsoft.com/en-us/library/system.windows.media.imagebrush.aspx
http://msdn.microsoft.com/en-us/library/system.windows.media.drawingbrush.aspx

or if you need this for ShapeNodes, you could set their Image property and ImageAlign=Tile instead of Brush.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Texture brush?
Reply #2 - Apr 24th, 2013 at 9:04am
Print Post  
Stoyo wrote on Apr 17th, 2013 at 7:12am:
if you need this for ShapeNodes, you could set their Image property and ImageAlign=Tile instead of Brush.

I hope that helps,
Stoyan


Interesting idea: converting some nice .svg (per e.g. http://sharpvectors.codeplex.com/) to XAML <Viewbox><Image><Image.Sourcfe><DrawingImage>.. Drawing .. DrawingGroup .. (Geometry) </..>

we could potentially replace the Shapenode looks by image-drawn vector looks of .svg?

Probably ImageAlign = Fit; or somehow completely overwrite the shapenode geometry per vector image...?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Texture brush?
Reply #3 - Apr 24th, 2013 at 10:07am
Print Post  
You can set Transparent = true to completely hide a ShapeNode's geometry and keep only Image and Text visible.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Texture brush?
Reply #4 - Apr 25th, 2013 at 10:11am
Print Post  
I'm not so sure what is the best way to handle VECTOR Image resources in WPF/XAML world...

my vector drawings are packed in Viewbox, but the Image itself has a XAML name, like e.g.:

Code
Select All
      <Viewbox  Stretch="Uniform"  Width="100" Height="100" >
                    <Image  x:Name="ShapeNodeImg" Height="132" Width="226">
                        <Image.Source>
                            <DrawingImage>
                                <DrawingImage.Drawing>
                                    <DrawingGroup    ... here follows the Geometry etc 



but the Image property of ShapeNode needs ImageSource.

Any idea how to instantiate/use a number of such vector geomery (guess DrawingImage) resources?
Ideally (or shortest) would be if we could assign the Image direct in XAML to the DiagramNodes, sort of:

<diag:Diagram.Nodes >

<diag:ShapeNode Name="Start" Bounds="20,35,150,80" Image="ShapeNodeImg" Text="Start" TextAlignment="Center" />

?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Texture brush?
Reply #5 - Apr 25th, 2013 at 2:38pm
Print Post  
You could add your DrawingImages to the window resource dictionary, and later access it via key:

Code
Select All
<Window.Resources>
	<DrawingImage x:Key="img1">
	...

<diag:ShapeNode ... Image="{StaticResource img1}" ... />
 



You could as well define the whole image under a ShapeNode.Image Xaml element, same way as in your Viewbox / Image.Source example.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Texture brush?
Reply #6 - Apr 25th, 2013 at 4:28pm
Print Post  
yes, thx much - good tip Smiley

they are then accessible also from code behind per e.g.

Code
Select All
Image = ((DrawingImage)Application.Current.Resources["img1"]);  


cheers
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint