├── .editorconfig
├── .github
├── dependabot.yml
└── workflows
│ └── ci.yml
├── .gitignore
├── KaxamlPlugins
├── .editorconfig
├── Controls
│ ├── AlphaChooser.cs
│ ├── Coerce.cs
│ ├── ColorChangedEventArgs.cs
│ ├── ColorPicker.cs
│ ├── ColorPickerUtil.cs
│ ├── CursorAdorner.cs
│ ├── DropDownColorPicker.cs
│ ├── ElementCursorDecorator.cs
│ ├── HueChooser.cs
│ └── SaturationBrightnessChooser.cs
├── KaxamlPlugins.csproj
├── Properties
│ └── AssemblyInfo.cs
├── RoundConverter.cs
└── Themes
│ └── generic.xaml
├── LICENSE
├── README.md
├── Settings.XamlStyler
├── Shazzam.sln
├── Shazzam.sln.DotSettings
├── Shazzam
├── .editorconfig
├── App.xaml
├── App.xaml.cs
├── CodeGen
│ ├── CodeParser.cs
│ ├── CompilerException.cs
│ ├── Register.cs
│ ├── ShaderClass.cs
│ ├── ShaderCompiler.cs
│ ├── ShaderModel.cs
│ └── ShaderProfile.cs
├── Commands
│ ├── AppCommands.cs
│ ├── RelayCommand.cs
│ └── RelayCommand`1.cs
├── Constants.cs
├── Controls
│ ├── AdjustableColor.xaml
│ ├── AdjustableColor.xaml.cs
│ ├── AdjustableSlider.xaml
│ ├── AdjustableSlider.xaml.cs
│ ├── AdjustableSliderPair.xaml
│ ├── AdjustableSliderPair.xaml.cs
│ ├── AdjustableSliderQuadruplet.xaml
│ ├── AdjustableSliderQuadruplet.xaml.cs
│ ├── AdjustableSliderTriplet.xaml
│ ├── AdjustableSliderTriplet.xaml.cs
│ ├── HorizontalRevealMode.cs
│ ├── Icons.xaml
│ ├── Icons.xaml.cs
│ ├── IndexOddEven.cs
│ ├── IndexingStackPanel.cs
│ ├── RangeControl.xaml
│ ├── RangeControl.xaml.cs
│ ├── Reveal.cs
│ ├── SelectionLocation.cs
│ ├── StackLocation.cs
│ ├── TextureMapLocator.cs
│ ├── TexturePicker.xaml
│ ├── TexturePicker.xaml.cs
│ └── VerticalRevealMode.cs
├── Converters
│ ├── AnyToVisibilityConverter.cs
│ ├── DoubleToStringConverter.cs
│ ├── EqualityConverter.cs
│ ├── InvertBooleanConverter.cs
│ ├── RegisterTemplateSelector.cs
│ ├── RegisterValueConverter.cs
│ ├── StretchToIsCheckedConverter.cs
│ ├── StringToVisibilityConverter.cs
│ ├── UniversalTemplateSelector.cs
│ └── VisiblityToVisibilityConverter.cs
├── D3DCompiler_40.dll
├── D3DX9_40.dll
├── D3DX9_40_64bit.dll
├── Fonts
│ ├── Candara.ttf
│ ├── Miramo.ttf
│ └── Peric.ttf
├── Helpers
│ ├── ColorExtensions.cs
│ ├── Hsv.cs
│ └── VersionHelper.cs
├── Images
│ ├── ColorRange.png
│ ├── Default
│ │ ├── ColorRange.png
│ │ ├── Geese.jpg
│ │ └── crystal.jpg
│ ├── Fire1.jpg
│ ├── Light1.jpg
│ ├── SpikeBalls.jpg
│ ├── Star.png
│ ├── SwirlLogo2.png
│ ├── TextureMaps
│ │ ├── bubbles.png
│ │ ├── cactus.jpg
│ │ ├── clouds.png
│ │ ├── clover.png
│ │ ├── color_range.png
│ │ ├── curlique.png
│ │ ├── curlique_small.png
│ │ ├── flower.png
│ │ ├── fractal_bands.png
│ │ ├── fractal_butterfly.png
│ │ ├── fractal_centerband.png
│ │ ├── fractal_curls.png
│ │ ├── fractal_edge.png
│ │ ├── fractal_flame.png
│ │ ├── glassblocks_big.png
│ │ ├── glassblocks_medium.png
│ │ ├── glassblocks_simple.png
│ │ ├── koch_cubist.png
│ │ ├── koch_snowflake.png
│ │ ├── mawn.png
│ │ ├── moire.png
│ │ ├── noise.png
│ │ ├── noise_bumpy.png
│ │ ├── noise_weave.png
│ │ ├── oil_slick.png
│ │ ├── paise.png
│ │ ├── paise2.png
│ │ ├── peaks_horizontal.png
│ │ ├── peaks_vertical.png
│ │ ├── ring_center.png
│ │ ├── ripple.png
│ │ ├── rippled_glass.png
│ │ ├── river.png
│ │ ├── sand.png
│ │ ├── streaks_aurora.png
│ │ ├── streaks_grass.png
│ │ ├── streaks_vertical.png
│ │ ├── swirly.png
│ │ ├── waves_horizontal.png
│ │ ├── waves_vertical.png
│ │ └── whirlpool.png
│ ├── cactus.jpg
│ ├── connect.png
│ ├── disconnect.png
│ ├── disk.png
│ ├── gears.jpg
│ ├── help.ico
│ ├── lines.jpg
│ ├── logo.ico
│ ├── page_copy.png
│ ├── plasma.wmv
│ └── square.png
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MainWindowViewModel.cs
├── Plugins
│ ├── FileLoaderViewer.xaml
│ ├── FileLoaderViewer.xaml.cs
│ ├── SettingsPlugin.xaml
│ └── SettingsPlugin.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ ├── Settings.cs
│ └── Settings.settings
├── Resources
│ ├── Brushes.xaml
│ ├── Button.xaml
│ ├── ComboBox.xaml
│ ├── Geometry.xaml
│ ├── HLSLSyntax.xshd
│ ├── Menu.xaml
│ ├── PluginTheme.xaml
│ ├── ScrollBar.xaml
│ ├── Slider.xaml
│ └── TabControl.xaml
├── Samples
│ ├── 1_SampleSyntax.fx
│ ├── AngularGradient.fx
│ ├── ApplyTextureMap.fx
│ ├── BandedSwirl.fx
│ ├── BandedSwirl_PS3.fx
│ ├── Bands.fx
│ ├── Bloom.fx
│ ├── BrightExtract.fx
│ ├── Circles.fx
│ ├── Circles2.fx
│ ├── ColorKeyAlpha.fx
│ ├── ColorTone.fx
│ ├── ContrastAdjust.fx
│ ├── Desaturate.fx
│ ├── DirectionalBlur.fx
│ ├── Embossed.fx
│ ├── Fade.fx
│ ├── FrostyOutline.fx
│ ├── Generative_Bands.fx
│ ├── Generative_Mandlebrot1.fx
│ ├── Generative_Star.fx
│ ├── GlassTiles.fx
│ ├── Gloom.fx
│ ├── GrowablePoissonDisk.fx
│ ├── HslWheel.fx
│ ├── HsvWheel.fx
│ ├── InvertColor.fx
│ ├── LightStreak.fx
│ ├── LinearGradient.fx
│ ├── Magnify.fx
│ ├── Mask.fx
│ ├── Monochrome.fx
│ ├── MultiInput_ColorChannels.fx
│ ├── MultiInput_FourSources.fx
│ ├── MultiInput_MergeImages.fx
│ ├── MultiInput_Shift.fx
│ ├── New.txt
│ ├── OldMovie.fx
│ ├── PaperFold.fx
│ ├── PaperFoldModded.fx
│ ├── ParametricEdgeDetection.fx
│ ├── Pinch.fx
│ ├── Pivot1.fx
│ ├── Pixelate.fx
│ ├── Ripple.fx
│ ├── Sharpen.fx
│ ├── SketchGranite.fx
│ ├── SketchPencilStroke.fx
│ ├── SmoothMagnify.fx
│ ├── Splinter.fx
│ ├── Swirl.fx
│ ├── Tiler.fx
│ ├── ToneMapping.fx
│ ├── ToonShader.fx
│ ├── Transition_BandedSwirl.fx
│ ├── Transition_Blinds.fx
│ ├── Transition_Blood.fx
│ ├── Transition_CircleReveal.fx
│ ├── Transition_CircleStretch.fx
│ ├── Transition_CircularBlur.fx
│ ├── Transition_CloudReveal.fx
│ ├── Transition_Crumble.fx
│ ├── Transition_Disolve.fx
│ ├── Transition_Drop.fx
│ ├── Transition_Fade.fx
│ ├── Transition_LeastBright.fx
│ ├── Transition_LineReveal.fx
│ ├── Transition_MostBright.fx
│ ├── Transition_Pixelate.fx
│ ├── Transition_PixelateIn.fx
│ ├── Transition_PixelateOut.fx
│ ├── Transition_RadialBlur.fx
│ ├── Transition_RadialWiggle.fx
│ ├── Transition_RandomCircleReveal.fx
│ ├── Transition_Ripple.fx
│ ├── Transition_RotateCrumble.fx
│ ├── Transition_Saturate.fx
│ ├── Transition_Shrink.fx
│ ├── Transition_SlideIn.fx
│ ├── Transition_Smooth.fx
│ ├── Transition_Swirl.fx
│ ├── Transition_SwirlGrid.fx
│ ├── Transition_SwirlGrid_PS3.fx
│ ├── Transition_Water.fx
│ ├── Transition_Wave.fx
│ ├── TransparentAlternatingPixels.fx
│ ├── TransparentAlternatingPixelsMultiplied.fx
│ ├── TransparentAlternatingScanlines.fx
│ ├── Warp.fx
│ ├── WaveWarper.fx
│ ├── ZoomBlur.fx
│ └── shared.hlsli
├── Shazzam.csproj
├── Shazzam.csproj.DotSettings
├── ShazzamSwitchboard.cs
├── TargetFramework.cs
├── Tutorials
│ ├── 01a_WhatIsAShader.fx
│ ├── 01b_PartsOfAShader.fx
│ ├── 02_ChangeColor.fx
│ ├── 03a_Variables.fx
│ ├── 03b_Swizzling.fx
│ ├── 04a_AddColorParameters.fx
│ ├── 04b_AddColorParameters.fx
│ ├── 04c_TexturesVia_S_Registers.fx
│ ├── 04d_InputVia_C_Registers.fx
│ ├── 05_AddShazzamTags.fx
│ ├── 06_SwapColors.fx
│ ├── 07a_ChangePosition.fx
│ ├── 07b_ChangePosition.fx
│ ├── 07c_AddShazzamTags.fx
│ ├── 08a_SwapPosition.fx
│ ├── 08b_FlipPosition.fx
│ ├── 09a_MorphNearbyPixels.fx
│ ├── 13_UsingDXFunctions.fx
│ └── 14_PS3.fx
├── Views
│ ├── AboutView.xaml
│ ├── AboutView.xaml.cs
│ ├── CodeTabsView.xaml
│ ├── CodeTabsView.xaml.cs
│ ├── CodeViewModel.cs
│ ├── Fav2.png
│ ├── Plugin.cs
│ ├── PluginView.xaml
│ ├── PluginView.xaml.cs
│ ├── check.png
│ ├── greentarget.png
│ └── info.png
├── app.config
└── d3dx10_40.dll
├── ShazzamUnitTests
├── .editorconfig
├── CodeGen
│ └── ShaderModelTests.cs
├── MainWindowVmUnitTest.cs
├── Sandbox
│ ├── AngleTests.cs
│ ├── Hlsl.cs
│ ├── InterpolateTests.cs
│ └── LerpRgbaTests.cs
└── ShazzamUnitTests.csproj
└── appveyor.yml
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 | runs-on: windows-latest
8 |
9 | steps:
10 | - uses: actions/checkout@v3
11 | - name: setup
12 | uses: actions/setup-dotnet@v3
13 | with:
14 | dotnet-version: 7.0.x
15 | - name: restore
16 | run: dotnet restore
17 | - name: build
18 | run: dotnet build --configuration Release --no-restore
19 | - name: test
20 | run: dotnet test --configuration Release --no-build
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | Thumbs.db
3 | *.obj
4 | *.exe
5 | *.pdb
6 | *.user
7 | *.aps
8 | *.pch
9 | *.vspscc
10 | *_i.c
11 | *_p.c
12 | *.ncb
13 | *.suo
14 | *.sln.docstates
15 | *.tlb
16 | *.tlh
17 | *.bak
18 | *.cache
19 | *.ilk
20 | *.log
21 | [Bb]in
22 | [Dd]ebug*/
23 | *.lib
24 | *.sbr
25 | obj/
26 | [Rr]elease*/
27 | _ReSharper*/
28 | [Tt]est[Rr]esult*
29 | *.vssscc
30 | $tf*/
31 | packages/*
32 | publish/*
33 | .vs/*
34 | Shazzam/packages/*
35 |
--------------------------------------------------------------------------------
/KaxamlPlugins/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # Default severity for analyzer diagnostics with category 'StyleCop.CSharp.DocumentationRules'
4 | dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
5 | # SA0001: XML comment analysis is disabled due to project configuration
6 | dotnet_diagnostic.SA0001.severity = none
7 |
8 | # WPF0060: Backing member for DependencyProperty should have standard documentation text.
9 | dotnet_diagnostic.WPF0060.severity = none
10 | # WPF0108: Backing member for RoutedEvent should have standard documentation text.
11 | dotnet_diagnostic.WPF0108.severity = none
12 |
--------------------------------------------------------------------------------
/KaxamlPlugins/Controls/Coerce.cs:
--------------------------------------------------------------------------------
1 | namespace KaxamlPlugins.Controls
2 | {
3 | public static class Coerce
4 | {
5 | public static object? ClampDouble(object? value, double min, double max)
6 | {
7 | if (value is double d)
8 | {
9 | if (d < min)
10 | {
11 | return min;
12 | }
13 |
14 | if (d > max)
15 | {
16 | return max;
17 | }
18 | }
19 |
20 | return value;
21 | }
22 |
23 | public static object? ClampInt(object? value, int min, int max)
24 | {
25 | if (value is double d)
26 | {
27 | if (d < min)
28 | {
29 | return min;
30 | }
31 |
32 | if (d > max)
33 | {
34 | return max;
35 | }
36 | }
37 |
38 | return value;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/KaxamlPlugins/Controls/ColorChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace KaxamlPlugins.Controls
2 | {
3 | using System.Windows;
4 | using System.Windows.Media;
5 |
6 | public class ColorChangedEventArgs : RoutedEventArgs
7 | {
8 | public ColorChangedEventArgs(RoutedEvent routedEvent, Color color)
9 | {
10 | this.RoutedEvent = routedEvent;
11 | this.Color = color;
12 | }
13 |
14 | public Color Color { get; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/KaxamlPlugins/Controls/CursorAdorner.cs:
--------------------------------------------------------------------------------
1 | namespace KaxamlPlugins.Controls
2 | {
3 | using System.Windows;
4 | using System.Windows.Documents;
5 | using System.Windows.Media;
6 |
7 | public sealed class CursorAdorner : Adorner
8 | {
9 | private readonly UIElement cursor;
10 |
11 | private Point offset;
12 |
13 | public CursorAdorner(ElementCursorDecorator owner, UIElement cursor)
14 | : base(owner)
15 | {
16 | this.cursor = cursor;
17 | this.AddVisualChild(cursor);
18 | }
19 |
20 | public Point Offset
21 | {
22 | get => this.offset;
23 | set
24 | {
25 | this.offset = value;
26 | this.InvalidateArrange();
27 | }
28 | }
29 |
30 | protected override int VisualChildrenCount => 1;
31 |
32 | protected override Visual GetVisualChild(int index)
33 | {
34 | return this.cursor;
35 | }
36 |
37 | protected override Size ArrangeOverride(Size finalSize)
38 | {
39 | this.cursor.Arrange(new Rect(this.Offset, this.cursor.DesiredSize));
40 | return finalSize;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/KaxamlPlugins/Controls/DropDownColorPicker.cs:
--------------------------------------------------------------------------------
1 | namespace KaxamlPlugins.Controls
2 | {
3 | using System.Windows;
4 |
5 | public class DropDownColorPicker : ColorPicker
6 | {
7 | static DropDownColorPicker()
8 | {
9 | DefaultStyleKeyProperty.OverrideMetadata(typeof(DropDownColorPicker), new FrameworkPropertyMetadata(typeof(DropDownColorPicker)));
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/KaxamlPlugins/KaxamlPlugins.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net48
4 | library
5 | true
6 | latest
7 | Enable
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/KaxamlPlugins/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | [assembly: AssemblyTitle("KaxamlPlugins")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("KaxamlPlugins")]
10 | [assembly: AssemblyCopyright("Copyright @ 2007")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 | [assembly: ComVisible(false)]
14 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
15 | [assembly: AssemblyVersion("1.0.0")]
16 |
--------------------------------------------------------------------------------
/KaxamlPlugins/RoundConverter.cs:
--------------------------------------------------------------------------------
1 | namespace KaxamlPlugins
2 | {
3 | using System;
4 | using System.Globalization;
5 | using System.Windows.Data;
6 |
7 | [ValueConversion(typeof(string), typeof(double))]
8 | [ValueConversion(typeof(double), typeof(double))]
9 | public sealed class RoundConverter : IValueConverter
10 | {
11 | public static readonly RoundConverter Default = new();
12 |
13 | object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | return value switch
16 | {
17 | string s
18 | when double.TryParse(s, out var d)
19 | => Math.Round(d, 2),
20 | double d => Math.Round(d, 2),
21 | _ => value,
22 | };
23 | }
24 |
25 | object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26 | {
27 | return value;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Shazzam
2 | A fork of https://shazzam.codeplex.com/
3 |
4 | [](https://ci.appveyor.com/project/JohanLarsson/shazzam/branch/master)
5 |
--------------------------------------------------------------------------------
/Settings.XamlStyler:
--------------------------------------------------------------------------------
1 | {
2 | "AttributesTolerance": 2,
3 | "KeepFirstAttributeOnSameLine": true,
4 | "MaxAttributeCharatersPerLine": 0,
5 | "MaxAttributesPerLine": 1,
6 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
7 | "SeparateByGroups": false,
8 | "AttributeIndentation": 0,
9 | "AttributeIndentationStyle": 1,
10 | "RemoveDesignTimeReferences": false,
11 | "EnableAttributeReordering": true,
12 | "AttributeOrderingRuleGroups": [
13 | "x:Class",
14 | "xmlns, xmlns:x",
15 | "xmlns:*",
16 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
17 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
18 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
19 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
20 | "*:*, *",
21 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
22 | "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
23 | "Storyboard.*, From, To, Duration"
24 | ],
25 | "FirstLineAttributes": "",
26 | "OrderAttributesByName": true,
27 | "PutEndingBracketOnNewLine": false,
28 | "RemoveEndingTagOfEmptyElement": true,
29 | "SpaceBeforeClosingSlash": true,
30 | "RootElementLineBreakRule": 0,
31 | "ReorderVSM": 2,
32 | "ReorderGridChildren": true,
33 | "ReorderCanvasChildren": false,
34 | "ReorderSetters": 0,
35 | "FormatMarkupExtension": true,
36 | "NoNewLineMarkupExtensions": "x:Bind, Binding",
37 | "ThicknessSeparator": 2,
38 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
39 | "FormatOnSave": false,
40 | "CommentPadding": 2,
41 | }
--------------------------------------------------------------------------------
/Shazzam.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
3 | True
4 | True
5 | True
6 | True
7 | True
--------------------------------------------------------------------------------
/Shazzam/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # Default severity for analyzer diagnostics with category 'StyleCop.CSharp.DocumentationRules'
4 | dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
5 | # SA0001: XML comment analysis is disabled due to project configuration
6 | dotnet_diagnostic.SA0001.severity = none
7 |
8 | # WPF0060: Backing member for DependencyProperty should have standard documentation text.
9 | dotnet_diagnostic.WPF0060.severity = none
10 | # WPF0061: Accessor method for attached property should have standard documentation text.
11 | dotnet_diagnostic.WPF0061.severity = none
12 | # WPF0108: Backing member for RoutedEvent should have standard documentation text.
13 | dotnet_diagnostic.WPF0108.severity = none
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Shazzam/CodeGen/CompilerException.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.CodeGen
2 | {
3 | using System;
4 |
5 | [Serializable]
6 | public class CompilerException : Exception
7 | {
8 | public CompilerException()
9 | : base()
10 | {
11 | }
12 |
13 | public CompilerException(string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public CompilerException(string message, Exception inner)
19 | : base(message, inner)
20 | {
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Shazzam/CodeGen/ShaderProfile.cs:
--------------------------------------------------------------------------------
1 | // contributed by jeremiah.morrill@gmail.com
2 |
3 | // http://www.windows-tech.info/4/0311d2b4778d6ebe.php
4 | // Access is denied.
5 | // http://stackoverflow.com/questions/666799/embedding-unmanaged-dll-into-a-managed-c-dll
6 | namespace Shazzam.CodeGen
7 | {
8 | public enum ShaderProfile
9 | {
10 | PixelShader2,
11 | PixelShader3,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Shazzam/Commands/AppCommands.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Commands
2 | {
3 | using System.Windows.Input;
4 |
5 | public static class AppCommands
6 | {
7 | public static readonly RoutedUICommand Exit = new(
8 | "Exit",
9 | "Exit",
10 | typeof(AppCommands));
11 |
12 | public static readonly RoutedUICommand OpenImage = new(
13 | "Open Image",
14 | "OpenImage",
15 | typeof(AppCommands),
16 | new InputGestureCollection { new KeyGesture(Key.I, ModifierKeys.Control) });
17 |
18 | public static readonly RoutedUICommand OpenMedia = new(
19 | "Open Media",
20 | "OpenMedia",
21 | typeof(AppCommands),
22 | new InputGestureCollection { new KeyGesture(Key.M, ModifierKeys.Control) });
23 |
24 | public static readonly RoutedUICommand RemoveShader = new(
25 | "Remove Shader",
26 | "RemoveShader",
27 | typeof(AppCommands),
28 | new InputGestureCollection { new KeyGesture(Key.F6) });
29 |
30 | public static readonly RoutedUICommand ApplyShader = new(
31 | "Apply Shader",
32 | "ApplyShader",
33 | typeof(AppCommands),
34 | new InputGestureCollection { new KeyGesture(Key.F5) });
35 |
36 | public static readonly RoutedUICommand CompileShader = new(
37 | "Compile Shader",
38 | "CompileShader",
39 | typeof(AppCommands),
40 | new InputGestureCollection { new KeyGesture(Key.F7) });
41 |
42 | public static void Initialize()
43 | {
44 | // Add a keyboard shortcut (Ctrl+Shift+S) to the "Save As" command.
45 | ApplicationCommands.SaveAs.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Shift));
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Shazzam/Commands/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | // The following code is inspired by the work of Josh Smith
2 | // http://joshsmithonwpf.wordpress.com/
3 | namespace Shazzam.Commands
4 | {
5 | using System;
6 | using System.Diagnostics;
7 | using System.Windows.Input;
8 |
9 | ///
10 | /// A command whose sole purpose is to
11 | /// relay its functionality to other
12 | /// objects by invoking delegates. The
13 | /// default return value for the CanExecute
14 | /// method is 'true'.
15 | ///
16 | public class RelayCommand : ICommand
17 | {
18 | private readonly Action execute;
19 | private readonly Func? canExecute;
20 |
21 | ///
22 | /// Creates a new command that can always execute.
23 | ///
24 | /// The execution logic.
25 | public RelayCommand(Action execute)
26 | : this(execute, null)
27 | {
28 | }
29 |
30 | ///
31 | /// Creates a new command.
32 | ///
33 | /// The execution logic.
34 | /// The execution status logic.
35 | public RelayCommand(Action execute, Func? canExecute)
36 | {
37 | this.execute = execute ?? throw new ArgumentNullException(nameof(execute));
38 | this.canExecute = canExecute;
39 | }
40 |
41 | public event EventHandler CanExecuteChanged
42 | {
43 | add
44 | {
45 | if (this.canExecute != null)
46 | {
47 | CommandManager.RequerySuggested += value;
48 | }
49 | }
50 |
51 | remove
52 | {
53 | if (this.canExecute != null)
54 | {
55 | CommandManager.RequerySuggested -= value;
56 | }
57 | }
58 | }
59 |
60 | [DebuggerStepThrough]
61 | public bool CanExecute(object parameter)
62 | {
63 | return this.canExecute?.Invoke() ?? true;
64 | }
65 |
66 | public void Execute(object parameter)
67 | {
68 | this.execute();
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Shazzam/Commands/RelayCommand`1.cs:
--------------------------------------------------------------------------------
1 | // The following code is inspired by the work of Josh Smith
2 | // http://joshsmithonwpf.wordpress.com/
3 | namespace Shazzam.Commands
4 | {
5 | using System;
6 | using System.Diagnostics;
7 | using System.Windows.Input;
8 |
9 | ///
10 | /// A command whose sole purpose is to
11 | /// relay its functionality to other
12 | /// objects by invoking delegates. The
13 | /// default return value for the CanExecute
14 | /// method is 'true'.
15 | ///
16 | public class RelayCommand : ICommand
17 | {
18 | private readonly Action execute;
19 | private readonly Predicate? canExecute;
20 |
21 | public RelayCommand(Action execute)
22 | : this(execute, null)
23 | {
24 | }
25 |
26 | ///
27 | /// Creates a new command.
28 | ///
29 | /// The execution logic.
30 | /// The execution status logic.
31 | public RelayCommand(Action execute, Predicate? canExecute)
32 | {
33 | this.execute = execute ?? throw new ArgumentNullException(nameof(execute));
34 | this.canExecute = canExecute;
35 | }
36 |
37 | public event EventHandler CanExecuteChanged
38 | {
39 | add
40 | {
41 | if (this.canExecute != null)
42 | {
43 | CommandManager.RequerySuggested += value;
44 | }
45 | }
46 |
47 | remove
48 | {
49 | if (this.canExecute != null)
50 | {
51 | CommandManager.RequerySuggested -= value;
52 | }
53 | }
54 | }
55 |
56 | [DebuggerStepThrough]
57 | public bool CanExecute(object parameter)
58 | {
59 | return this.canExecute?.Invoke((T)parameter) ?? true;
60 | }
61 |
62 | public void Execute(object parameter)
63 | {
64 | this.execute((T)parameter);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Shazzam/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam
2 | {
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Windows.Media;
6 |
7 | public static class Constants
8 | {
9 | public static readonly IReadOnlyList Colors = CreateColors(360).ToArray();
10 |
11 | private static IEnumerable CreateColors(int n)
12 | {
13 | var step = 360.0 / n;
14 | var hue = 0.0;
15 | while (hue < 360.0)
16 | {
17 | yield return Hsv.ColorFromHsv(hue, 1, 1);
18 | hue += step;
19 | }
20 | }
21 |
22 | public static class Paths
23 | {
24 | public static readonly string Application = "\\Shazzam\\";
25 | public static readonly string GeneratedShaders = "\\Shazzam\\GeneratedShaders\\";
26 | public static readonly string TextureMaps = "\\Images\\TextureMaps\\";
27 | }
28 |
29 | public static class FileNames
30 | {
31 | public static readonly string TempShaderFx = "temp.fx";
32 | public static readonly string TempShaderPs = "temp.ps";
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Shazzam/Controls/HorizontalRevealMode.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public enum HorizontalRevealMode
4 | {
5 | ///
6 | /// No horizontal reveal animation.
7 | ///
8 | None,
9 |
10 | ///
11 | /// Reveal from the left to the right.
12 | ///
13 | FromLeftToRight,
14 |
15 | ///
16 | /// Reveal from the right to the left.
17 | ///
18 | FromRightToLeft,
19 |
20 | ///
21 | /// Reveal from the center to the bounding edge.
22 | ///
23 | FromCenterToEdge,
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Shazzam/Controls/Icons.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | using System.Windows;
4 |
5 | ///
6 | /// Interaction logic for Icons.xaml
7 | ///
8 | public partial class Icons : Window
9 | {
10 | public Icons()
11 | {
12 | this.InitializeComponent();
13 |
14 | // Insert code required on object creation below this point.
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Shazzam/Controls/IndexOddEven.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public enum IndexOddEven
4 | {
5 | Odd,
6 | Even,
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Shazzam/Controls/RangeControl.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
23 |
28 |
29 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Shazzam/Controls/RangeControl.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | using System.Windows;
4 | using System.Windows.Controls;
5 |
6 | public partial class RangeControl : UserControl
7 | {
8 | public static readonly DependencyProperty MinProperty = DependencyProperty.Register(
9 | nameof(Min),
10 | typeof(double),
11 | typeof(RangeControl),
12 | new FrameworkPropertyMetadata(
13 | default(double),
14 | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
15 |
16 | public static readonly DependencyProperty MaxProperty = DependencyProperty.Register(
17 | nameof(Max),
18 | typeof(double),
19 | typeof(RangeControl),
20 | new FrameworkPropertyMetadata(
21 | default(double),
22 | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
23 |
24 | public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
25 | nameof(Value),
26 | typeof(double),
27 | typeof(RangeControl),
28 | new FrameworkPropertyMetadata(
29 | default(double),
30 | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
31 |
32 | public RangeControl()
33 | {
34 | this.InitializeComponent();
35 | }
36 |
37 | public double Min
38 | {
39 | get => (double)this.GetValue(MinProperty);
40 | set => this.SetValue(MinProperty, value);
41 | }
42 |
43 | public double Max
44 | {
45 | get => (double)this.GetValue(MaxProperty);
46 | set => this.SetValue(MaxProperty, value);
47 | }
48 |
49 | public double Value
50 | {
51 | get => (double)this.GetValue(ValueProperty);
52 | set => this.SetValue(ValueProperty, value);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Shazzam/Controls/SelectionLocation.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public enum SelectionLocation
4 | {
5 | Before,
6 | Selected,
7 | After,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Shazzam/Controls/StackLocation.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public enum StackLocation
4 | {
5 | First,
6 | Middle,
7 | Last,
8 | FirstAndLast,
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Shazzam/Controls/TextureMapLocator.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public struct TextureMapLocator
4 | {
5 | public string ShortFileName { get; set; }
6 |
7 | public string LongFileName { get; set; }
8 |
9 | public string TrimmedFileName { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Shazzam/Controls/VerticalRevealMode.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam.Controls
2 | {
3 | public enum VerticalRevealMode
4 | {
5 | ///
6 | /// No vertical reveal animation.
7 | ///
8 | None,
9 |
10 | ///
11 | /// Reveal from top to bottom.
12 | ///
13 | FromTopToBottom,
14 |
15 | ///
16 | /// Reveal from bottom to top.
17 | ///
18 | FromBottomToTop,
19 |
20 | ///
21 | /// Reveal from the center to the bounding edge.
22 | ///
23 | FromCenterToEdge,
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Shazzam/Converters/AnyToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | namespace Shazzam
2 | {
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.Globalization;
7 | using System.Linq;
8 | using System.Windows;
9 | using System.Windows.Data;
10 |
11 | [ValueConversion(typeof(IEnumerable), typeof(Visibility))]
12 | public sealed class AnyToVisibilityConverter : IValueConverter
13 | {
14 | public static readonly AnyToVisibilityConverter VisibleWhenAny = new(Visibility.Visible, Visibility.Collapsed);
15 | public static readonly AnyToVisibilityConverter VisibleWhenEmpty = new(Visibility.Collapsed, Visibility.Visible);
16 |
17 | private readonly object whenAny;
18 | private readonly object whenEmpty;
19 |
20 | public AnyToVisibilityConverter(Visibility whenAny, Visibility whenEmpty)
21 | {
22 | this.whenAny = whenAny;
23 | this.whenEmpty = whenEmpty;
24 | }
25 |
26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
27 | {
28 | if (value is IEnumerable