当前位置: 首页>>代码示例>>C#>>正文


C# ISurface类代码示例

本文整理汇总了C#中ISurface的典型用法代码示例。如果您正苦于以下问题:C# ISurface类的具体用法?C# ISurface怎么用?C# ISurface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISurface类属于命名空间,在下文中一共展示了ISurface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImageEditorForm

        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();
        }
开发者ID:oneminot,项目名称:greenshot,代码行数:30,代码来源:ImageEditorForm.cs

示例2: UploadToPicasa

		/// <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();
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:43,代码来源:PicasaUtils.cs

示例3: Render

		/// <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);
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:12,代码来源:BaseEffect.cs

示例4: RenderLine

		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;
			}
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:28,代码来源:PixelateEffect.cs

示例5: ApplyAsync

		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);
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:7,代码来源:BinaryPixelOp.cs

示例6: Apply

		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);
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:7,代码来源:BinaryPixelOp.cs

示例7: Initialize

 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);
 }
开发者ID:mrange,项目名称:funbasic,代码行数:30,代码来源:_Library.cs

示例8: ExportCapture

		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;
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:34,代码来源:ExternalCommandDestination.cs

示例9: RenderLine

		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;
				}
			}
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:26,代码来源:SoftenPortraitEffect.cs

示例10: OnBeginRender

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

			op = histogram.MakeLevelsAuto ();
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:7,代码来源:AutoLevelEffect.cs

示例11: SurfacePlot

 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);
 }
开发者ID:mortenbakkedal,项目名称:SharpMath,代码行数:7,代码来源:SurfacePlot.cs

示例12: ApplyAsync

		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);
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:7,代码来源:UnaryPixelOp.cs

示例13: Apply

		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);
		}
开发者ID:PintaProject,项目名称:Pinta.ImageManipulation,代码行数:7,代码来源:UnaryPixelOp.cs

示例14: ExportCapture

        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");
            }
        }
开发者ID:AlexMedia,项目名称:oovg-greenshot,代码行数:28,代码来源:OovgDestination.cs

示例15: ImageEditorForm

        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();
        }
开发者ID:Xanaxiel,项目名称:ShareX,代码行数:34,代码来源:ImageEditorForm.cs


注:本文中的ISurface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。