Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/VB/ControlsDemo/Effects/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/VB/ControlsDemo/Effects/Effects.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Effects

Namespace ControlsDemo
	Public Class RippleEffect
		Inherits ShaderEffect
		Public Shared ReadOnly InputProperty As DependencyProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", GetType(RippleEffect), 0)
		Public Shared ReadOnly CenterProperty As DependencyProperty = DependencyProperty.Register("Center", GetType(Point), GetType(RippleEffect), New PropertyMetadata(New Point(0.5, 0.5), PixelShaderConstantCallback(0)))
		Public Shared ReadOnly AmplitudeProperty As DependencyProperty = DependencyProperty.Register("Amplitude", GetType(Double), GetType(RippleEffect), New PropertyMetadata(0.1, PixelShaderConstantCallback(1)))
		Public Shared ReadOnly FrequencyProperty As DependencyProperty = DependencyProperty.Register("Frequency", GetType(Double), GetType(RippleEffect), New PropertyMetadata(0.0, PixelShaderConstantCallback(2)))
		Public Shared ReadOnly PhaseProperty As DependencyProperty = DependencyProperty.Register("Phase", GetType(Double), GetType(RippleEffect), New PropertyMetadata(0.0, PixelShaderConstantCallback(3)))
		Public Shared ReadOnly AspectRatioProperty As DependencyProperty = DependencyProperty.Register("AspectRatio", GetType(Double), GetType(RippleEffect), New PropertyMetadata(1.0, PixelShaderConstantCallback(4)))

		Public Property Input() As Brush
			Get
				Return CType(GetValue(InputProperty), Brush)
			End Get
			Set(ByVal value As Brush)
				SetValue(InputProperty, value)
			End Set
		End Property
		Public Property Center() As Point
			Get
				Return CType(GetValue(CenterProperty), Point)
			End Get
			Set(ByVal value As Point)
				SetValue(CenterProperty, value)
			End Set
		End Property
		Public Property Amplitude() As Double
			Get
				Return CDbl(GetValue(AmplitudeProperty))
			End Get
			Set(ByVal value As Double)
				SetValue(AmplitudeProperty, value)
			End Set
		End Property
		Public Property Frequency() As Double
			Get
				Return CDbl(GetValue(FrequencyProperty))
			End Get
			Set(ByVal value As Double)
				SetValue(FrequencyProperty, value)
			End Set
		End Property
		Public Property Phase() As Double
			Get
				Return CDbl(GetValue(PhaseProperty))
			End Get
			Set(ByVal value As Double)
				SetValue(PhaseProperty, value)
			End Set
		End Property
		Public Property AspectRatio() As Double
			Get
				Return CDbl(GetValue(AspectRatioProperty))
			End Get
			Set(ByVal value As Double)
				SetValue(AspectRatioProperty, value)
			End Set
		End Property

		Public Sub New()
			Dim pixelShader As New PixelShader()
			pixelShader.UriSource = New Uri("/ControlsDemo;component/Effects/Shaders/Ripple.ps", UriKind.Relative)
			Me.PixelShader = pixelShader
			UpdateShaderValue(InputProperty)
			UpdateShaderValue(CenterProperty)
			UpdateShaderValue(AmplitudeProperty)
			UpdateShaderValue(FrequencyProperty)
			UpdateShaderValue(PhaseProperty)
			UpdateShaderValue(AspectRatioProperty)
		End Sub
	End Class
	Public Class LightStreakEffect
		Inherits ShaderEffect
		Public Shared ReadOnly InputProperty As DependencyProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", GetType(LightStreakEffect), 0)
		Public Shared ReadOnly BrightThresholdProperty As DependencyProperty = DependencyProperty.Register("BrightThreshold", GetType(Double), GetType(LightStreakEffect), New PropertyMetadata((CDbl(0.5)), PixelShaderConstantCallback(0)))
		Public Shared ReadOnly ScaleProperty As DependencyProperty = DependencyProperty.Register("Scale", GetType(Double), GetType(LightStreakEffect), New PropertyMetadata((CDbl(0.5)), PixelShaderConstantCallback(1)))
		Public Shared ReadOnly AttenuationProperty As DependencyProperty = DependencyProperty.Register("Attenuation", GetType(Double), GetType(LightStreakEffect), New PropertyMetadata((CDbl(0.25)), PixelShaderConstantCallback(2)))
		Public Shared ReadOnly DirectionProperty As DependencyProperty = DependencyProperty.Register("Direction", GetType(Point), GetType(LightStreakEffect), New PropertyMetadata(New Point(0.5, 1), PixelShaderConstantCallback(3)))
		Public Shared ReadOnly InputSizeProperty As DependencyProperty = DependencyProperty.Register("InputSize", GetType(Size), GetType(LightStreakEffect), New PropertyMetadata(New Size(800, 600), PixelShaderConstantCallback(4)))

		Public Property Input() As Brush
			Get
				Return (CType(GetValue(InputProperty), Brush))
			End Get
			Set(ByVal value As Brush)
				SetValue(InputProperty, value)
			End Set
		End Property
		Public Property BrightThreshold() As Double
			Get
				Return (CDbl(GetValue(BrightThresholdProperty)))
			End Get
			Set(ByVal value As Double)
				SetValue(BrightThresholdProperty, value)
			End Set
		End Property
		Public Property Scale() As Double
			Get
				Return (CDbl(GetValue(ScaleProperty)))
			End Get
			Set(ByVal value As Double)
				SetValue(ScaleProperty, value)
			End Set
		End Property
		Public Property Attenuation() As Double
			Get
				Return (CDbl(GetValue(AttenuationProperty)))
			End Get
			Set(ByVal value As Double)
				SetValue(AttenuationProperty, value)
			End Set
		End Property
		Public Property Direction() As Point
			Get
				Return (CType(GetValue(DirectionProperty), Point))
			End Get
			Set(ByVal value As Point)
				SetValue(DirectionProperty, value)
			End Set
		End Property
		Public Property InputSize() As Size
			Get
				Return (CType(GetValue(InputSizeProperty), Size))
			End Get
			Set(ByVal value As Size)
				SetValue(InputSizeProperty, value)
			End Set
		End Property

		Public Sub New()
			Dim pixelShader As New PixelShader()
			pixelShader.UriSource = New Uri("/ControlsDemo;component/Effects/Shaders/LightStreak.ps", UriKind.Relative)
			Me.PixelShader = pixelShader
			UpdateShaderValue(InputProperty)
			UpdateShaderValue(BrightThresholdProperty)
			UpdateShaderValue(ScaleProperty)
			UpdateShaderValue(AttenuationProperty)
			UpdateShaderValue(DirectionProperty)
			UpdateShaderValue(InputSizeProperty)
		End Sub
	End Class
End Namespace