Ejemplo n.º 1
0
 public SurfacePlot(ISurface surface, double a1, double b1, int n1, double a2, double b2, int n2, params IFunctionPlotStyle[] styles)
 {
     Surface = surface;
     Segment1 = new FunctionPlotSegment(a1, b1, n1);
     Segment2 = new FunctionPlotSegment(a2, b2, n2);
     Properties = new PlotProperties(styles);
 }
		/// <summary>
		/// Render the effect from the source surface to the destination surface.
		/// </summary>
		/// <param name="src">The source surface.</param>
		/// <param name="dst">The destination surface.</param>
		public virtual void Render (ISurface src, ISurface dst)
		{
			if (src.Bounds != dst.Bounds)
				throw new InvalidOperationException ("Source and destination surfaces must be the same size.");

			Render (src, dst, src.Bounds);
		}
		protected override void OnBeginRender (ISurface src, ISurface dst, Rectangle roi)
		{
			var histogram = new HistogramRgb ();
			histogram.UpdateHistogram (src, src.Bounds);

			op = histogram.MakeLevelsAuto ();
		}
Ejemplo n.º 4
0
        public ImageEditorForm(ISurface iSurface, bool outputMade)
        {
            EditorList.Add(this);

            InitializeComponent();

            if (EditorConfiguration.MatchSizeToCapture)
            {
                RECT lastPosition = EditorConfiguration.GetEditorPlacement().NormalPosition;
                this.StartPosition = FormStartPosition.Manual;
                this.Location = new Point(lastPosition.Left, lastPosition.Top);
            }
            else
            {
                Load += delegate
                {
                    //Make sure the editor is placed on the same location as the last editor was on close
                    WindowDetails thisForm = new WindowDetails(Handle)
                    {
                        WindowPlacement = EditorConfiguration.GetEditorPlacement()
                    };
                };
            }

            // init surface
            Surface = iSurface;
            // Intial "saved" flag for asking if the image needs to be save
            _surface.Modified = !outputMade;

            UpdateUi();

            // Workaround: As the cursor is (mostly) selected on the surface a funny artifact is visible, this fixes it.
            //HideToolstripItems();
        }
