• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ISurface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ExportCapture

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


示例17: CommandCenter

 public CommandCenter(ICommandParser commandParser, IRobot robot, ISurface surface, CommandFactory commandFactory)
 {
     _robot = robot;
     _commandParser = commandParser;
     Surface = surface;
     _commandFactory = commandFactory;
     _executedCommands = new List<ICommand>();
 }
开发者ID:sajoans,项目名称:BauerRobotTest,代码行数:8,代码来源:CommandCenter.cs


示例18: PrintHelper

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


示例19: Order

        public Order(ISurface facet, bool ascending)
        {
            if ((object)facet == null)
                throw new ArgumentNullException("facet");

            this.facet = facet;
            this.ascending = ascending;
        }
开发者ID:sami1971,项目名称:textmetal,代码行数:8,代码来源:Order.cs


示例20: RenderLine

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISurfaceHolder类代码示例发布时间:2022-05-24
下一篇:
C# ISupportsInterning类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap