diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 462dee8..0000000 --- a/.gitignore +++ /dev/null @@ -1,112 +0,0 @@ -# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) -[Bb]in/ -[Oo]bj/ - -# mstest test results -TestResults - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -x64/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.log -*.vspscc -*.vssscc -.builds - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper* - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Publish Web Output -*.Publish.xml - -# NuGet Packages Directory -packages - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -[Bb]in -[Oo]bj -sql -TestResults -[Tt]est[Rr]esult* -*.Cache -ClientBin -[Ss]tyle[Cc]op.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - -# Sublime backup files -*~ -*.db diff --git a/.mailmap b/.mailmap deleted file mode 100644 index bdb4654..0000000 --- a/.mailmap +++ /dev/null @@ -1 +0,0 @@ -Ragnhild Karlsson diff --git a/EyePaint.sln b/EyePaint.sln deleted file mode 100644 index 610e419..0000000 --- a/EyePaint.sln +++ /dev/null @@ -1,27 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EyePaint", "EyePaint\EyePaint.csproj", "{972E215F-19BD-46E3-BC74-3BAD9D9537A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Debug|x86.ActiveCfg = Debug|x86 - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Debug|x86.Build.0 = Debug|x86 - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Debug|x86.Deploy.0 = Debug|x86 - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Release|Any CPU.Build.0 = Release|Any CPU - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Release|x86.ActiveCfg = Release|x86 - {972E215F-19BD-46E3-BC74-3BAD9D9537A1}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/EyePaint/App.config b/EyePaint/App.config deleted file mode 100644 index 01ce055..0000000 --- a/EyePaint/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/EyePaint/App.xaml b/EyePaint/App.xaml deleted file mode 100644 index fdd3d65..0000000 --- a/EyePaint/App.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/EyePaint/App.xaml.cs b/EyePaint/App.xaml.cs deleted file mode 100644 index 6950749..0000000 --- a/EyePaint/App.xaml.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace EyePaint -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - //static EyeTrackingEngine eyeTracker = new EyeTrackingEngine(); //TODO Handle hardware errors gracefully. - - void onStartup(object sender, StartupEventArgs e) - { - (new MainWindow()).Show(); - } - } -} diff --git a/EyePaint/AppStateMachine.cs b/EyePaint/AppStateMachine.cs deleted file mode 100644 index 44307d6..0000000 --- a/EyePaint/AppStateMachine.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Controls; -using Tobii.EyeX.Client; - -namespace EyePaint -{ - /// - /// A state machine for the EyePaint app that controls flow between the - /// different user controls and tracks state of the app. Acts as the - /// ViewModel for MainWindow. - /// - public class AppStateMachine : INotifyPropertyChanged - { - static volatile AppStateMachine instance; - static object m_lock = new object(); - /// - /// Thread safe singleton instance - /// - public static AppStateMachine Instance { - get - { - if (instance == null) - { - lock (m_lock) - { - if (instance == null) { instance = new AppStateMachine(); } - } - } - return instance; - } - } - - /// - /// Possible states - /// - public enum State - { - Start, - Position, - Calibrate, - Paint - } - - State state = State.Start; - UserControl _control = new StartControl(); - InteractionSystem _system; - - private AppStateMachine() - { - // Initialize EyeX interaction "system". EyeX API only allows one - // instance, so this must be set here in the AppStateMachine and - // accessed from EyeX enabled controls. - _system = InteractionSystem.Initialize(LogTarget.Trace); - } - - /// - /// Switch states - /// - public void Next() - { - switch (Instance.state) - { - case State.Start: - //TODO Dispose previous control. - Instance.state = State.Position; - Instance.Control = new PositioningControl(); - break; - case State.Position: - //TODO Dispose previous control. - Instance.state = State.Calibrate; - Instance.Control = new CalibrationControl(); - break; - case State.Calibrate: - //TODO Dispose previous control. - Instance.state = State.Paint; - Instance.Control = new PaintControl(); - break; - case State.Paint: - ((PaintControl)Instance.Control).Dispose(); - Instance.state = State.Start; - Instance.Control = new StartControl(); - break; - } - } - - #region INotifyPropertyChanged Members - - /// - /// Occurs when a property changes - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Raises a PropertyChanged event - /// - protected void OnPropertyChanged(string property) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(property)); - } - } - - #endregion - - /// - /// Public property Control. Wired for TwoWay databinding. - /// - public UserControl Control - { - get { return _control; } - set - { - _control = value; - OnPropertyChanged("Control"); - } - } - - /// - /// Public property System. Readonly. - /// - public InteractionSystem System - { - get { return _system; } - } - } -} diff --git a/EyePaint/CalibrationControl.xaml b/EyePaint/CalibrationControl.xaml deleted file mode 100644 index d1b0b9a..0000000 --- a/EyePaint/CalibrationControl.xaml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/EyePaint/CalibrationControl.xaml.cs b/EyePaint/CalibrationControl.xaml.cs deleted file mode 100644 index d83d2c2..0000000 --- a/EyePaint/CalibrationControl.xaml.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Threading; -using Tobii.Gaze.Core; - -namespace EyePaint -{ - /// - /// Interaction logic for CalibrationControl.xaml - /// - public partial class CalibrationControl : UserControl - { - static EyeTrackingEngine eyeTracker = new EyeTrackingEngine(); - DispatcherTimer addCalibrationPointTimer; - int measurement = 0, measurements = 10, scan = 0, scans = 2; - double averageOffset; - Point calibrationPoint, gazePoint; - - public CalibrationControl() - { - InitializeComponent(); - eyeTracker.GazePoint += (object s, GazePointEventArgs e) => gazePoint = e.GazePoint; - addCalibrationPointTimer = new DispatcherTimer( - new TimeSpan(0, 0, 1), - DispatcherPriority.Normal, - onAddCalibrationPoint, - Dispatcher - ); - } - - void onLoaded(object s, RoutedEventArgs e) - { - startCalibration(); - } - - void onUnloaded(object s, RoutedEventArgs e) - { - stopCalibration(); - } - - void startCalibration() - { - eyeTracker.startCalibration(); - scan = 0; - startScan(); - } - - void stopCalibration() - { - eyeTracker.stopCalibration(); - AppStateMachine.Instance.Next(); - } - - void startScan() - { - measurement = 0; - averageOffset = 0; - CalibrationPoint.Visibility = Visibility.Visible; - addCalibrationPointTimer.Start(); - } - - void stopScan() - { - addCalibrationPointTimer.Stop(); - eyeTracker.setCalibration(); - if (averageOffset <= 100) stopCalibration(); - else if (++scan < scans) startScan(); - else - { - Window confirmBox = new ConfirmBox("Kalibreringen blev dålig. Gör om?"); - confirmBox.ShowDialog(); - if (confirmBox.DialogResult.Value) startCalibration(); - else stopCalibration(); - } - } - - void onAddCalibrationPoint(object sender, EventArgs e) - { - calibrationPoint = new Point((int)AnimatedTranslateTransform.X, (int)AnimatedTranslateTransform.Y); - eyeTracker.addCalibrationPoint(calibrationPoint); - averageOffset += Math.Sqrt(Math.Pow(calibrationPoint.X - gazePoint.X, 2) + Math.Pow(calibrationPoint.Y - gazePoint.Y, 2)) / measurements; - if (++measurement >= measurements) stopScan(); - } - } -} diff --git a/EyePaint/ConfirmBox.xaml b/EyePaint/ConfirmBox.xaml deleted file mode 100644 index 829f44a..0000000 --- a/EyePaint/ConfirmBox.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - diff --git a/EyePaint/PaintControl.xaml.cs b/EyePaint/PaintControl.xaml.cs deleted file mode 100644 index 1567974..0000000 --- a/EyePaint/PaintControl.xaml.cs +++ /dev/null @@ -1,500 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Automation.Peers; -using System.Windows.Automation.Provider; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; -using Tobii.EyeX.Client; -using Tobii.EyeX.Framework; -using InteractorId = System.String; - -namespace EyePaint -{ - /// - /// Interaction logic for Paint.xaml - /// - public partial class PaintControl : UserControl, IDisposable - { - private const string InteractorId = "EyePaint"; - private InteractionSystem system; - private InteractionContext context; - private InteractionSnapshot globalInteractorSnapshot; - private int queryHandlerTicket; - private int eventHandlerTicket; - - Point gaze; - bool paintingActive = false; - Button activeButton; - Button activePaintTool; - Button activeColorTool; - Dictionary gazeAwareButtons; - - //Painting - int paintingWidth; - int paintingHeight; - RenderTargetBitmap painting; - - //Tools - List paintTools; - List colorTools; - - Model model; - View view; - - //Timers - private DispatcherTimer paintTimer; - private DispatcherTimer inactivityTimer; - - // initialize the EyeX Engine client library. - public PaintControl() - { - InitializeComponent(); - - // Create a canvas for painting - paintingWidth = (int)(System.Windows.SystemParameters.PrimaryScreenWidth); - paintingHeight = (int)(System.Windows.SystemParameters.PrimaryScreenHeight * 0.8); - painting = new RenderTargetBitmap(paintingWidth, paintingHeight, 96, 96, PixelFormats.Pbgra32); - - // Interaction via eye tracker and mouse - system = AppStateMachine.Instance.System; - InitializeEyeTracking(); - InitializeMouseControl(); - - // Set up model and view - SettingsFactory sf = new SettingsFactory(); - paintTools = sf.getPaintTools(); - colorTools = sf.getColorTools(); - model = new Model(paintTools[0], colorTools[0]); - view = new View(painting); - - // Set up GUI - gazeAwareButtons = new Dictionary(); - paintingImage.Source = painting; - InitializeMenu(); - - //Initialize timers - paintTimer = new DispatcherTimer(); - paintTimer.Interval = TimeSpan.FromMilliseconds(1); - paintTimer.Tick += (object s, EventArgs e) => - { - model.Grow(); - RasterizeModel(); - }; - - // Set timer for inactivity - inactivityTimer = new DispatcherTimer(); - inactivityTimer.Interval = TimeSpan.FromMinutes(1); - inactivityTimer.Tick += (object s, EventArgs e) => - { - Reset(); - }; - } - - void InitializeMenu() - { - int btnWidth = 2*(int)saveButton.BorderThickness.Right + - (paintingWidth / (colorTools.Count + paintTools.Count + systemPanel.Children.Count)); - - //Add ColorTools - DockPanel.SetDock(colorToolPanel, Dock.Left); - foreach (ColorTool ct in colorTools) - { - Button btn = new Button(); - var brush = new ImageBrush(); - - String path = Directory.GetCurrentDirectory() + "\\Resources\\" + ct.iconImage; - brush.ImageSource = new BitmapImage(new Uri(path)); - brush.Stretch = System.Windows.Media.Stretch.None; - - btn.Name = ct.name; - btn.Background = brush; - btn.BorderThickness = new System.Windows.Thickness(0, 0, 0, 4); - btn.BorderBrush = Brushes.Transparent; - btn.FocusVisualStyle = null; - btn.Width = btnWidth; - btn.Click += (object s, RoutedEventArgs e) => - { - activeColorTool.BorderBrush = Brushes.Transparent; - activeColorTool = btn; - activeColorTool.BorderBrush = Brushes.Black; - model.ChangeColorTool(ct); - }; - colorToolPanel.Children.Add(btn); - gazeAwareButtons.Add(btn.Name, btn); - } - - //Add PaintTools - DockPanel.SetDock(paintToolPanel, Dock.Right); - foreach (PaintTool pt in paintTools) - { - Button btn = new Button(); - var brush = new ImageBrush(); - - String path = Directory.GetCurrentDirectory() + "\\Resources\\" + pt.iconImage; - brush.ImageSource = new BitmapImage(new Uri(path)); - brush.Stretch = System.Windows.Media.Stretch.None; - - btn.Name = pt.name; - btn.Background = brush; - btn.BorderThickness = new System.Windows.Thickness(0, 0, 0, 4); - btn.BorderBrush = Brushes.Transparent; - btn.FocusVisualStyle = null; - btn.Width = btnWidth; - btn.Click += (object s, RoutedEventArgs e) => - { - activePaintTool.BorderBrush = Brushes.Transparent; - model.ChangePaintTool(pt); - btn.BorderBrush = Brushes.Black; - activePaintTool = btn; - }; - paintToolPanel.Children.Add(btn); - gazeAwareButtons.Add(btn.Name, btn); - } - - saveButton.Width = btnWidth; - setRandomBackgroundButton.Width = btnWidth; - - gazeAwareButtons.Add(saveButton.Name, saveButton); - gazeAwareButtons.Add(setRandomBackgroundButton.Name, setRandomBackgroundButton); - - // Set active buttons - activePaintTool = gazeAwareButtons[paintTools[0].name]; - activeColorTool = gazeAwareButtons[colorTools[0].name]; - activePaintTool.BorderBrush = new SolidColorBrush(Color.FromRgb(0,0,0)); - activeColorTool.BorderBrush = new SolidColorBrush(Color.FromRgb(0,0,0)); - - // Bind events to gaze aware buttons - foreach (var kv in gazeAwareButtons) - { - Button btn = kv.Value; - btn.PreviewKeyDown += (object s, KeyEventArgs e) => { gazeAwareButton_PreviewKeyDown(s, e); }; - btn.GotFocus += (object s, RoutedEventArgs e) => - { - System.Windows.Media.Effects.DropShadowEffect eff = new System.Windows.Media.Effects.DropShadowEffect(); - eff.Color = Color.FromRgb(180, 180, 180); - eff.Direction = 270; - eff.BlurRadius = 16; - btn.Effect = eff; - }; - btn.LostFocus += (object s, RoutedEventArgs e) => - { - btn.Effect = null; - }; - } - } - - #region PaintControl actions - - /// - /// Event handler for gaze aware events, which are events triggered - /// when the user looks at a gaze aware button. - /// - /// ID of the gaze aware button - /// Flag indicating if the user is looking at the button - private void TrackInteractor(string interactorId, bool hasGaze) - { - Button btn = gazeAwareButtons[interactorId]; - if (btn != null) - { - btn.Focus(); - activeButton = btn; - } - } - - /// - /// Tracks a gaze point from the tracker. Must run on the UI thread. - /// - void TrackGaze(Point p, bool keep = true, int keyhole = 100) - { - var distance = Math.Sqrt(Math.Pow(gaze.X - p.X, 2) + Math.Pow(gaze.Y - p.Y, 2)); - if (distance < keyhole) return; - gaze = p; - if (keep) model.Add(gaze, true); //TODO Add alwaysAdd argument, or remove it completely from the function declaration. - } - - void StartPainting() - { - if (paintingActive) return; - paintingActive = true; - paintTimer.Start(); - TrackGaze(gaze, paintingActive, 0); - inactivityTimer.Stop(); - } - - void StopPainting() - { - paintingActive = false; - paintTimer.Stop(); - inactivityTimer.Start(); - } - - void RasterizeModel() - { - view.Rasterize(model.GetRenderQueue()); - } - - void SetBackGroundToRandomColor() - { - view.setBackGroundColorRandomly(); - } - - void SavePainting() - { - PngBitmapEncoder encoder = new PngBitmapEncoder(); - encoder.Frames.Add(BitmapFrame.Create(painting)); - string filename = DateTime.Now.TimeOfDay.TotalSeconds + ".png"; - using (Stream stm = File.Create(filename)) - { - encoder.Save(stm); - } - } - - void Reset() - { - SavePainting(); - AppStateMachine.Instance.Next(); - } - - #endregion - - #region PaintControl event handlers - - public void OnLoaded(object sender, RoutedEventArgs e) - { - this.Focus(); - } - - void OnSetRandomBackGroundClick(object sender, RoutedEventArgs e) - { - SavePainting(); - SetBackGroundToRandomColor(); - model.ResetModel(); - } - - void OnSaveClick(object sender, RoutedEventArgs e) - { - SavePainting(); - } - - private void gazeAwareButton_PreviewKeyDown(object sender, KeyEventArgs e) - { - if (e.Key == Key.Space && activeButton != null) - { - ButtonAutomationPeer peer = new ButtonAutomationPeer(activeButton); - IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; - invokeProv.Invoke(); - e.Handled = true; - } - } - - private void paintingImage_KeyDown(object sender, KeyEventArgs e) - { - if (e.Key == Key.Space) - { - StartPainting(); - e.Handled = true; - } - } - - private void paintingImage_KeyUp(object sender, KeyEventArgs e) - { - if (e.Key == Key.Space) - { - StopPainting(); - e.Handled = true; - } - else if (e.Key == Key.Escape) - { - Window confirmBox = new ConfirmBox("Vill du starta om?"); - confirmBox.ShowDialog(); - if (confirmBox.DialogResult.HasValue && confirmBox.DialogResult.Value) - { - Reset(); - } - } - } - - #endregion - - #region Mouse interaction - - /// - /// Sets up mouse based interaction. - /// - void InitializeMouseControl() - { - this.MouseMove += (object s, MouseEventArgs e) => - { - var mousePosition = new Point(Mouse.GetPosition(paintingImage).X, Mouse.GetPosition(paintingImage).Y); - TrackGaze(mousePosition, paintingActive, 0); - }; - this.MouseDown += (object s, MouseButtonEventArgs e) => { StartPainting(); }; - this.MouseUp += (object s, MouseButtonEventArgs e) => { StopPainting(); }; - } - - #endregion - - #region EyeTracking with EyeX - - /// - /// Sets up the EyeX engine and enables eye tracking. - /// - void InitializeEyeTracking() - { - // create a context, register event handlers, and enable the connection to the engine. - context = new InteractionContext(false); - queryHandlerTicket = context.RegisterQueryHandlerForCurrentProcess(HandleQuery); - eventHandlerTicket = context.RegisterEventHandler(HandleEvent); - context.EnableConnection(); - - // enable gaze point tracking over the entire window - InitializeGlobalInteractorSnapshot(); - context.ConnectionStateChanged += (object s, ConnectionStateChangedEventArgs ce) => - { - if (ce.State == ConnectionState.Connected) - { - globalInteractorSnapshot.Commit((InteractionSnapshotResult isr) => { }); - } - }; - } - - /// - /// Initializes the EyeX snapshot that handles the painting interaction. - /// - private void InitializeGlobalInteractorSnapshot() - { - globalInteractorSnapshot = context.CreateSnapshot(); - globalInteractorSnapshot.CreateBounds(InteractionBoundsType.None); - globalInteractorSnapshot.AddWindowId(Literals.GlobalInteractorWindowId); - - var interactor = globalInteractorSnapshot.CreateInteractor(InteractorId, Literals.RootId, Literals.GlobalInteractorWindowId); - interactor.CreateBounds(InteractionBoundsType.None); - - var behavior = interactor.CreateBehavior(InteractionBehaviorType.GazePointData); - var behaviorParams = new GazePointDataParams() { GazePointDataMode = GazePointDataMode.LightlyFiltered }; - behavior.SetGazePointDataOptions(ref behaviorParams); - } - - /// - /// Handles a query from the EyeX Engine. - /// Note that this method is called from a worker thread, so it may not access any WPF Window objects. - /// - /// Query. - private void HandleQuery(InteractionQuery query) - { - var queryBounds = query.Bounds; - double x, y, w, h; - if (queryBounds.TryGetRectangularData(out x, out y, out w, out h)) - { - // marshal the query to the UI thread, where WPF objects may be accessed. - System.Windows.Rect r = new System.Windows.Rect((int)x, (int)y, (int)w, (int)h); - this.Dispatcher.BeginInvoke(new Action(HandleQueryOnUiThread), r); - } - } - - private void HandleQueryOnUiThread(System.Windows.Rect queryBounds) - { - IntPtr windowHandle = new WindowInteropHelper(Window.GetWindow(this)).Handle; // TODO: crashes on reset. Make IDisposable and do dispose - var windowId = windowHandle.ToString(); - - var snapshot = context.CreateSnapshot(); - snapshot.AddWindowId(windowId); - var bounds = snapshot.CreateBounds(InteractionBoundsType.Rectangular); - bounds.SetRectangularData(queryBounds.Left, queryBounds.Top, queryBounds.Width, queryBounds.Height); - System.Windows.Rect queryBoundsRect = new System.Windows.Rect(queryBounds.Left, queryBounds.Top, queryBounds.Width, queryBounds.Height); - - foreach (var kv in gazeAwareButtons) - { - Button b = kv.Value; - InteractorId id = kv.Key; - CreateGazeAwareInteractor(id, b, Literals.RootId, windowId, snapshot, queryBoundsRect); - } - - snapshot.Commit((InteractionSnapshotResult isr) => { }); - } - - private void CreateGazeAwareInteractor(InteractorId id, Control control, string parentId, string windowId, InteractionSnapshot snapshot, System.Windows.Rect queryBoundsRect) - { - var controlTopLeft = control.TranslatePoint(new Point(0, 0), this); - var controlRect = new System.Windows.Rect(controlTopLeft, control.RenderSize); - - if (!paintingActive && controlRect.IntersectsWith(queryBoundsRect)) - { - var interactor = snapshot.CreateInteractor(id, parentId, windowId); - var bounds = interactor.CreateBounds(InteractionBoundsType.Rectangular); - bounds.SetRectangularData(controlRect.Left, controlRect.Top, controlRect.Width, controlRect.Height); - interactor.CreateBehavior(InteractionBehaviorType.GazeAware); - } - } - - /// - /// Handles an event from the EyeX Engine. - /// Note that this method is called from a worker thread, so it may not access any WPF objects. - /// - /// Event. - private void HandleEvent(InteractionEvent @event) - { - var interactorId = @event.InteractorId; - foreach (var behavior in @event.Behaviors) - { - if (behavior.BehaviorType == InteractionBehaviorType.GazeAware) - { - GazeAwareEventParams r; - if (behavior.TryGetGazeAwareEventParams(out r)) - { - // marshal the event to the UI thread, where WPF objects may be accessed. - this.Dispatcher.BeginInvoke(new Action(TrackInteractor), interactorId, r.HasGaze != EyeXBoolean.False); - } - } - else if (behavior.BehaviorType == InteractionBehaviorType.GazePointData) - { - GazePointDataEventParams r; - if (behavior.TryGetGazePointDataEventParams(out r)) - { - this.Dispatcher.BeginInvoke(new Action(() => - { - if (PresentationSource.FromVisual(paintingImage) != null) - { - Point p = new Point(r.X, r.Y); - p = paintingImage.PointFromScreen(p); - var paintingTopLeft = paintingImage.TranslatePoint(new Point(0, 0), this); - var paintingRect = new System.Windows.Rect(paintingTopLeft, paintingImage.RenderSize); - - if (paintingRect.Contains(p)) - { - paintingImage.Focus(); - TrackGaze(p, paintingActive, 50); //TODO Set keyhole size dynamically based on how bad the calibration is. - RasterizeModel(); - } - } - })); - } - } - } - } - - #endregion - - public void Dispose() - { - context.UnregisterHandler(queryHandlerTicket); - context.UnregisterHandler(eventHandlerTicket); - context.DisableConnection(); - context.Dispose(); - globalInteractorSnapshot.Dispose(); - } - } -} diff --git a/EyePaint/PositioningControl.xaml b/EyePaint/PositioningControl.xaml deleted file mode 100644 index 24ed76b..0000000 --- a/EyePaint/PositioningControl.xaml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/EyePaint/PositioningControl.xaml.cs b/EyePaint/PositioningControl.xaml.cs deleted file mode 100644 index 744dbeb..0000000 --- a/EyePaint/PositioningControl.xaml.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Automation.Peers; -using System.Windows.Automation.Provider; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; - -namespace EyePaint -{ - /// - /// Interaction logic for PositioningControl.xaml - /// - public partial class PositioningControl : UserControl - { - static EyeTrackingEngine eyeTracker = new EyeTrackingEngine(); - bool stable = false; - const double OPTIMAL_DISTANCE_FROM_EYE_TRACKER = 500; //TODO Set this value for the actual hardware installation. - - public PositioningControl() - { - InitializeComponent(); - } - - void onLoaded(object s, RoutedEventArgs e) - { - eyeTracker.HeadMovement += onPositionChanged; - Focus(); - } - - void onUnloaded(object s, RoutedEventArgs e) - { - eyeTracker.HeadMovement -= onPositionChanged; - } - - void onKeyDown(object s, KeyEventArgs e) - { - if (e.Key == Key.Space && stable) AppStateMachine.Instance.Next(); - } - - void onPositionChanged(object s, HeadMovementEventArgs e) - { - Dispatcher.Invoke(() => - { - Blur.Radius = Math.Abs(e.Distance - OPTIMAL_DISTANCE_FROM_EYE_TRACKER); - stable = 300 <= e.Distance && e.Distance <= 600; - }); - } - } -} diff --git a/EyePaint/Properties/AssemblyInfo.cs b/EyePaint/Properties/AssemblyInfo.cs deleted file mode 100644 index 5bc840a..0000000 --- a/EyePaint/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("EyePaint")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("EyePaint")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/EyePaint/Properties/Resources.Designer.cs b/EyePaint/Properties/Resources.Designer.cs deleted file mode 100644 index 14ad65c..0000000 --- a/EyePaint/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34011 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace EyePaint.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EyePaint.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/EyePaint/Properties/Resources.resx b/EyePaint/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/EyePaint/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/EyePaint/Properties/Settings.Designer.cs b/EyePaint/Properties/Settings.Designer.cs deleted file mode 100644 index 30dd4f2..0000000 --- a/EyePaint/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34011 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace EyePaint.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/EyePaint/Properties/Settings.settings b/EyePaint/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/EyePaint/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/EyePaint/RenderObject.cs b/EyePaint/RenderObject.cs deleted file mode 100644 index 784ea71..0000000 --- a/EyePaint/RenderObject.cs +++ /dev/null @@ -1,240 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Media; - -namespace EyePaint -{ - abstract class RenderObject - { - internal abstract void Rasterize(ref Canvas imageObeject); - } - - abstract class Tree : RenderObject - { - internal readonly Point root; - internal int generation; - internal Point[] previousGen; //Parents of the present leaves - internal Point[] leaves; - internal readonly int branchLength; - internal readonly int nLeaves;// TODO Warning need to be >2 - - internal Color color; - internal int branchWidth; - internal int hullWidth; - internal int leafSize; - - protected Tree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize - ) - { - this.color = color; - this.root = root; - this.branchLength = branchLength; - this.nLeaves = nLeaves; //Warning need to be >2 - this.previousGen = previousGen; - leaves = startLeaves; - generation = 0; - this.branchWidth = branchWidth; - this.hullWidth = hullWidth; - this.leafSize = leafSize; - } - - internal abstract override void Rasterize(ref Canvas imageObject); - - protected void DrawBranches(ref Canvas imageObject) - { - for (int i = 0; i < previousGen.Count(); i++) - { - Point parent = new Point(previousGen[i].X, previousGen[i].Y); - Point leaf = new Point(leaves[i].X, leaves[i].Y); - imageObject.DrawLine(color, branchWidth, parent, leaf); - } - } - - protected void DrawHull(ref Canvas imageObject) - { - Stack convexHull = LinearAlgebra.GetConvexHull(leaves); - Point startPoint = convexHull.Pop(); - Point p1 = startPoint; - while (convexHull.Count() > 0) - { - Point p2 = convexHull.Pop(); - imageObject.DrawLine(color, hullWidth, p1, p2); - p1 = p2; - if (convexHull.Count == 0) - { - imageObject.DrawLine(color, hullWidth, p1, startPoint); - } - } - } - - protected void FillHull(ref Canvas imageObject) - { - Stack convexHull = LinearAlgebra.GetConvexHull(leaves); - imageObject.DrawPolygon(color, convexHull.ToArray()); - } - - protected void DrawLeaves(ref Canvas imageObject) - { - for (int i = 0; i < leaves.Count(); i++) - { - Point leaf = new Point(leaves[i].X, leaves[i].Y); - imageObject.DrawElipse(color, leafSize, leaf); - } - } - protected void DrawBubbleLeaves(ref Canvas imageObject) - { - Random rnd = new Random(); - for (int i = leaves.Count() / 2; i < leaves.Count(); i++) - { - double scaleFactor = 0.10; - int xMinCord = (int)Math.Round(leaves[i].X * (1 - scaleFactor)); - int xMaxCord = (int)Math.Round(leaves[i].X + leaves[i].X * scaleFactor); - int yMinCord = (int)Math.Round(leaves[i].Y * (1 - scaleFactor)); - int yMaxCord = (int)Math.Round(leaves[i].Y + leaves[i].Y * scaleFactor); - if (xMinCord < xMaxCord && yMinCord < yMaxCord) - { - - Point leaf = new Point(rnd.Next(xMinCord, xMaxCord + 1), rnd.Next(yMinCord, yMaxCord + 1)); - int rndLeafSize = rnd.Next(leafSize); - int rndBias = rnd.Next(rndLeafSize); - if ((rndLeafSize - rndBias) > 0) - { - rndLeafSize = rndLeafSize - rndBias; - } - imageObject.DrawElipse(color, rndLeafSize, leaf); - } - } - } - } - - class PolyTree : Tree - { - internal PolyTree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize) - : base( - color, root, branchLength, nLeaves, previousGen, startLeaves, branchWidth, hullWidth, leafSize) - { - } - - internal override void Rasterize(ref Canvas imageObject) - { - FillHull(ref imageObject); - } - } - - class WoolTree : Tree - { - internal WoolTree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize) - : base( - color, root, branchLength, nLeaves, previousGen, startLeaves, branchWidth, hullWidth, leafSize) - { - } - - internal override void Rasterize(ref Canvas imageObject) - { - DrawBranches(ref imageObject); - FillHull(ref imageObject); - } - } - - class CellNetTree : Tree - { - internal CellNetTree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize) - : base( - color, root, branchLength, nLeaves, previousGen, startLeaves, branchWidth, hullWidth, leafSize) - { - } - - internal override void Rasterize(ref Canvas imageObject) - { - DrawBranches(ref imageObject); - } - } - - class ModernArtTree : Tree - { - internal ModernArtTree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize) - : base( - color, root, branchLength, nLeaves, previousGen, startLeaves, branchWidth, hullWidth, leafSize) - { - } - - internal override void Rasterize(ref Canvas imageObject) - { - DrawHull(ref imageObject); - DrawBranches(ref imageObject); - } - } - class BubbleTree : Tree - { - internal BubbleTree( - Color color, - Point root, - int branchLength, - int nLeaves, - Point[] previousGen, - Point[] startLeaves, - int branchWidth, - int hullWidth, - int leafSize) - : base( - color, root, branchLength, nLeaves, previousGen, startLeaves, branchWidth, hullWidth, leafSize) - { - } - - internal override void Rasterize(ref Canvas imageObject) - { - //DrawBranches(ref imageObject); - //FillHull(ref imageObject); - DrawBubbleLeaves(ref imageObject); - //DrawHull(ref imageObject); - } - } -} diff --git a/EyePaint/Resources/Thumbs.db b/EyePaint/Resources/Thumbs.db deleted file mode 100644 index 379f28a..0000000 Binary files a/EyePaint/Resources/Thumbs.db and /dev/null differ diff --git a/EyePaint/Resources/blue.png b/EyePaint/Resources/blue.png deleted file mode 100644 index e9350e8..0000000 Binary files a/EyePaint/Resources/blue.png and /dev/null differ diff --git a/EyePaint/Resources/bolt.png b/EyePaint/Resources/bolt.png deleted file mode 100644 index 83c901d..0000000 Binary files a/EyePaint/Resources/bolt.png and /dev/null differ diff --git a/EyePaint/Resources/bullseye.png b/EyePaint/Resources/bullseye.png deleted file mode 100644 index 2ac2ab6..0000000 Binary files a/EyePaint/Resources/bullseye.png and /dev/null differ diff --git a/EyePaint/Resources/cloud.png b/EyePaint/Resources/cloud.png deleted file mode 100644 index c7730fd..0000000 Binary files a/EyePaint/Resources/cloud.png and /dev/null differ diff --git a/EyePaint/Resources/cyan.png b/EyePaint/Resources/cyan.png deleted file mode 100644 index 3f61393..0000000 Binary files a/EyePaint/Resources/cyan.png and /dev/null differ diff --git a/EyePaint/Resources/exit.png b/EyePaint/Resources/exit.png deleted file mode 100644 index 42a43f2..0000000 Binary files a/EyePaint/Resources/exit.png and /dev/null differ diff --git a/EyePaint/Resources/green.png b/EyePaint/Resources/green.png deleted file mode 100644 index 16470bf..0000000 Binary files a/EyePaint/Resources/green.png and /dev/null differ diff --git a/EyePaint/Resources/magenta.png b/EyePaint/Resources/magenta.png deleted file mode 100644 index 6b30aa0..0000000 Binary files a/EyePaint/Resources/magenta.png and /dev/null differ diff --git a/EyePaint/Resources/new.png b/EyePaint/Resources/new.png deleted file mode 100644 index b285c1c..0000000 Binary files a/EyePaint/Resources/new.png and /dev/null differ diff --git a/EyePaint/Resources/rainbow.png b/EyePaint/Resources/rainbow.png deleted file mode 100644 index 63c1a21..0000000 Binary files a/EyePaint/Resources/rainbow.png and /dev/null differ diff --git a/EyePaint/Resources/red.png b/EyePaint/Resources/red.png deleted file mode 100644 index 795249e..0000000 Binary files a/EyePaint/Resources/red.png and /dev/null differ diff --git a/EyePaint/Resources/save.png b/EyePaint/Resources/save.png deleted file mode 100644 index 523358e..0000000 Binary files a/EyePaint/Resources/save.png and /dev/null differ diff --git a/EyePaint/Resources/sun.png b/EyePaint/Resources/sun.png deleted file mode 100644 index 22c7ee5..0000000 Binary files a/EyePaint/Resources/sun.png and /dev/null differ diff --git a/EyePaint/Resources/yellow.png b/EyePaint/Resources/yellow.png deleted file mode 100644 index 2d82a5b..0000000 Binary files a/EyePaint/Resources/yellow.png and /dev/null differ diff --git a/EyePaint/SettingsFactory.cs b/EyePaint/SettingsFactory.cs deleted file mode 100644 index 4e75505..0000000 --- a/EyePaint/SettingsFactory.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Media; - -namespace EyePaint -{ - internal enum PaintToolType { TREE } - - internal class SettingsFactory - { - internal SettingsFactory() - { - } - - // Return available paintTools - internal List getPaintTools() - { - //TODO Load paint tools from a data store instead. - List paintTools = new List(); - TreeTool woolTool = new TreeTool(0, - "woolPaint", - stringToToolType("TREE"), - "sun.png", - "WoolTree", 2, 500, 800, 25, 2, 0, 0, 10); - TreeTool polyTool = new TreeTool(1, - "polyPaint", - stringToToolType("TREE"), - "bolt.png", - "PolyTree", 5, 7, 800, 10, 2, 0, 0, 7); - TreeTool modernArtTool = new TreeTool(2, - "modernArtPaint", - stringToToolType("TREE"), - "cloud.png", - "ModernArtTree", 5, 4, 800, 100, 2, 5, 0, 10); - TreeTool cellNetTool = new TreeTool(3, - "cellNetPaint", - stringToToolType("TREE"), - "bullseye.png", - "CellNetTree", 25, 300, 800, 25, 2, 5, 0, 10); - TreeTool bubbleTool = new TreeTool(4, - "bubblePaint", - stringToToolType("TREE"), - "cloud.png", - "BubbleTree", - 15, // branch length - 10, // number of leaves - 800, // max generation - 120, // opacity - 0, // branchWidth - 1, // hullWidth - 30,10 - ); // leaf size - paintTools.Add(woolTool); - paintTools.Add(polyTool); - paintTools.Add(modernArtTool); - paintTools.Add(cellNetTool); - paintTools.Add(bubbleTool); - return paintTools; - } - - PaintToolType stringToToolType(string type) - { - switch (type) - { - case "TREE": - return PaintToolType.TREE; - default: - throw new System.ArgumentException(type + " is an invalid tool PaintToolType"); - } - } - - // Return available color tools - internal List getColorTools() - { - List colorTools = new List(); - - //TODO Load color tools from a data store instead. - colorTools.Add(new ColorTool("red", "red.png", 0, 12, 0.9, 1, 0.5, 1)); - colorTools.Add(new ColorTool("blue", "blue.png", 200, 255, 0.9, 1, 0.5, 1)); - colorTools.Add(new ColorTool( "yellow", "yellow.png", 28, 60, 0.9, 1, 0.9, 1)); - colorTools.Add(new ColorTool( "green", "green.png", 90, 148, 0.9, 1, 0.5, 1)); - colorTools.Add(new ColorTool("rainbow", "rainbow.png", 0, 360, 0.9, 1, 0.5, 1)); - - return colorTools; - } - } - - internal class PaintTool - { - internal readonly int id; - internal readonly string name; // TODO maybe skip this property - internal readonly PaintToolType type; - internal string iconImage; - internal string renderObjectName; - internal PaintTool(int id, string name, PaintToolType type, string pathToIconImage, string renderObjectName) - { - this.id = id; - this.name = name; - this.type = type; - this.iconImage = pathToIconImage; - this.renderObjectName = renderObjectName; - } - } - - internal class TreeTool : PaintTool - { - internal readonly int branchLength; - internal readonly int nLeaves; - internal readonly int maxGeneration; - internal readonly int opacity; - internal readonly int branchWidth; - internal readonly int hullWidth; - internal readonly int leafSize; - internal readonly double growthSpeed; - internal TreeTool(int id, string name, - PaintToolType type, - string pathToIconImage, - string renderObjectName, - int branchLength, - int nLeaves, - int maxGeneration, - int opacity, - int branchWidth, - int hullWidth, - int leafSize, - double growthSpeed) - : base(id, name, type, pathToIconImage, renderObjectName) - { - this.branchLength = branchLength; - this.nLeaves = nLeaves; - this.maxGeneration = maxGeneration; - this.opacity = opacity; - this.branchWidth = branchWidth; - this.hullWidth = hullWidth; - this.leafSize = leafSize; - this.growthSpeed = growthSpeed; - } - } - - internal class ColorTool - { - internal readonly String name; - internal string iconImage; - readonly double minHue; - readonly double maxHue; - readonly double minSaturation; - readonly double maxSaturation; - readonly double minValue; - readonly double maxValue; - - static Random rng = new Random(); - - internal ColorTool(string name, - string pathToIconImage, - double minHue, - double maxHue, - double minSaturation, - double maxSaturation, - double minValue, - double maxValue - ) - { - this.name = name; - this.iconImage = pathToIconImage; - this.minHue = minHue; - this.maxHue = maxHue; - this.minSaturation = minSaturation; - this.maxSaturation = maxSaturation; - this.minValue = minValue; - this.maxValue = maxValue; - } - - public Color getRandomShade(int opacity) - { - double randomHue = minHue + (rng.NextDouble() * (maxHue - minHue)); - double randomSaturation = minSaturation + (rng.NextDouble() * (maxSaturation - minSaturation)); - double randomValue = minValue + (rng.NextDouble() * (maxValue - minValue)); - Color c = ColorFromHSV((byte) opacity, randomHue, randomSaturation, randomValue); - return c; - } - - Color ColorFromHSV(byte opacity, double hue, double saturation, double value) - { - int hi = Convert.ToInt32(Math.Floor(hue / 60)) % 6; - double f = hue / 60 - Math.Floor(hue / 60); - - value = value * 255; - byte v = Convert.ToByte(value); - byte p = Convert.ToByte(value * (1 - saturation)); - byte q = Convert.ToByte(value * (1 - f * saturation)); - byte t = Convert.ToByte(value * (1 - (1 - f) * saturation)); - - if (hi == 0) - return Color.FromArgb(opacity, v, t, p); - else if (hi == 1) - return Color.FromArgb(opacity, q, v, p); - else if (hi == 2) - return Color.FromArgb(opacity, p, v, t); - else if (hi == 3) - return Color.FromArgb(opacity, p, q, v); - else if (hi == 4) - return Color.FromArgb(opacity, t, p, v); - else - return Color.FromArgb(opacity, v, p, q); - } - } -} diff --git a/EyePaint/StartControl.xaml b/EyePaint/StartControl.xaml deleted file mode 100644 index 979fc12..0000000 --- a/EyePaint/StartControl.xaml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/EyePaint/StartControl.xaml.cs b/EyePaint/StartControl.xaml.cs deleted file mode 100644 index 16ee4e4..0000000 --- a/EyePaint/StartControl.xaml.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace EyePaint -{ - /// - /// Interaction logic for StartControl.xaml - /// - public partial class StartControl : UserControl - { - public StartControl() - { - InitializeComponent(); - } - - void onLoaded(object s, RoutedEventArgs e) - { - Focus(); - } - - void onKeyDown(object s, KeyEventArgs e) - { - if (e.Key == Key.Space) AppStateMachine.Instance.Next(); - } - - - } -} diff --git a/EyePaint/Tobii.EyeX.Client.Net20.dll b/EyePaint/Tobii.EyeX.Client.Net20.dll deleted file mode 100644 index 7e70427..0000000 Binary files a/EyePaint/Tobii.EyeX.Client.Net20.dll and /dev/null differ diff --git a/EyePaint/Tobii.EyeX.Client.dll b/EyePaint/Tobii.EyeX.Client.dll deleted file mode 100644 index 25a4d15..0000000 Binary files a/EyePaint/Tobii.EyeX.Client.dll and /dev/null differ diff --git a/EyePaint/Tobii.Gaze.Core.Net.dll b/EyePaint/Tobii.Gaze.Core.Net.dll deleted file mode 100644 index 398f914..0000000 Binary files a/EyePaint/Tobii.Gaze.Core.Net.dll and /dev/null differ diff --git a/EyePaint/Tobii.Gaze.Core.Net.xml b/EyePaint/Tobii.Gaze.Core.Net.xml deleted file mode 100644 index 34fb6d0..0000000 --- a/EyePaint/Tobii.Gaze.Core.Net.xml +++ /dev/null @@ -1,2184 +0,0 @@ - - - - Tobii.Gaze.Core.Net - - - - - Calibration Object holding the calibration data - - - - - Initializes a new instance of the class. - - The data. - - - - Initializes a new instance of the class. - - The calibration blob (native). - - - - Gets the raw calibration data. - - The calibration data in a byte array. - - - - Translates the raw calibration data to a list of calibration plot items - - An array of plot items. - - - - Converts this instance to an internal calibration. - - An internal type instance. - - - - This class holds information about a calibration point sample. - - - - - Initializes a new instance of the struct. - - The true position. - The left map position. - The left status. - The right map status. - The right status. - - - - Initializes a new instance of the struct. - - The p. - - - - Determines if CalibrationPointData point1 is equal to CalibrationPointData point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if CalibrationPointData point1 is not equal to CalibrationPointData point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other CalibrationPointData instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Gets the point in normalized coordinates on the display area where the calibration stimulus was displayed. - - - - - Gets the left eye gaze point in normalized coordinates on the display area after calibration. - - - - - Gets the status code containing information about the validity and usage of the left eye data. - - - - - Gets the right eye gaze point in normalized coordinates on the display area after calibration. - - - - - Gets the status code containing information about the validity and usage of the right eye data. - - - - - This struct holds device info for eyetracker - - - - - Initializes a new instance of the struct. - - Serial number of the eye tracker - Eye tracker model - Eye tracker generation identifier - Firmware version - - - - Initializes a new instance of the struct. - - The d. - - - - Initializes a new instance of the struct. - - The d. - - - - Determines if DeviceInfo deviceInfo1 is equal to DeviceInfo deviceInfo2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if DeviceInfo deviceInfo1 is not equal to DeviceInfo deviceInfo2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other DeviceInfo instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - Gets the serial number of the eye tracker. - - - Gets the eye tracker model, e.g. "REX_DEV_Laptop". - - - Gets the eye tracker generation identifier, e.g. G5. - - - Gets the eye tracker firmware version. - - - - This struct holds a display area - - - - - Initializes a new instance of the struct. - - The top left. - The top right. - The bottom left. - - - - Initializes a new instance of the struct. - - The internal display area. - - - - Determines if DisplayArea displayArea1 is equal to DisplayArea displayArea2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if DisplayArea displayArea1 is not equal to DisplayArea displayArea2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other DisplayArea instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Gets the top left. - - - - - Gets the top right. - - - - - Gets the bottom left. - - - - - Enum containing error codes returned from the calls to the native layer. - - - - - Indicates success. - - - - - Generic error. - - - - - Generic error. - - - - - Generic error. - - - - - Generic error. - - - - - Sync function error. - - - - - Sync function error. - - - - - Transport error. - - - - - Transport error. - - - - - Transport error. - - - - - Transport error. - - - - - Transport error. - - - - - Transport error. - - - - - Protocol error. - - - - - Protocol version error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Configuration error. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Error from eye tracker firmware. - - - - - Interface making up the access point to eye tracker related functionality. - - - - - Breaks the event loop. This will make the blocking call return. - Must NOT be called from a callback. - - - - - Connects to eye tracker synchronously. - Throws EyeTrackerException if not successful - - - - - Connects to eye tracker asynchronously. - - - A callback function that will be called on command completion. - - - - - Disconnect from eye tracker synchronously. - - - - - Disconnects from eye tracker asynchronously. - - - A callback function that will be called on command completion. - - - - - Gets the device info, such as platform, versions etc, synchronously. - Throws EyeTrackerException if not successful. - - The device info. - - - - Gets the device info, such as platform, versions etc, asynchronously. - - - A callback function that will be called on command completion. - - Throws EyeTrackerException if not successful. - - - - Gets the track box synchronously. - - The track box. - Throws EyeTrackerException if not successful. - - - - Gets the track box asynchronously. - - - A callback function that will be called on command completion. - - - - - Gets the mounting geometry asynchronously. - - - A callback function that will be called on command completion. - - - - - Gets the mounting geometry synchronously. - - The mounting geometry. - Throws EyeTrackerException if not successful. - - - - Registers a callback providing a key for unlocking the eye tracker. The Tobii Gaze Core library unlocks developer edition - eye trackers automatically; this function can be used to unlock other eye trackers. Registering a key provider disables the built-in default key. - - The key for unlocking - Throws EyeTrackerException if not successful. - - - - Runs the event loop. This is a blocking call and must be called on a dedicated thread. - - Throws EyeTrackerException if not successful. - - - - Starts gaze tracking synchronously. - When available, the Gaze data will be delivered with the GazeData event handler. - - Throws EyeTrackerException if not successful. - - - - Starts gaze tracking asynchronously. - When available, the Gaze data will be delivered with the GazeData event handler. - - - A callback function that will be called on command completion. - - - - - Stops gaze tracking asynchronously. - When available, the Gaze data will be delivered with the GazeData event handler. - - Throws EyeTrackerException if not successful. - - - - Stops gaze tracking asynchronously. - When available, the Gaze data will be delivered with the GazeData event handler. - - - A callback function that will be called on command completion. - - - - - Starts the calibration routine asynchronously. - - - A callback function that will be called on command completion. - - - - - Stops the calibration routine asynchronously. - - - A callback function that will be called on command completion. - - - - - Adds a point for calibration asynchronously. - - - A two dimensional point in screen coordinates (0.0 - 1.0) where the user's gaze is expected to be. - - - A callback function that will be called on command completion. - - - - - Removes a point for calibration asynchronously. - - - A two dimensional point in screen size percentage which has previously been added to the calibration but which should now be removed. - - - A callback function that will be called on command completion. - - - - - Computes the calibration based on the previously processed points asynchronously. This calibration will be set as the active one if it succeeds. - If the computed calibration does not have enough data it will fail with the error code ErrorCodes.FirmwareOperationFailed via the callback. - - - A callback function that will be called on command completion. - - - - - Gets current calibration asynchronously. This can be stored away and set later using . - - - A callback function that will be called on command completion. - - - - - Sets calibration asynchronously. - - The calibration to set, this must be valid until completionStatusCallback is called. - - A callback function that will be called on command completion. - - - - - Gets current calibration synchronously. This can be stored away and set later using . - - The calibration data. - - - - Sets calibration synchronously. - - The calibration - - - - Get the display area of the device asynchronously. - - - A callback function that will be called on command completion. - - - - - Sets the display area of the device asynchronously. - - The display area - - A callback function that will be called on command completion. - The callback will return errorCode , if the connected Eye Tracker does not support the operation. - - - - - Get the display area of the device synchronously. - - The display area. - - - - Set the display area of the device synchronously. - Throws if not successful, where errorCode will be . - if the connected Eye Tracker does not support the operation. - - The display area - - - - Sends a custom command to the eye tracker. - - A buffer containing the data to be sent. - - A pre-allocated buffer that will contain the reply data. It is up to the caller to allocate a byte array - big enough to contain the expected reply. - - - - - Sends a custom command to the eye tracker. - - A buffer containing the data to be sent. - A callback function that will be called on command completion. - - - - Sends a custom command to the eye tracker. - - The option to set - A buffer containing the value of the option to set. - - - - Reports error code when a spontaneous error occurs (an error not directly associated with a command). - Most likely this error is related to problems with the eye tracker communication and is unrecoverable. - - - - - Provides eye tracking gaze data when available. - - - - - Gets the URI associated with the eyetracker. - Throws EyeTrackerException if not successful - - - - - Gets a value indicating whether the eye tracker is connected or not. - - - - - Initializes a new instance of the class. - Throws EyeTrackerException if creation fails. - - A Uri identifying the eye tracker. Currently only the tet-tcp protocol is defined. Example: "tet-tcp://172.68.195.1". - - - - Destroys eye tracker instance. Must NOT be called from a callback. - - - - See . - Parameter completionStatusCallback documented in . - - - See . - - - See . - Parameter completionCallback documented in . - - - See . - - - See . - - - See . - - - See . - Parameter completionStatusCallback documented in . - - - See . - - - See . - Parameter completionStatusCallback documented in . - - - See . - - - See . - Parameter deviceInfoCallback documented in . - - - See . - Return value documented in . - - - See . - Parameter trackBoxCallback documented in . - - - See . - Return value documented in . - - - See . - Parameter geometryMountingCallback documented in . - - - See . - Return value documented in . - - - See . - Parameter keyProvider documented in . - - - See . - Parameter completionStatusCallback documented in . - - - See . - Parameter completionStatusCallback documented in . - - - See . - Parameter point documented in . - Parameter completionStatusCallback documented in . - - - See . - Parameter point documented in . - Parameter completionStatusCallback documented in . - - - See . - Parameter completionStatusCallback documented in . - - - See . - Parameter calibrationCallback documented in . - - - See . - Parameter calibration documented in . - Parameter completionStatusCallback documented in . - - - See . - Return value is documented in . - - - See . - Parameter calibration documented in . - - - See . - Parameter displayAreaCallback documented in - - - See . - Parameter displayArea documented in . - Parameter completionStatusCallback documented in . - - - See . - Return value documented in . - - - See . - Parameter displayArea documented in . - - - See . - Parameter inData documented in . - Parameter outData documented in . - - - See . - Parameter inData documented in . - Parameter outData documented in . - - - See . - Parameter inData documented in . - Parameter outData documented in . - - - See . - - - See . - - - Gets the URI of the eyetracker. See . - - - Gets a value indicating whether the eye tracker is connected or not. See . - - - - Gets the handle to the eye tracker instance - - - - - Initializes a new instance of the class. This class - should not be used by API clients! - Throws EyeTrackerException if creation fails. - - A Uri identifying the eye tracker. Currently only the tet-tcp protocol is defined. Example: "tet-tcp://172.68.195.1". - - - - Wraps the EyeTracker core library. - - - - - Base class for library wrappers. - - - - - Interface to wrap library meta functions. - - - - - Gets the version of the native DLL. - - The version number of the native DLL. - This is a global function and does not depend on the connected eye tracker. - - - - Sets the logging level in the native API. - - Name of the file. - The log level. - This is a global function and does not depend on the connected eye tracker. - - - - Gets the version of the native DLL. - - - The version number of the native DLL. - - - - - Sets the logging level in the native API. - - Name of the file. - The log level. - - - - Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - - - - - Throws an exception if the error code is not 0. - - The error code. - - - - Sets the logging in the native library. - - Name of the file. - The log level. - The error code from the native library. - - - - Releases unmanaged and - optionally - managed resources - - true to release both managed and unmanaged resources; false to release only unmanaged resources. - - - - Returns the Uri of a connected eye tracker. - - - The Uri of the eye tracker, or null if no eye tracker is connected - - - - - Lists all connected USB trackers. - - - A list of the USB trackers device info. - - - - - Gets the version of the native DLL. - - - The version number of the native DLL. - - - - - Lists all connected USB trackers. - - - A list of the USB trackers device info. - - - - - Returns the Uri of a connected eye tracker. - - - The Uri of the eye tracker, or null if no eye tracker is connected - - - - - Sets the logging in the native library. - - Name of the file. - The log level. - - The error code from the native library. - - - - - This class holds gaze data received from the eye tracker. - - - - - Initializes a new instance of the struct. - - The time stamp. - The tracking status. - The left. - The right. - - - - Initializes a new instance of the struct. - - The internalGazeData. - - - - Determines if GazeData d1 is equal to GazeData d2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if GazeData 1 is not equal to GazeData 2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other GazeData instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - Gets the timestamp for the gaze data - - - Gets the combined tracking status for both eyes. - - - Gets gaze data for the left eye - - - Gets gaze data for the right eye - - - - This class holds gaze data received from the eye tracker. - - - - - Initializes a new instance of the struct. - - The internalGazeDataExtension. - - - - Determines if GazeDataExtension d1 is equal to GazeDataExtension d2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if GazeDataExtension 1 is not equal to GazeDataExtension 2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other GazeDataExtension instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - Gets the column Id that identifies the extension data - - - Gets the extension raw data - - - - This class holds gaze data for one eye. - - - - - Initializes a new instance of the struct. - - The eye position from eye tracker in millimeter. - The eye position in track box normalized. - The gaze point from eye tracker in millimeter. - The gaze point on display normalized. - - - - Initializes a new instance of the struct. - - The g. - - - - Determines if GazeDataEye d1 is equal to GazeDataEye d2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if GazeDataEye d1 is not equal to GazeDataEye d2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other GazeDataEye instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Gets the eye position from eye tracker MM. - - - - - Gets the eye position in track box normalized. - - - - - Gets the gaze point from eye tracker MM. - - - - - Gets the gaze point on display normalized. - - - - - Initializes a new instance of the struct. - - Number of guides - Width of the eye tracker, or the width between the guides, if they exist - Mounting angle - External offset vector of the tracker - Internal offset vector of the tracker - - - - Initializes a new instance of the struct. - - The mounting. - - - - Determines if GeometryMounting geometryMounting1 is equal to GeometryMounting geometryMounting2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if geometryMounting1 is not equal to geometryMounting2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other GeometryMounting instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Gets the number of guides on the tracker. - - - - - Gets the width of the eye tracker, or the width between the guides, if they exist. - - - - - Gets the mounting angle. - - - - - Gets external offset vector of the tracker. - - - - - Gets internal offset vector of the tracker. - - - - - Get the meaning of an error code. - - The error code. - The text message for the error code. - - - - Class representing the arguments for a GazeDataEvent. - - - - - Initializes a new instance of the class. - - The gaze data. - The gaze data extensions. - - - - Gets the gaze data. - - - - - Gets the gaze data extensions. - - - - - Class representing the arguments for an EyeTrackerError event. - - - - - Initializes a new instance of the class. - - The error code. - The message. - - - - Gets the error code. - - - - - Gets the message. - - - - - Exception thrown to indicate something wrong with eye tracking. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The message. - - - - Initializes a new instance of the class. - - The error code. - - - - Initializes a new instance of the class. - - The message. - The inner exception. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - When overridden in a derived class, sets the with information about the exception. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is a null reference (Nothing in Visual Basic). - - - - - - - - Gets the error code. - - - - - Internal data types - - - - - This struct holds a two dimensional point. - - - - - This struct holds a two dimensional point. - - - - - This struct holds a three dimensional point. - - - - - This struct holds a rectangle. - - - - Specifies the x-coordinate of the upper-left corner of a rectangle. - - - Specifies the y-coordinate of the upper-left corner of a rectangle. - - - Specifies the x-coordinate of the lower-right corner of a rectangle. - - - Specifies the y-coordinate of the lower-right corner of a rectangle. - - - - This struct holds gaze data eye. - - - - - This struct holds gaze data. - - - - - This struct holds a specific gaze extension data. - - - - - This struct holds a collection of gaze extension data. - - - - - This struct holds a track box - - - - - This struct holds a mounting geometry - - - - - This struct holds a display area - - - - - This struct holds calibration data - - - - - This struct a custom command - - - - - Initializes a new instance of the class. - - - - - Extension methods for converting between public and internal data types - - - - - Toes the point2 D. - - The p. - An internal struct. - - - - Converts an internal struct to a public class. - - The instance being extended. - A Point2D instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A Point2D instance. - - - - Converts an public class to an internal struct. - - The instance being extended. - An InternalPoint3D instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A Point3D instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A DeviceInfo instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A TrackBox instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A GeometryMounting instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A DisplayArea instance. - - - - Converts an public class to an internal struct. - - The instance being extended. - An InternalDisplayArea instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A GazeData instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A GazeDataExtensions instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A GazeDataExtension instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A CalibrationPlotItem instance. - - - - Converts an internal struct to a public class. - - The instance being extended. - A GazeDataEye instance. - - - - Native methods - - - - - Enum containing settable API options - - - - - The timeout for synchronous calls - - - - - Structure representing a two dimensional point. - - - - - Initializes a new instance of the Point2D struct. - - The x value of the point. - The y value of the point. - - - - Determines if Point2D point1 is equal to Point2D point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if Point2D point1 is not equal to Point2D point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other Point2D instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other Point2D instance. - Returns true if instances are equal. - - - - Returns the hash code for this instance. - - The hash code of the instance. - - - - Returns a string representation of this instance. - - A string representation of the instance. - - - - Gets the x location of the point. - - - - - Gets the y location of the point. - - - - - Structure representing a three dimensional point. - - - - - Initializes a new instance of the Point3D struct. - - The x value of the point. - The y value of the point. - The z value of the point. - - - - Determines if Point3D point1 is equal to Point3D point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if Point3D point1 is not equal to Point3D point2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other Point3D instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other Point3D instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Returns a string representation of this instance. - - A string representation of the instance. - - - - Gets the x location of the point. - - - - - Gets the y location of the point. - - - - - Gets the z location of the point. - - - - - Structure representing a rectangle. - - - - - Initializes a new instance of the struct. - - The x position. - The y position. - The width. - The height. - - - - Determines if Rect rect1 is equal to Rect rect2. - - Left-hand rect. - Right-hand rect. - An indication of equality between the two rects, based on extent. - - - - Determines if Point2D point1 is not equal to Point2D point2. - - Left-hand rect. - Right-hand rect. - An indication of inequality between the two rects based on their extent. - - - - Indicates whether this instance and a specified object are equal. - - Object with which to compare. - A value indicating if the objects are equal. - - - - Indicates whether this instance and a specified object are equal. - - Object with which to compare. - A value indicating if object is equal to the current instance. - - - - Returns the hash code for this instance. - - The hash code. - - - - Returns the string representation of this instance. - - The string representation. - - - - Gets the x location of the Rect. - - - - - Gets the y location of the Rect. - - - - - Gets the width of the Rect. - - - - - Gets the height of the Rect. - - - - - Gets the bottom of this instance. - - - - - Gets the right end of this instance. - - - - - This type is used for callback functions that are registered with several asynchronous commands that do not have any return data or an error code. - The callback function will be called when the command is completed. - - - - - This type is used for callback functions that are registered with several asynchronous commands that do not have any return data. - The callback function will be called when the command is completed. - - Will be set to ErrorCode.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with EyeTracker.GetDeviceInfoAsync. - The callback function will be called when the command is completed. - - The retrieved device info. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with EyeTracker.GetTrackBoxAsync. - The callback function will be called when the command is completed. - - The retrieved Track Box. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with EyeTracker.GetGeometryMountingAsync. - The callback function will be called when the command is completed. - - The retrieved mounting geometry. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with EyeTracker.RegisterKeyProvider. - The callback function will be called when an eye tracker is to be unlocked. - - The realm of the eye tracker to provide the key for. - The key to use for unlocking the eye tracker. - - - - This type is used for the callback function that is registered with EyeTracker.GetCalibrationAsync. - The callback function will be called when the command is completed - - The retrieved Calibration. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with EyeTracker.GetDisplayAreaAsync. - The callback function will be called when the command is completed. - - The retrieved Display Area. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This type is used for the callback function that is registered with ConfigurationProvider.RegisterSettingsChangeListener. - The callback function will be called whenever a setting is changed. - - The type of setting that has changed. - Will be set to ErrorCodes.Success if operation was successful, otherwise to an error code. - - - - This enum hold the different log levels. - - - - - No logging. - - - - - Debug logging. This is the most verbose level. Logs all messages. - - - - - Log only information level messages (and above). - - - - - Log only warning level messages (and above). - - - - - Log only error level messages. - - - - - This enum hold the possible gaze tracking statuses. - - - - - No eyes were detected. - - - - - Both eyes tracked. - - - - - Only left eye tracked. - - - - - Only one eye tracked, probably the left. - - - - - Only one eye tracked, not sure which. - - - - - Only one eye tracked, probably the right. - - - - - Only right eye tracked. - - - - - This enum hold the possible calibration point statuses. - - - - - Calibration point has failed or is invalid. - - - - - Calibration point is valid but not used in calibration. - - - - - Calibration point is valid and used in calibration. - - - - - This enum hold the possible settings type for settings changed callbacks - - - - - Invalid or unknown settings type - - - - - Eye tracking configuration as configured in Eye Tracking Control Panel - - - - - Display monitor settings in the operating system, such as PPI/DPI and resolution - - - - - Helper functions when marshaling between managed and unmanaged code. - - - - - Gets the calibration data as a managed object. - - The calibration blob pointer. - The blob data as a byte array. - - - - Gets the calibration blob pointer. - - The data. - A pointer to a native object. - - - - Gets the length of the zero terminated string in the buffer. - - The buffer as a byte array. - The length of the string or the size of the buffer if the string doesn't terminate. - - - - Gets the length of the zero terminated string. - - A pointer to the buffer. - The length of the string in the buffer. - - - - Gets the zero terminated UTF8 string. - - The buffer as a byte array. - A .net string. - - - - Gets the zero terminated UTF8 string. - - A pointer to the buffer. - A .net string object. - - - - Custom marshaler for UTF-8 strings. - - - - - Singleton method. - - The cookie. - The singleton instance. - - - - Marshals the managed to native. - - The managed obj. - A pointer to a native object. - - - - Cleans up native data. - - The native data. - - - - Returns the size of the native data to be marshaled. - - - The size, in bytes, of the native data. - - - - - Marshals the native to managed. - - The native data. - A managed object. - - - - Cleans up managed data. - - The managed obj. - - - - This struct holds a track box - - - - - Initializes a new instance of the struct. - - The t. - - - - Determines if TrackBox d1 is equal to TrackBox d2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are equal. - - - - Determines if TrackBox trackBox1 is not equal to TrackBox trackBox2. - - First instance in comparison. - Second instance in comparison. - Returns true if instances are not equal. - - - - Indicates whether this instance and a specified object are equal. - - Other object instance. - Returns true if instances are equal. - - - - Indicates whether this instance and a specified object are equal. - - Other DisplayArea instance. - Returns true if instances are equal. - - - - Returns the hash code of the instance. - - The hash code of the instance. - - - - Gets the front upper right point. - - - - - Gets the front upper left point. - - - - - Gets the front lower left point. - - - - - Gets the front lower right point. - - - - - Gets the back upper right point. - - - - - Gets the back upper left point. - - - - - Gets the back lower left point. - - - - - Gets the back lower right point. - - - - diff --git a/EyePaint/TobiiGazeCore32.dll b/EyePaint/TobiiGazeCore32.dll deleted file mode 100644 index b034a7c..0000000 Binary files a/EyePaint/TobiiGazeCore32.dll and /dev/null differ diff --git a/EyePaint/View.cs b/EyePaint/View.cs deleted file mode 100644 index 7a2c040..0000000 --- a/EyePaint/View.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Media; -using System.Windows.Media.Imaging; - -namespace EyePaint -{ - internal class View - { - internal Canvas canvas; - - internal View(RenderTargetBitmap image) - { - canvas = new Canvas(image); - } - - internal void Rasterize(Queue renderQueue) - { - while (renderQueue.Count() != 0) - { - RenderObject renderObject = renderQueue.Dequeue(); - try - { - renderObject.Rasterize(ref canvas); // TODO: Sometimes crashes program. Wrap in try/catch. - } - catch - { - Console.WriteLine("crashed"); - } - } - } - - internal void Clear() - { - Color whiteBg = Color.FromArgb(255, 255, 255, 255); - } - - internal void setBackGroundColorRandomly() - { - ColorTool ct = new ColorTool("random", "null", 0, 360, 0.9, 1, 0.9, 1); - Color color = ct.getRandomShade(255); - canvas.SetBackGroundColor(color); - } - } - - //TODO This is not a canvas. Rename the class. Better yet: merge the class's fields and methods with the View class. - internal class Canvas - { - RenderTargetBitmap image; - SolidColorBrush mySolidColorBrush = new SolidColorBrush(); - DrawingVisual drawingVisual = new DrawingVisual(); - Random rnd = new Random(); - - internal Canvas(RenderTargetBitmap image) - { - this.image = image; - } - - internal void DrawLine(Color color, int width, Point p1, Point p2) - { - DrawingContext drawingContext = drawingVisual.RenderOpen(); - mySolidColorBrush.Color = color; - Pen pen = new Pen(mySolidColorBrush, width); - drawingContext.DrawLine(pen, p1, p2); - drawingContext.Close(); - image.Render(drawingVisual); - } - - internal void DrawElipse(Color color, int radius, Point point) - { - DrawingContext drawingContext = drawingVisual.RenderOpen(); - mySolidColorBrush.Color = color; - drawingContext.DrawEllipse(mySolidColorBrush, null, point, radius, radius); - drawingContext.Close(); - image.Render(drawingVisual); - } - - internal void DrawPolygon(Color color, Point[] vertices) - { - StreamGeometry streamGeometry = new StreamGeometry(); - using (StreamGeometryContext geometryContext = streamGeometry.Open()) - { - geometryContext.BeginFigure(vertices[0], true, true); //TODO check if this can be made in a more safe way the [0] - PointCollection points = new PointCollection(); - for (int i = 1; i < vertices.Count();i++) - { - points.Add(vertices[i]); - } - geometryContext.PolyLineTo(points, true, true); - } - - // Draw the polygon visual - DrawingContext drawingContext = drawingVisual.RenderOpen(); - - drawingContext.DrawGeometry(mySolidColorBrush, null, streamGeometry); - - drawingContext.Close(); - image.Render(drawingVisual); - } - - internal void SetBackGroundColor(Color color) - { - DrawingContext drawingContext = drawingVisual.RenderOpen(); - byte red = (byte)rnd.Next(255); - byte green = (byte)rnd.Next(255); - byte blue = (byte)rnd.Next(255); - mySolidColorBrush.Color = Color.FromArgb(255, red, green, blue); - Size size = new Size(image.Width, image.Height); - Rect rect = new Rect(size); - drawingContext.DrawRectangle(mySolidColorBrush, null, rect); - drawingContext.Close(); - image.Render(drawingVisual); - } - } -} diff --git a/README.md b/README.md deleted file mode 100644 index b3d9c70..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -EyePaint -======== - -Måla med ögonen på Tekniska Museet