Ejemplo n.º 5
0
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            _log.Debug("Start capture export to oo.vg");

            try
            {
                string uploadUrl;

                var exportInformation = new ExportInformation(this.Designation, this.Description)
                {
                    ExportMade = UploadImage(captureDetails, surface, out uploadUrl),
                    Uri = uploadUrl
                };

                ProcessExport(exportInformation, surface);

                if (exportInformation.ExportMade)
                {
                    Clipboard.SetText(uploadUrl);
                }

                return exportInformation;
            }
            finally
            {
                _log.Debug("Export to oo.vg complete");
            }
        }
		public Task ApplyAsync (ISurface src, ISurface dst)
		{
			if (dst.Size != src.Size)
				throw new ArgumentException ("dst.Size != src.Size");

			return ApplyAsync (src, dst, dst.Bounds, CancellationToken.None);
		}
		public Task ApplyAsync (ISurface src, ISurface dst, CancellationToken token, IRenderProgress progress)
		{
			if (dst.Size != src.Size)
				throw new ArgumentException ("dst.Size != src.Size");

			return ApplyAsync (src, dst, dst.Bounds, token, progress);
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Do the actual upload to Picasa
		/// </summary>
		/// <param name="surfaceToUpload">Image to upload</param>
		/// <param name="outputSettings"></param>
		/// <param name="title"></param>
		/// <param name="filename"></param>
		/// <returns>PicasaResponse</returns>
		public static string UploadToPicasa(ISurface surfaceToUpload, SurfaceOutputSettings outputSettings, string title, string filename) {
			// Fill the OAuth2Settings
			OAuth2Settings settings = new OAuth2Settings();
			settings.AuthUrlPattern = AuthUrl;
			settings.TokenUrl = TokenUrl;
			settings.CloudServiceName = "Picasa";
			settings.ClientId = PicasaCredentials.ClientId;
			settings.ClientSecret = PicasaCredentials.ClientSecret;
			settings.AuthorizeMode = OAuth2AuthorizeMode.LocalServer;

			// Copy the settings from the config, which is kept in memory and on the disk
			settings.RefreshToken = Config.RefreshToken;
			settings.AccessToken = Config.AccessToken;
			settings.AccessTokenExpires = Config.AccessTokenExpires;

			try {
				var webRequest = OAuth2Helper.CreateOAuth2WebRequest(HTTPMethod.POST, string.Format(UploadUrl, Config.UploadUser, Config.UploadAlbum), settings);
				if (Config.AddFilename) {
					webRequest.Headers.Add("Slug", NetworkHelper.EscapeDataString(filename));
				}
				SurfaceContainer container = new SurfaceContainer(surfaceToUpload, outputSettings, filename);
				container.Upload(webRequest);
				
				string response = NetworkHelper.GetResponseAsString(webRequest);

				return ParseResponse(response);
			} finally {
				// Copy the settings back to the config, so they are stored.
				Config.RefreshToken = settings.RefreshToken;
				Config.AccessToken = settings.AccessToken;
				Config.AccessTokenExpires = settings.AccessTokenExpires;
				Config.IsDirty = true;
				IniConfig.Save();
			}
		}
Ejemplo n.º 9
0
 public static void Initialize(         
  IConsole console,
  ISurface surface,
  IStyle style,
  IDrawings drawing,
  IShapes shapes,
  IImages images,
  IControls controls,
  ISounds sounds,         
  IKeyboard keyboard,
  IMouse mouse,
  ITimer timer,
  IFlickr flickr,
  ISpeech speech,
  CancellationToken token)
 {
     TextWindow.Init(console);
      Desktop.Init(surface);
      GraphicsWindow.Init(style, surface, drawing, keyboard, mouse);
      Shapes.Init(shapes);
      ImageList.Init(images);
      Turtle.Init(surface, drawing, shapes);
      Controls.Init(controls);
      Sound.Init(sounds);
      Timer.Init(timer);
      Stack.Init();
      Flickr.Init(flickr);
      Speech.Init(speech);
      Program.Init(token);
 }
Ejemplo n.º 10
0
        public ImageEditorForm(ISurface iSurface, bool outputMade)
        {
            editorList.Add(this);

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            ManualLanguageApply = true;
            InitializeComponent();

            Load += delegate {
                var thread = new Thread(delegate() {AddDestinations();});
                thread.Name = "add destinations";
                thread.Start();
            };

            // Make sure the editor is placed on the same location as the last editor was on close
            WindowDetails thisForm = new WindowDetails(Handle);
            thisForm.WindowPlacement = editorConfiguration.GetEditorPlacement();

            // init surface
            Surface = iSurface;
            // Intial "saved" flag for asking if the image needs to be save
            surface.Modified = !outputMade;

            updateUI();

            // Workaround: As the cursor is (mostly) selected on the surface a funny artifact is visible, this fixes it.
            hideToolstripItems();
        }
		public Task ApplyAsync (ISurface src, ISurface dst, CancellationToken token)
		{
			if (src.Bounds != dst.Bounds)
				throw new InvalidOperationException ("Source and destination surfaces must be the same size or use an overload with a specified bounds.");

			return ApplyAsync (src, dst, src.Bounds, token);
		}
Ejemplo n.º 12
0
		public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
			ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
			SurfaceOutputSettings outputSettings = new SurfaceOutputSettings();

			
			if (presetCommand != null) {
				if (!config.runInbackground.ContainsKey(presetCommand)) {
					config.runInbackground.Add(presetCommand, true);
				}
				bool runInBackground = config.runInbackground[presetCommand];
				string fullPath = captureDetails.Filename;
				if (fullPath == null) {
					fullPath = ImageOutput.SaveNamedTmpFile(surface, captureDetails, outputSettings);
				}

				string output;
				string error;
				if (runInBackground) {
					Thread commandThread = new Thread(delegate() {
						CallExternalCommand(exportInformation, presetCommand, fullPath, out output, out error);
						ProcessExport(exportInformation, surface);
					});
					commandThread.Name = "Running " + presetCommand;
					commandThread.IsBackground = true;
					commandThread.SetApartmentState(ApartmentState.STA);
					commandThread.Start();
					exportInformation.ExportMade = true;
				} else {
					CallExternalCommand(exportInformation, presetCommand, fullPath, out output, out error);
					ProcessExport(exportInformation, surface);
				}
			}
			return exportInformation;
		}
		public void Apply (ISurface src, ISurface dst)
		{
			if (src.Bounds != dst.Bounds)
				throw new InvalidOperationException ("Source and destination surfaces must be the same size or use an overload with a specified bounds.");

			Apply (src, dst, src.Bounds);
		}
		protected unsafe override void RenderLine (ISurface src, ISurface dest, Rectangle roi)
		{
			float redAdjust = 1.0f + (warmth / 100.0f);
			float blueAdjust = 1.0f - (warmth / 100.0f);

			this.blur_effect.Render (src, dest, roi);
			this.bac_adjustment.Render (src, dest, roi);

			for (int y = roi.Top; y <= roi.Bottom; ++y) {
				ColorBgra* srcPtr = src.GetPointAddress (roi.X, y);
				ColorBgra* dstPtr = dest.GetPointAddress (roi.X, y);

				for (int x = roi.Left; x <= roi.Right; ++x) {
					ColorBgra srcGrey = this.desaturate_op.Apply (*srcPtr);

					srcGrey.R = Utility.ClampToByte ((int)((float)srcGrey.R * redAdjust));
					srcGrey.B = Utility.ClampToByte ((int)((float)srcGrey.B * blueAdjust));

					ColorBgra mypixel = this.overlay_op.Apply (srcGrey, *dstPtr);
					*dstPtr = mypixel;

					++srcPtr;
					++dstPtr;
				}
			}
		}
		protected unsafe override void RenderLine (ISurface src, ISurface dest, Rectangle rect)
		{
			for (int y = rect.Top; y <= rect.Bottom; ++y) {
				int yEnd = y + 1;

				for (int x = rect.Left; x <= rect.Right; ++x) {
					var cellRect = GetCellBox (x, y, cell_size);
					cellRect.Intersect (dest.Bounds);
					var color = ComputeCellColor (x, y, src, cell_size, src.Bounds);

					int xEnd = Math.Min (rect.Right, cellRect.Right);
					yEnd = Math.Min (rect.Bottom, cellRect.Bottom);

					for (int y2 = y; y2 <= yEnd; ++y2) {
						ColorBgra* ptr = dest.GetPointAddress (x, y2);

						for (int x2 = x; x2 <= xEnd; ++x2) {
							ptr->Bgra = color.Bgra;
							++ptr;
						}
					}

					x = xEnd;
				}

				y = yEnd;
			}
		}
		public void Apply (ISurface src, ISurface dst)
		{
			if (dst.Size != src.Size)
				throw new ArgumentException ("dst.Size != src.Size");

			ApplyLoop (src, dst, dst.Bounds, CancellationToken.None, null);
		}
Ejemplo n.º 17
0
 public CommandCenter(ICommandParser commandParser, IRobot robot, ISurface surface, CommandFactory commandFactory)
 {
     _robot = robot;
     _commandParser = commandParser;
     Surface = surface;
     _commandFactory = commandFactory;
     _executedCommands = new List<ICommand>();
 }
Ejemplo n.º 18
0
        public Order(ISurface facet, bool ascending)
        {
            if ((object)facet == null)
                throw new ArgumentNullException("facet");

            this.facet = facet;
            this.ascending = ascending;
        }
Ejemplo n.º 19
0
		public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
			ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
			string uploadURL = null;
			exportInformation.ExportMade = plugin.Upload(captureDetails, surface, out uploadURL);
			exportInformation.Uri = uploadURL;
			ProcessExport(exportInformation, surface);
			return exportInformation;
		}
Ejemplo n.º 20
0
		public PrintHelper(ISurface surface, ICaptureDetails captureDetails) {
			this.surface = surface;
			this.captureDetails = captureDetails;
			printDialog.UseEXDialog = true;
			printDocument.DocumentName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(conf.OutputFileFilenamePattern, captureDetails);
			printDocument.PrintPage += DrawImageForPrint;
			printDialog.Document = printDocument;
		}
		protected unsafe override void RenderLine (ISurface src, ISurface dst, Rectangle rect)
		{
			double[,] weights = Weights;

			var srcWidth = src.Width;
			var srcHeight = src.Height;

			// loop through each line of target rectangle
			for (int y = rect.Top; y <= rect.Bottom; ++y) {
				int fyStart = 0;
				int fyEnd = 3;

				if (y == 0)
					fyStart = 1;

				if (y == srcHeight - 1)
					fyEnd = 2;

				// loop through each point in the line 
				ColorBgra* dstPtr = dst.GetPointAddress (rect.Left, y);

				for (int x = rect.Left; x <= rect.Right; ++x) {
					int fxStart = 0;
					int fxEnd = 3;

					if (x == 0)
						fxStart = 1;

					if (x == srcWidth - 1)
						fxEnd = 2;

					// loop through each weight
					double sum = 0.0;

					for (int fy = fyStart; fy < fyEnd; ++fy) {
						for (int fx = fxStart; fx < fxEnd; ++fx) {
							double weight = weights[fy, fx];
							ColorBgra c = src.GetPoint (x - 1 + fx, y - 1 + fy);
							double intensity = (double)c.GetIntensityByte ();
							sum += weight * intensity;
						}
					}

					int iSum = (int)sum;
					iSum += 128;

					if (iSum > 255)
						iSum = 255;

					if (iSum < 0)
						iSum = 0;

					*dstPtr = ColorBgra.FromBgra ((byte)iSum, (byte)iSum, (byte)iSum, 255);

					++dstPtr;
				}
			}
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Saves ISurface to stream with specified output settings
		/// </summary>
		/// <param name="surface">ISurface to save</param>
		/// <param name="stream">Stream to save to</param>
		/// <param name="outputSettings">SurfaceOutputSettings</param>
		public static void SaveToStream(ISurface surface, Stream stream, SurfaceOutputSettings outputSettings) {
			Image imageToSave;
			bool disposeImage = CreateImageFromSurface(surface, outputSettings, out imageToSave);
			SaveToStream(imageToSave, surface, stream, outputSettings);
			// cleanup if needed
			if (disposeImage && imageToSave != null) {
				imageToSave.Dispose();
			}
		}
		public BitVector2DSurfaceAdapter (ISurface surface)
		{
			if (surface == null)
				throw new ArgumentNullException ("surface");

			this.surface = surface;
			src_width = surface.Width;
			src_height = surface.Height;
		}
Ejemplo n.º 24
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PlotSurface()
        {
            // double buffer, and update when resize.
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.DoubleBuffer, true);
            base.SetStyle(ControlStyles.UserPaint, true);
            base.ResizeRedraw = true;

            surface_ = new NPlot.Windows.PlotSurface2D();
        }
		public void Apply (ISurface lhs, ISurface rhs, ISurface dst)
		{
			if (dst.Size != lhs.Size)
				throw new ArgumentException ("dst.Size != lhs.Size");

			if (lhs.Size != rhs.Size)
				throw new ArgumentException ("lhs.Size != rhs.Size");

			ApplyLoop (lhs, rhs, dst, dst.Bounds, CancellationToken.None, null);
		}
Ejemplo n.º 26
0
		public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
			ExportInformation exportInformation = new ExportInformation(Designation, Description);
			string uploadUrl = _plugin.Upload(captureDetails, surface);
			if (uploadUrl != null) {
				exportInformation.ExportMade = true;
				exportInformation.Uri = uploadUrl;
			}
			ProcessExport(exportInformation, surface);
			return exportInformation;
		}
Ejemplo n.º 27
0
        private void CreateCubeTexture(Device device)
        {
            CubeTexture = new CubeTexture(device, _edgeSize, 1, _usage, _format, _pool);

            CubeMapSurface = new ISurface[6];
            for (var i = 0; i < 6; i++)
            {
                CubeMapSurface[i] = WrappedSurface.CubeMapSurface((CubeMapFaceEnum) i, this);
            }
        }
Ejemplo n.º 28
0
        private bool UploadImage(ICaptureDetails captureDetails, ISurface surface, out string url)
        {
            string path = null;

            try
            {
                _log.Debug("Exporting file to oo.vg");

                var uploadUrl = "http://oo.vg/a/upload";

                var config = IniConfig.GetIniSection<OovgConfiguration>();

                if (!string.IsNullOrEmpty(config.UploadKey))
                {
                    uploadUrl += $"?key={HttpUtility.UrlEncode(config.UploadKey)}";
                }

                // Temporarily store the file somewhere
                path = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings(OutputFormat.png));

                ServicePointManager.Expect100Continue = false;
                var webClient = new WebClient();
                var response = webClient.UploadFile(uploadUrl, "POST", path);

                url = Encoding.ASCII.GetString(response);

                _log.InfoFormat("Upload of {0} to {1} complete", captureDetails.Filename, url);

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while uploading file:" + Environment.NewLine + ex.Message, "oo.vg Screenshot Share");

                _log.Fatal("Uploading failed", ex);

                url = null;
                return false;
            }
            finally
            {
                // clean up after ourselves
                if (!string.IsNullOrEmpty(path))
                {
                    try
                    {
                        File.Delete(path);
                    }
                    catch (Exception e)
                    {
                        _log.Warn("Could not delete temporary file", e);
                    }
                }
            }
        }
		protected unsafe override void RenderLine (ISurface src, ISurface dst, Rectangle rect)
		{
			const double jr = 0.3125;
			const double ji = 0.03;

			int w = dst.Width;
			int h = dst.Height;
			double invH = 1.0 / h;
			double invZoom = 1.0 / zoom;
			double invQuality = 1.0 / quality;
			double aspect = (double)h / (double)w;
			int count = quality * quality + 1;
			double invCount = 1.0 / (double)count;
			double angleTheta = (angle * Math.PI * 2) / 360.0;

			for (int y = rect.Top; y <= rect.Bottom; y++) {
				ColorBgra* dstPtr = dst.GetPointAddress (rect.Left, y);

				for (int x = rect.Left; x <= rect.Right; x++) {
					int r = 0;
					int g = 0;
					int b = 0;
					int a = 0;

					for (double i = 0; i < count; i++) {
						double u = (2.0 * x - w + (i * invCount)) * invH;
						double v = (2.0 * y - h + ((i * invQuality) % 1)) * invH;

						double radius = Math.Sqrt ((u * u) + (v * v));
						double radiusP = radius;
						double theta = Math.Atan2 (v, u);
						double thetaP = theta + angleTheta;

						double uP = radiusP * Math.Cos (thetaP);
						double vP = radiusP * Math.Sin (thetaP);

						double jX = (uP - vP * aspect) * invZoom;
						double jY = (vP + uP * aspect) * invZoom;

						double j = Julia (jX, jY, jr, ji);

						double c = factor * j;

						b += Utility.ClampToByte (c - 768);
						g += Utility.ClampToByte (c - 512);
						r += Utility.ClampToByte (c - 256);
						a += Utility.ClampToByte (c - 0);
					}

					*dstPtr = ColorBgra.FromBgra (Utility.ClampToByte (b / count), Utility.ClampToByte (g / count), Utility.ClampToByte (r / count), Utility.ClampToByte (a / count));

					++dstPtr;
				}
			}
		}
 public override bool ExportCapture(ISurface surface, ICaptureDetails captureDetails)
 {
     using (Image image = surface.GetImageForExport()) {
         bool uploaded = plugin.Upload(captureDetails, image);
         if (uploaded) {
             surface.SendMessageEvent(this, SurfaceMessageTyp.Info, "Exported to Dropbox");
             surface.Modified = false;
         }
         return uploaded;
     }
 }
