本文整理汇总了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();
}
示例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();
}
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
}
示例10: OnBeginRender
protected override void OnBeginRender (ISurface src, ISurface dst, Rectangle roi)
{
var histogram = new HistogramRgb ();
histogram.UpdateHistogram (src, src.Bounds);
op = histogram.MakeLevelsAuto ();
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
}
示例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();
}