Ejemplo n.º 31
0
 public void WriteOn(string text, ISurface surface)
 {
     if (surface == null)
     {
         throw new NothingToWriteOnException();
     }
     if (text == null)
     {
         return;
     }
     foreach (var c in text)
     {
         surface.Write(Durability <= 0 ? ' ' : c);
         if (!char.IsWhiteSpace(c) && Durability > 0)
         {
             Durability -= (char.IsUpper(c) ? 2u : 1u);
         }
     }
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Create an image from a surface with the settings from the output settings applied
        /// </summary>
        /// <param name="surface"></param>
        /// <param name="outputSettings"></param>
        /// <param name="imageToSave"></param>
        /// <returns>true if the image must be disposed</returns>
        public static bool CreateImageFromSurface(ISurface surface, SurfaceOutputSettings outputSettings, out Image imageToSave)
        {
            bool disposeImage = false;

            if (outputSettings.Format == OutputFormat.greenshot || outputSettings.SaveBackgroundOnly)
            {
                // We save the image of the surface, this should not be disposed
                imageToSave = surface.Image;
            }
            else
            {
                // We create the export image of the surface to save
                imageToSave  = surface.GetImageForExport();
                disposeImage = true;
            }

            // The following block of modifications should be skipped when saving the greenshot format, no effects or otherwise!
            if (outputSettings.Format == OutputFormat.greenshot)
            {
                return(disposeImage);
            }
            Image tmpImage;

            if (outputSettings.Effects != null && outputSettings.Effects.Count > 0)
            {
                // apply effects, if there are any
                using (Matrix matrix = new Matrix())
                {
                    tmpImage = ImageHelper.ApplyEffects(imageToSave, outputSettings.Effects, matrix);
                }
                if (tmpImage != null)
                {
                    if (disposeImage)
                    {
                        imageToSave.Dispose();
                    }
                    imageToSave  = tmpImage;
                    disposeImage = true;
                }
            }

            return(disposeImage);
        }
Ejemplo n.º 33
0
 /// <summary>
 ///     Load a Greenshot surface
 /// </summary>
 /// <param name="fullPath"></param>
 /// <param name="returnSurface"></param>
 /// <returns></returns>
 public static ISurface LoadGreenshotSurface(string fullPath, ISurface returnSurface)
 {
     if (string.IsNullOrEmpty(fullPath))
     {
         return(null);
     }
     Log.Info().WriteLine("Loading image from file {0}", fullPath);
     // Fixed lock problem Bug #3431881
     using (Stream surfaceFileStream = File.OpenRead(fullPath))
     {
         returnSurface = LoadGreenshotSurface(surfaceFileStream, returnSurface);
     }
     if (returnSurface != null)
     {
         Log.Info().WriteLine("Information about file {0}: {1}x{2}-{3} Resolution {4}x{5}", fullPath, returnSurface.Screenshot.Width, returnSurface.Screenshot.Height,
                              returnSurface.Screenshot.PixelFormat, returnSurface.Screenshot.HorizontalResolution, returnSurface.Screenshot.VerticalResolution);
     }
     return(returnSurface);
 }
Ejemplo n.º 34
0
        private static ISurface <ColorAlpha8> UseTileOrToSurfaceWithEdgePadding(IRenderer <ColorAlpha8> source, RectInt32 bounds, ColorAlpha8 padding)
        {
            if (source.Bounds <ColorAlpha8>().Contains(bounds))
            {
                return(source.UseTileOrToSurface(bounds));
            }
            ISurface <ColorAlpha8> surface = SurfaceAllocator.Alpha8.Allocate <ColorAlpha8>(bounds.Size, AllocationOptions.ZeroFillNotRequired);

            surface.Clear(padding);
            RectInt32  num2     = RectInt32.Intersect(source.Bounds <ColorAlpha8>(), bounds);
            PointInt32 location = new PointInt32(num2.Location.X - bounds.Location.X, num2.Location.Y - bounds.Location.Y);
            RectInt32  num4     = new RectInt32(location, num2.Size);

            using (ISurfaceWindow <ColorAlpha8> window = surface.CreateWindow <ColorAlpha8>(num4))
            {
                source.Render(window, num2.Location);
            }
            return(surface);
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Makes a new instance of <see cref="VKRenderer"/> class,
        /// this class manage Vulkan assets rendering.
        /// </summary>
        public VKRenderer(ISurface videoSurface) : base(videoSurface)
        {
            // - Creates vulkan library instance
            base.Library = new VulkanLibrary();

            // - Creates the vulkan physical device
            base.PhysicalDevice = new VKPhysicalDevice(Library);

            // - Creates the vulkan graphical device
            base.GraphicDevice = new VKGraphicDevice(PhysicalDevice);

            // - Istantiate modules
            ShaderManager = new VKShaderManager(GraphicDevice);

            // - Initialize the vertex manager
            base.VertexManager = new VKVertexBuffer(GraphicDevice, 100, true, 0.2);

            // - Initialize the index manager
            base.IndexManager = new VKIndexBuffer(GraphicDevice, 100, true, 0.2);

            // - Initialize the geometry dispatcher
            base.GeometryDispatcher = new VKGeometryDispatcher(VertexManager, IndexManager);

            // - Create a new swapchain
            Swapchain = new VKSwapChain(PhysicalDevice, GraphicDevice);

            // - Create the default render pass
            DefaultRenderPass = new VKRenderPass(GraphicDevice);

            // - Create the default pipeline
            Pipeline = new VKPipeline(GraphicDevice, DefaultRenderPass, false);

            // - Number of frames processing at the same time allowed
            MaxFrameInFlight = 2;

            // - Rendering and syncronization
            Commands                 = new List <CommandPool>();
            CommandBuffers           = new List <CommandBuffer[]>();
            RenderFinishedSemaphores = new List <Semaphore>();
            ImageAvailableSemaphores = new List <Semaphore>();
            InFlightFences           = new List <Fence>();
            ImagesInFlight           = new List <Fence>();
        }
Ejemplo n.º 36
0
        public ITrueTypeText CreateTrueTypeText(IRenderer renderer, string fontPath, string text, int fontSize, Color color, int wrapLength)
        {
            Font          font         = null;
            ISurface      surface      = null;
            ITrueTypeText trueTypeText = null;

            if (renderer == null)
            {
                throw new ArgumentNullException(nameof(renderer));
            }

            if (String.IsNullOrWhiteSpace(fontPath))
            {
                throw new ArgumentNullException(nameof(fontPath));
            }

            if (fontSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(fontSize), "Font size must be greater than 0.");
            }

            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            try
            {
                font         = new Font(fontPath, fontSize);
                surface      = new Surface(font, text, color, wrapLength);
                trueTypeText = new TrueTypeText(renderer, surface, text, font, color, wrapLength);
                logger?.LogTrace($"TrueTypeText created. Width = {trueTypeText.Texture.Width}, Height = {trueTypeText.Texture.Height}, Font = {trueTypeText.Font.FilePath}, WrapLength = {trueTypeText.WrapLength}.");
                return(trueTypeText);
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Error occurred while creating a TrueTypeText objecte.");
                font.Dispose();
                surface.Dispose();
                trueTypeText.Dispose();
                throw;
            }
        }
Ejemplo n.º 37
0
        private ISurface method_1(IDataset idataset_0)
        {
            ISurface surface = null;

            if (idataset_0 is ITin)
            {
                return(idataset_0 as ISurface);
            }
            if (idataset_0 is IRasterBandCollection)
            {
                IRasterBand    band     = (idataset_0 as IRasterBandCollection).Item(0);
                IRasterSurface surface2 = new RasterSurfaceClass
                {
                    RasterBand = band
                };
                surface = surface2 as ISurface;
            }
            return(surface);
        }
Ejemplo n.º 38
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            frmOpenFile file = new frmOpenFile();

            file.AddFilter(new MyGxFilterSurfaceDatasets(), true);
            if (file.ShowDialog() == DialogResult.OK)
            {
                IDataset dataset = (file.Items.get_Element(0) as IGxDataset).Dataset;
                if (dataset != null)
                {
                    ISurface surface = this.method_1(dataset);
                    if (surface != null)
                    {
                        this.cboSufer.Items.Add(new SuferWrap(surface));
                        this.cboSufer.SelectedIndex = this.cboSufer.Items.Count - 1;
                    }
                }
            }
        }
Ejemplo n.º 39
0
        /// <summary>
        ///     Create a new page in the "unfiled notes section", with the title of the capture, and export the capture there.
        /// </summary>
        /// <param name="surfaceToUpload">ISurface</param>
        /// <returns>bool true if export worked</returns>
        public static bool ExportToNewPage(ISurface surfaceToUpload)
        {
            using (var oneNoteApplication = ComWrapper.GetOrCreateInstance <IOneNoteApplication>())
            {
                var newPage = new OneNotePage();
                var unfiledNotesSectionId = GetSectionId(oneNoteApplication, SpecialLocation.slUnfiledNotesSection);
                if (unfiledNotesSectionId == null)
                {
                    return(false);
                }

                // ReSharper disable once RedundantAssignment
                oneNoteApplication.CreateNewPage(unfiledNotesSectionId, out var pageId, NewPageStyle.npsDefault);
                newPage.ID = pageId;
                // Set the new name, this is automatically done in the export to page
                newPage.Name = surfaceToUpload.CaptureDetails.Title;
                return(ExportToPage(oneNoteApplication, surfaceToUpload, newPage));
            }
        }
        public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails)
        {
            LOG.DebugFormat("Changing surface to grayscale!");
            using (BitmapBuffer bbb = new BitmapBuffer(surface.Image as Bitmap, false)) {
                bbb.Lock();
                for (int y = 0; y < bbb.Height; y++)
                {
                    for (int x = 0; x < bbb.Width; x++)
                    {
                        Color color = bbb.GetColorAt(x, y);
                        int   luma  = (int)((0.3 * color.R) + (0.59 * color.G) + (0.11 * color.B));
                        color = Color.FromArgb(luma, luma, luma);
                        bbb.SetColorAt(x, y, color);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 41
0
        public TextLayout(string text, Vector2 bounds, Font font, float fontSize, TextFormat format)
        {
            surface = GameEngine.TryQueryComponent <ISurface>();
            if (surface == null)
            {
                throw new InvalidOperationException("A surface must be registered before a text layout can be created.");
            }
            surface.DpiChanged += OnSurfaceDpiChanged;

            this.text     = text;
            this.bounds   = bounds;
            this.font     = font;
            this.fontSize = fontSize;
            this.format   = format;

            dpiChanged = false;
            Glyphs     = new List <PositionedGlyph>();
            Layout();
        }
Ejemplo n.º 42
0
        private static void PrintSurface(ISurface surface)
        {
            for (var height = surface.GetHeight(); height >= 1; height--)
            {
                for (var width = 1; width <= surface.GetWidth(); width++)
                {
                    var quadrant = surface.GetQuadrant(width, height);

                    if (surface.GetRover().GetPosition().GetX() == width &&
                        surface.GetRover().GetPosition().GetY() == height)
                    {
                        switch (surface.GetRover().GetDirection())
                        {
                        case Direction.North:
                            PrintRover("N");
                            break;

                        case Direction.South:
                            PrintRover("S");
                            break;

                        case Direction.East:
                            PrintRover("E");
                            break;

                        case Direction.West:
                            PrintRover("W");
                            break;
                        }
                    }
                    else if (quadrant.GetObject() is Sand)
                    {
                        PrintSand();
                    }
                    else if (quadrant.GetObject() is Rock)
                    {
                        PrintRock();
                    }
                }

                Jump();
            }
        }
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
            CoreConfiguration config            = IniConfig.GetIniSection <CoreConfiguration>();
            OutputSettings    outputSettings    = new OutputSettings();

            string file     = FilenameHelper.GetFilename(OutputFormat.png, null);
            string filePath = Path.Combine(config.OutputFilePath, file);

            using (FileStream stream = new FileStream(filePath, FileMode.Create)) {
                using (Image image = surface.GetImageForExport()) {
                    ImageOutput.SaveToStream(image, stream, outputSettings);
                }
            }
            exportInformation.Filepath   = filePath;
            exportInformation.ExportMade = true;
            ProcessExport(exportInformation, surface);
            return(exportInformation);
        }
Ejemplo n.º 44
0
        public override void Render(ISurface surface)
        {
            Shape.Size         = new Size(GripSize, GripSize);
            InnerPainter.Style = this.Style;
            int halfWidth  = GripSize / 2;
            int halfHeight = GripSize / 2;

            var camera  = new Camera(Camera.Matrix);
            var destCam = new Camera(surface.Matrix);

            foreach (var anchor in Grips)
            {
                var anchorPoint = TargetShape[anchor];
                anchorPoint = camera.FromSource(anchorPoint);
                //anchorPoint = destCam.ToSource (anchorPoint);
                Shape.Location = new Point(anchorPoint.X - halfWidth, anchorPoint.Y - halfHeight);
                InnerPainter.Render(surface);
            }
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Method to get a ISurface from a map with layer name
        /// </summary>
        /// <param name="map">IMap that contains surface layer</param>
        /// <param name="name">Name of the layer that you are looking for</param>
        /// <returns>ISurface</returns>
        public ISurface GetSurfaceFromMapByName(IMap map, string name)
        {
            for (int x = 0; x < map.LayerCount; x++)
            {
                var layer = map.get_Layer(x);

                if (layer == null || layer.Name != name)
                {
                    continue;
                }

                var tin = layer as ITinLayer;
                if (tin != null)
                {
                    return(tin.Dataset as ISurface);
                }

                var      rasterSurface = new RasterSurfaceClass() as IRasterSurface;
                ISurface surface       = null;

                var mosaicLayer = layer as IMosaicLayer;
                var rasterLayer = layer as IRasterLayer;

                if (mosaicLayer != null && mosaicLayer.PreviewLayer != null && mosaicLayer.PreviewLayer.Raster != null)
                {
                    rasterSurface.PutRaster(mosaicLayer.PreviewLayer.Raster, 0);
                }
                else if (rasterLayer != null && rasterLayer.Raster != null)
                {
                    rasterSurface.PutRaster(rasterLayer.Raster, 0);
                }

                surface = rasterSurface as ISurface;

                if (surface != null)
                {
                    return(surface);
                }
            }

            return(null);
        }
Ejemplo n.º 46
0
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            base.SetDefaults(surface);
            ExportInformation exportInformation = new ExportInformation(Designation, Description);
            string            tmpFile           = captureDetails.Filename;
            Size imageSize = Size.Empty;

            if (tmpFile == null || surface.Modified || !Regex.IsMatch(tmpFile, @".*(\.png|\.gif|\.jpg|\.jpeg|\.tiff|\.bmp)$"))
            {
                tmpFile   = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings().PreventGreenshotFormat());
                imageSize = surface.Image.Size;
            }
            if (_presentationName != null)
            {
                exportInformation.ExportMade = PowerpointExporter.ExportToPresentation(_presentationName, tmpFile, imageSize, captureDetails.Title);
            }
            else
            {
                if (!manuallyInitiated)
                {
                    var presentations = PowerpointExporter.GetPowerpointPresentations();
                    if (presentations != null && presentations.Count > 0)
                    {
                        var destinations = new List <IDestination> {
                            new PowerpointDestination()
                        };
                        foreach (string presentation in presentations)
                        {
                            destinations.Add(new PowerpointDestination(presentation));
                        }
                        // Return the ExportInformation from the picker without processing, as this indirectly comes from us self
                        return(ShowPickerMenu(false, surface, captureDetails, destinations));
                    }
                }
                else if (!exportInformation.ExportMade)
                {
                    exportInformation.ExportMade = PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
                }
            }
            ProcessExport(exportInformation, surface);
            return(exportInformation);
        }
Ejemplo n.º 47
0
        public unsafe void Render(ISurface <ColorAlpha8> dst, PointInt32 renderOffset)
        {
            int       width  = dst.Width;
            int       height = dst.Height;
            RectInt32 bounds = new RectInt32(renderOffset, new SizeInt32(width, height));

            if (!this.isCancellationRequestedFn())
            {
                using (ISurface <ColorBgra> surface = this.sampleSource.UseTileOrToSurface(bounds))
                {
                    for (int i = 0; i < height; i++)
                    {
                        if (this.isCancellationRequestedFn())
                        {
                            return;
                        }
                        ColorBgra *rowPointer = (ColorBgra *)surface.GetRowPointer <ColorBgra>(i);
                        byte *     numPtr     = (byte *)dst.GetPointPointer <ColorAlpha8>(0, i);
                        for (int j = 0; j < width; j++)
                        {
                            byte      num6;
                            ColorBgra b = rowPointer[0];
                            if (b == this.basis)
                            {
                                num6 = 0xff;
                            }
                            else if (FloodFillAlgorithm.GetDistance(this.basis, b) <= this.tolerance)
                            {
                                num6 = 0xff;
                            }
                            else
                            {
                                num6 = 0;
                            }
                            numPtr[0] = num6;
                            numPtr++;
                            rowPointer++;
                        }
                    }
                }
            }
        }
Ejemplo n.º 48
0
        public virtual void ShowContextMenu(MouseEventArgs e, ISurface surface)
        {
            if (!(surface is Surface))
            {
                return;
            }
            bool hasMenu = false;

            foreach (var drawableContainer in this)
            {
                var container = (DrawableContainer)drawableContainer;
                if (!container.HasContextMenu)
                {
                    continue;
                }
                hasMenu = true;
                break;
            }
            if (hasMenu)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                AddContextMenuItems(menu, surface);
                if (menu.Items.Count > 0)
                {
                    // TODO: cast should be somehow avoided
                    menu.Show((Surface)surface, e.Location);
                    while (true)
                    {
                        if (menu.Visible)
                        {
                            Application.DoEvents();
                            Thread.Sleep(100);
                        }
                        else
                        {
                            menu.Dispose();
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 49
0
        /// <summary>
        /// Export the capture with the destination picker
        /// </summary>
        /// <param name="manuallyInitiated">Did the user select this destination?</param>
        /// <param name="surface">Surface to export</param>
        /// <param name="captureDetails">Details of the capture</param>
        /// <returns>true if export was made</returns>
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            List <IDestination> destinations = new List <IDestination>();

            if (conf.PickerDestinations != null && conf.PickerDestinations.Count > 0)
            {
                // Show selected (and active) destinations
                foreach (string designation in conf.PickerDestinations)
                {
                    IDestination destination = DestinationHelper.GetDestination(designation);
                    if (DESIGNATION.Equals(destination.Designation))
                    {
                        continue;
                    }
                    if (!destination.IsActive)
                    {
                        continue;
                    }
                    destinations.Add(destination);
                }
            }
            else
            {
                // Show active destinations
                foreach (IDestination destination in DestinationHelper.GetAllDestinations())
                {
                    if ("Picker".Equals(destination.Designation))
                    {
                        continue;
                    }
                    if (!destination.IsActive)
                    {
                        continue;
                    }
                    destinations.Add(destination);
                }
            }


            // No Processing, this is done in the selected destination (if anything was selected)
            return(ShowPickerMenu(true, surface, captureDetails, destinations));
        }
Ejemplo n.º 50
0
        protected unsafe override void RenderLine(ISurface src, ISurface dst, Rectangle rect)
        {
            var pointOffsets = RecalcPointOffsets(fragments, rotation, distance);

            int    poLength        = pointOffsets.Length;
            Point *pointOffsetsPtr = stackalloc Point[poLength];

            for (int i = 0; i < poLength; ++i)
            {
                pointOffsetsPtr[i] = pointOffsets[i];
            }

            ColorBgra *samples = stackalloc ColorBgra[poLength];

            int src_width  = src.Width;
            int src_height = src.Height;

            for (int y = rect.Top; y <= rect.Bottom; y++)
            {
                ColorBgra *dstPtr = dst.GetPointAddress(rect.Left, y);

                for (int x = rect.Left; x <= rect.Right; x++)
                {
                    int sampleCount = 0;

                    for (int i = 0; i < poLength; ++i)
                    {
                        int u = x - pointOffsetsPtr[i].X;
                        int v = y - pointOffsetsPtr[i].Y;

                        if (u >= 0 && u < src_width && v >= 0 && v < src_height)
                        {
                            samples[sampleCount] = src.GetPoint(u, v);
                            ++sampleCount;
                        }
                    }

                    *dstPtr = ColorBgra.Blend(samples, sampleCount);
                    ++dstPtr;
                }
            }
        }
        private unsafe void ApplyAndSwap(ISurface dst, bool swap)
        {
            dst.BeginUpdate();

            var       dest_width = dst.Width;
            var       dst_ptr    = (ColorBgra *)dst.GetRowAddress(0);
            var       mask_index = 0;
            ColorBgra swap_pixel;

            fixed(ColorBgra *fixed_ptr = pixels)
            {
                var pixel_ptr = fixed_ptr;

                dst_ptr += bounds.X + bounds.Y * dest_width;

                for (int y = bounds.Y; y <= bounds.Bottom; y++)
                {
                    for (int x = bounds.X; x <= bounds.Right; x++)
                    {
                        if (bitmask[mask_index++])
                        {
                            if (swap)
                            {
                                swap_pixel = *dst_ptr;
                                *dst_ptr     = *pixel_ptr;
                                *pixel_ptr++ = swap_pixel;
                            }
                            else
                            {
                                *dst_ptr = *pixel_ptr++;
                            }
                        }

                        dst_ptr++;
                    }

                    dst_ptr += dest_width - bounds.Width;
                }
            }

            dst.EndUpdate();
        }
Ejemplo n.º 52
0
        public async Task <string> Upload(ICaptureDetails captureDetails, ISurface surface)
        {
            string uploadUrl = null;

            try
            {
                var cancellationTokenSource = new CancellationTokenSource();
                using (var ownedPleaseWaitForm = _pleaseWaitFormFactory(cancellationTokenSource))
                {
                    ownedPleaseWaitForm.Value.SetDetails("Flickr", _flickrLanguage.CommunicationWait);
                    ownedPleaseWaitForm.Value.Show();
                    try
                    {
                        uploadUrl = await UploadToFlickrAsync(surface, captureDetails.Title, cancellationTokenSource.Token);
                    }
                    finally
                    {
                        ownedPleaseWaitForm.Value.Close();
                    }
                }


                if (uploadUrl == null)
                {
                    return(null);
                }
                if (_flickrConfiguration.AfterUploadLinkToClipBoard)
                {
                    using (var clipboardAccessToken = ClipboardNative.Access())
                    {
                        clipboardAccessToken.ClearContents();
                        clipboardAccessToken.SetAsUrl(uploadUrl);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error().WriteLine(e, "Error uploading.");
                MessageBox.Show(_flickrLanguage.UploadFailure + @" " + e.Message);
            }
            return(uploadUrl);
        }
Ejemplo n.º 53
0
        public void Render(ISurface surface)
        {
            var viewport = surface.Viewport;

            var fromX = viewport.ToWorldX(0);
            var width = viewport.ToWorldX(viewport.Width);

            var y      = viewport.ToWorldY(0);
            var height = viewport.ToWorldY(viewport.Height);

            for (; y < height; ++y)
            {
                for (var x = fromX; x < width; ++x)
                {
                    var tile = this.world[x, y];
                    var c    = TileToChar(tile);
                    surface.Render(x, y, c);
                }
            }
        }
        /// <summary>
        /// Creates a PCurve, a 2D curve parameterized in UV over
        /// the surface.
        /// </summary>
        /// <param name="surface"></param>
        /// <returns></returns>
        public ICurve ToPCurve(ISurface surface)
        {
            var propsDouble  = PropsDouble;
            var knots        = KnotVectorU;
            var ctrlPtCoords = ControlPoints.SelectMany(p => p.ToDoubles().Take(Dimension)).ToArray();

            #region debug
            var param = surface.Parameterization2();
            Debug.Assert(ControlPoints.All(c =>
                                           c.X <= param.UMax && c.X >= param.UMin &&
                                           c.Y <= param.VMax && c.Y >= param.VMin
                                           ));
            #endregion

            Debug.Assert(knots.Length == ControlPoints.Length + Order);

            var pCurve = (ICurve)SwAddinBase.Active.Modeler.CreatePCurve(surface, propsDouble, knots, ctrlPtCoords);
            Debug.Assert(pCurve != null);
            return(pCurve);
        }
Ejemplo n.º 55
0
        private static void InterfaceDefaultImplUsage()
        {
            // First Approach
            var sample  = new InterfaceClass();
            var control = sample as IControl;

            control.Paint();
            var surface = sample as IControl;

            surface.Paint();

            // Second Approach
            InterfaceClass sample1  = new InterfaceClass();
            IControl       control1 = sample1;

            control1.Paint();
            ISurface surface2 = sample1;

            surface2.Paint();
        }
Ejemplo n.º 56
0
 public void RenderSurface(ISurface surface)
 {
     if (surface.Surface.committed)
     {
         //Console.WriteLine("Surface offset: " + surface.X + " " + surface.Y);
         int     translateLocation = desktopPipeline.GetUniformLocation("translate");
         Matrix4 translate         = Matrix4.CreateTranslation(surface.X, surface.Y, 0.0f);
         GL.UniformMatrix4(translateLocation, false, ref translate);
         this.RenderSurface(surface.Surface);
         foreach (ISurface subsurface in surface.Surface.Subsurfaces)
         {
             if (subsurface.Surface.committed)
             {
                 translate = Matrix4.CreateTranslation(surface.X + subsurface.X, surface.Y + subsurface.Y, 0.0f);
                 GL.UniformMatrix4(translateLocation, false, ref translate);
                 this.RenderSurface(subsurface.Surface);
             }
         }
     }
 }
Ejemplo n.º 57
0
        protected override unsafe void OnRenderContent(ISurface <ColorBgra> dstContent, PointInt32 renderOffset)
        {
            SizeInt32 num       = dstContent.Size <ColorBgra>();
            ColorBgra fillColor = base.Changes.FillColor;

            this.sampleSource.Render(dstContent, renderOffset);
            for (int i = 0; i < num.Height; i++)
            {
                ColorBgra *rowPointer = (ColorBgra *)dstContent.GetRowPointer <ColorBgra>(i);
                for (int j = 0; j < num.Width; j++)
                {
                    ColorBgra bgra2 = rowPointer[j];
                    byte      b     = Int32Util.ClampToByte(bgra2.B + (fillColor.B - this.basisColor.B));
                    byte      g     = Int32Util.ClampToByte(bgra2.G + (fillColor.G - this.basisColor.G));
                    byte      r     = Int32Util.ClampToByte(bgra2.R + (fillColor.R - this.basisColor.R));
                    byte      a     = Int32Util.ClampToByte(bgra2.A + (fillColor.A - this.basisColor.A));
                    rowPointer[j] = ColorBgra.FromBgra(b, g, r, a);
                }
            }
        }
Ejemplo n.º 58
0
        static void Main()
        {
            Shape recti = new Rectangle(2, 5);

            Console.WriteLine(recti.Surface());

            ISurface[] surfaces = new ISurface[]
            {
                new Rectangle(5, 8.9),
                new RightAngleTriangle(3.6, 2.3),
                new Square(7),
                new RightAngleTriangle(78, 90.6),
                new Rectangle(56, 89.2)
            };

            foreach (ISurface item in surfaces)
            {
                Console.WriteLine(item.Surface());
            }
        }
Ejemplo n.º 59
0
        public static ModelInstance ModelInstance(string categoryName, ISurface location)
        {
            if (string.IsNullOrWhiteSpace(categoryName) || location == null)
            {
                return(null);
            }

            InstanceProperties instanceProperties = new InstanceProperties();

            instanceProperties.CategoryName = categoryName;

            ModelInstance modelInstance = new ModelInstance()
            {
                Properties = instanceProperties,
                Name       = "Surface",
                Location   = location
            };

            return(modelInstance);
        }
Ejemplo n.º 60
0
        /// <summary>
        /// Export the capture with the destination picker
        /// </summary>
        /// <param name="manuallyInitiated">Did the user select this destination?</param>
        /// <param name="surface">Surface to export</param>
        /// <param name="captureDetails">Details of the capture</param>
        /// <returns>true if export was made</returns>
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            List <IDestination> destinations = new List <IDestination>();

            foreach (IDestination destination in DestinationHelper.GetAllDestinations())
            {
                if ("Picker".Equals(destination.Designation))
                {
                    continue;
                }
                if (!destination.isActive)
                {
                    continue;
                }
                destinations.Add(destination);
            }

            // No Processing, this is done in the selected destination (if anything was selected)
            return(ShowPickerMenu(true, surface, captureDetails, destinations));
        }