本文整理汇总了C#中RenderArgs类的典型用法代码示例。如果您正苦于以下问题:C# RenderArgs类的具体用法?C# RenderArgs怎么用?C# RenderArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderArgs类属于命名空间,在下文中一共展示了RenderArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnActivate
protected override void OnActivate()
{
base.OnActivate();
this.pencilToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.PencilToolCursor.cur"));
this.Cursor = this.pencilToolCursor;
this.savedRects = new List<Rectangle>();
if (ActiveLayer != null)
{
bitmapLayer = (BitmapLayer)ActiveLayer;
renderArgs = new RenderArgs(bitmapLayer.Surface);
tracePoints = new List<Point>();
}
else
{
bitmapLayer = null;
if (renderArgs != null)
{
renderArgs.Dispose();
renderArgs = null;
}
}
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:26,代码来源:PencilTool.cs
示例2: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, System.Drawing.Rectangle[] rois, int startIndex, int length)
{
TwoAmountsConfigToken tact = (TwoAmountsConfigToken)parameters;
PixelOp redEyeRemove = new UnaryPixelOps.RedEyeRemove(tact.Amount1, tact.Amount2);
redEyeRemove.Apply(dstArgs.Surface, srcArgs.Surface, rois, startIndex, length);
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:7,代码来源:RedEyeRemoveEffect.cs
示例3: Render
public unsafe override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
Point[] points = ((MotionBlurEffectConfigToken)parameters).LinePoints;
Surface dst = dstArgs.Surface;
Surface src = srcArgs.Surface;
for (int i = startIndex; i < startIndex + length; ++i)
{
Rectangle rect = rois[i];
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)
{
Point a = new Point(x + points[0].X, y + points[0].Y);
Point b = new Point(x + points[points.Length - 1].X, y + points[points.Length - 1].Y);
// If both ends of this line are in bounds, we don't need to do silly clipping
if (src.Bounds.Contains(a) && src.Bounds.Contains(b))
{
*dstPtr = DoLineAverageUnclipped(points, x, y, dst, src);
}
else
{
*dstPtr = DoLineAverage(points, x, y, dst, src);
}
++dstPtr;
}
}
}
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:34,代码来源:MotionBlurEffect.cs
示例4: OnFillRegionComputed
protected override void OnFillRegionComputed(Point[][] polygonSet)
{
using (PdnGraphicsPath path = new PdnGraphicsPath())
{
path.AddPolygons(polygonSet);
using (PdnRegion fillRegion = new PdnRegion(path))
{
Rectangle boundingBox = fillRegion.GetBoundsInt();
Surface surface = ((BitmapLayer)ActiveLayer).Surface;
RenderArgs ra = new RenderArgs(surface);
HistoryMemento ha;
using (PdnRegion affected = Utility.SimplifyAndInflateRegion(fillRegion))
{
ha = new BitmapHistoryMemento(Name, Image, DocumentWorkspace, DocumentWorkspace.ActiveLayerIndex, affected);
}
ra.Graphics.CompositingMode = AppEnvironment.GetCompositingMode();
ra.Graphics.FillRegion(brush, fillRegion.GetRegionReadOnly());
HistoryStack.PushNewMemento(ha);
ActiveLayer.Invalidate(boundingBox);
Update();
}
}
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:28,代码来源:PaintBucketTool.cs
示例5: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.thickness = newToken.GetProperty<Int32Property>(PropertyNames.Thickness).Value;
this.intensity = newToken.GetProperty<Int32Property>(PropertyNames.Intensity).Value;
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:7,代码来源:OutlineEffect.cs
示例6: BackgroundEffectRenderer
public BackgroundEffectRenderer(Effect effect,
EffectConfigToken effectToken,
RenderArgs dstArgs,
RenderArgs srcArgs,
PdnRegion renderRegion,
int tileCount,
int workerThreads)
{
this.effect = effect;
this.effectToken = effectToken;
this.dstArgs = dstArgs;
this.srcArgs = srcArgs;
this.renderRegion = renderRegion;
this.renderRegion.Intersect(dstArgs.Bounds);
this.tileRegions = SliceUpRegion(renderRegion, tileCount, dstArgs.Bounds);
this.tilePdnRegions = new PdnRegion[this.tileRegions.Length];
for (int i = 0; i < this.tileRegions.Length; ++i)
{
PdnRegion pdnRegion = Utility.RectanglesToRegion(this.tileRegions[i]);
this.tilePdnRegions[i] = pdnRegion;
}
this.tileCount = tileCount;
this.workerThreads = workerThreads;
if ((effect.EffectDirectives & EffectDirectives.SingleThreaded) != 0)
{
this.workerThreads = 1;
}
this.threadPool = new Threading.ThreadPool(this.workerThreads, false);
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:33,代码来源:BackgroundEffectRenderer.cs
示例7: OnActivate
protected override void OnActivate()
{
base.OnActivate();
// cursor-transitions
this.cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursor.cur"));
this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursorMouseDown.cur"));
this.Cursor = cursorMouseUp;
this.savedRects = new List<Rectangle>();
if (ActiveLayer != null)
{
bitmapLayer = (BitmapLayer)ActiveLayer;
renderArgs = new RenderArgs(bitmapLayer.Surface);
}
else
{
bitmapLayer = null;
renderArgs = null;
}
this.previewRenderer = new BrushPreviewRenderer(this.RendererList);
this.RendererList.Add(this.previewRenderer, false);
}
开发者ID:herbqiao,项目名称:paint.net,代码行数:25,代码来源:EraserTool.cs
示例8: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
lock (this)
{
SetRenderInfo(parameters, dstArgs, srcArgs);
}
this.gbEffect.Render(this.gbToken, dstArgs, srcArgs, rois, startIndex, length);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:9,代码来源:BlurEffect.cs
示例9: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.zoom = newToken.GetProperty<DoubleProperty>(PropertyNames.Zoom).Value;
this.quality = newToken.GetProperty<Int32Property>(PropertyNames.Quality).Value;
this.angle = newToken.GetProperty<DoubleProperty>(PropertyNames.Angle).Value;
this.angleTheta = (this.angle * Math.PI * 2) / 360.0;
this.factor = newToken.GetProperty<DoubleProperty>(PropertyNames.Factor).Value;
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:10,代码来源:JuliaFractalEffect.cs
示例10: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
int fragments = newToken.GetProperty<Int32Property>(PropertyNames.Fragments).Value;
double rotation = newToken.GetProperty<DoubleProperty>(PropertyNames.Rotation).Value;
int distance = newToken.GetProperty<Int32Property>(PropertyNames.Distance).Value;
RecalcPointOffsets(fragments, rotation, distance);
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:10,代码来源:FragmentEffect.cs
示例11: Render
// public new OpenTK.Vector3d Position { get { return -base.Position; } set { base.Position = value; } }
//
// public new OpenTK.Vector3d Rotation { get { return - base.Rotation; } set { base.Rotation = value; } }
// public static AutoTraceSource Trace = AutoTraceSource.GetOrCreate(AsyncXmlFileTraceListener.GetOrCreate("JGL"));
/// <summary>
/// Initializes a new instance of the <see cref="JGL.Heirarchy.Camera"/> class.
/// </summary>
/// <param name='name'>Camera's entity name</param>
// public Camera(string name)
// : base(name)
// {
// }
/// <summary>
/// Render owner <see cref="JGL.Heirarchy.Scene"/> using the perspective of this <see cref="JGL.Heirarchy.Camera"/>,
/// </summary>
/// <param name='renderArgs'>Render arguments.</param>
/// <remarks>IRenderable implementation</remarks>
public void Render(RenderArgs renderArgs)
{
Stack<Entity> entityStack = renderArgs.Entities;
if (entityStack.Count > 0)
throw new InvalidOperationException("RenderArgs.Entities stack should be empty when calling Camera.Render");
entityStack.Push(renderArgs.Scene);
GL.Rotate(-Rotation.X, 1, 0, 0);
GL.Rotate(-Rotation.Y, 0, 1, 0);
GL.Rotate(-Rotation.Z, 0, 0, 1);
GL.Translate(-Position);
bool[] eFlags = new bool[4];
while (entityStack.Count > 0)
{
Entity entity = entityStack.Pop();
if (entity == null) // check for null values in the stack; they are markers that indicate that an EntityContext's
GL.PopMatrix(); // child Entities have just finished rendering, so the context's position/rotation changes can be reversed
else
{
eFlags[0] = entity is IRenderable && entity != this && entity.GetType() != typeof(Camera) && entity.GetType() != typeof(Scene) && !entity.GetType().IsSubclassOf(typeof(Scene)); //!entity.GetType().IsSubclassOf(typeof(Camera)); // if e == this, this is the current execution of e as Irenderable.Render so don't want to call itself again
eFlags[1] = entity is EntityContext;
// if (eFlags[0] || eFlags[1]) // if entity is not renderable and does not contains child entities, no point translating right?
// {
eFlags[2] = entity is IPositionable && entity.GetType() != typeof(Camera); //!entity.GetType().IsSubclassOf(typeof(Camera));
eFlags[3] = entity is IRotatable && entity.GetType() != typeof(Camera); //!entity.GetType().IsSubclassOf(typeof(Camera));
if (eFlags[2] || eFlags[3])
{
GL.PushMatrix();
if (eFlags[2]) // (e is IPositionable)
GL.Translate((entity as IPositionable).Position);
if (eFlags[3]) // (e is IRotatable)
{
IRotatable ir = entity as IRotatable;
GL.Rotate(ir.Rotation.X, 1, 0, 0);
GL.Rotate(ir.Rotation.Y, 0, 1, 0);
GL.Rotate(ir.Rotation.Z, 0, 0, 1);
}
}
if (eFlags[0]) // (e is IRenderable)
(entity as IRenderable).Render(renderArgs);
if (eFlags[1]) // (e is EntityContext)
{
if (eFlags[2] || eFlags[3]) // only need to worry about popping the GL matrix stack if something has been pushed on it (ie this EntityContext must be IPositionable or IRotatable)
entityStack.Push(null); // marks location in the stack where the GL modelview matrix should be popped (after rendering a EntityContext's child Entities which were pushed immediately before this marker)
foreach (Entity _e in (entity as EntityContext))
entityStack.Push(_e); // Push this EntityContext's child Entities (if any) onto the stack, so they will be next to be rendered (while the modelview matrix has been set by the containg EntityContext)
}
else if (eFlags[2] || eFlags[3]) // Entity is not an EntityContext (so can't have child Entities), but it is IPositionable and/or IRotatable so the modelview matrix has been pushed. Because no children, can pop it immediately
GL.PopMatrix();
// }
}
}
}
开发者ID:jbowwww,项目名称:JGL,代码行数:72,代码来源:Camera.cs
示例12: OnSetRenderInfo
protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
{
lock (this)
{
this.gbToken = new PropertyBasedEffectConfigToken(this.gbProps);
this.gbToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, ((AmountEffectConfigToken)parameters).Amount);
this.gbEffect.SetRenderInfo(this.gbToken, dstArgs, srcArgs);
}
base.OnSetRenderInfo(parameters, dstArgs, srcArgs);
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:11,代码来源:BlurEffect.cs
示例13: Render
public unsafe override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
BrightnessAndContrastAdjustmentConfigToken token = (BrightnessAndContrastAdjustmentConfigToken)parameters;
int contrast = token.Contrast;
int brightness = token.Brightness;
int multiply = token.Multiply;
int divide = token.Divide;
byte[] rgbTable = token.RgbTable;
for (int r = startIndex; r < startIndex + length; ++r)
{
Rectangle rect = rois[r];
for (int y = rect.Top; y < rect.Bottom; ++y)
{
ColorBgra *srcRowPtr = srcArgs.Surface.GetPointAddress(rect.Left, y);
ColorBgra *dstRowPtr = dstArgs.Surface.GetPointAddress(rect.Left, y);
ColorBgra *dstRowEndPtr = dstRowPtr + rect.Width;
if (divide == 0)
{
while (dstRowPtr < dstRowEndPtr)
{
ColorBgra col = *srcRowPtr;
int i = col.GetIntensityByte();
uint c = rgbTable[i];
dstRowPtr->Bgra = (col.Bgra & 0xff000000) | c | (c << 8) | (c << 16);
++dstRowPtr;
++srcRowPtr;
}
}
else
{
while (dstRowPtr < dstRowEndPtr)
{
ColorBgra col = *srcRowPtr;
int i = col.GetIntensityByte();
int shiftIndex = i * 256;
col.R = rgbTable[shiftIndex + col.R];
col.G = rgbTable[shiftIndex + col.G];
col.B = rgbTable[shiftIndex + col.B];
*dstRowPtr = col;
++dstRowPtr;
++srcRowPtr;
}
}
}
}
return;
}
开发者ID:nkaligin,项目名称:paint-mono,代码行数:54,代码来源:BrightnessAndContrastAdjustment.cs
示例14: PerformAction
public override HistoryMemento PerformAction(DocumentWorkspace documentWorkspace)
{
if (!ScanningAndPrinting.CanPrint)
{
Utility.ShowWiaError(documentWorkspace);
return null;
}
using (new PushNullToolMode(documentWorkspace))
{
// render image to a bitmap, save it to disk
Surface scratch = documentWorkspace.BorrowScratchSurface(this.GetType().Name + ".PerformAction()");
try
{
scratch.Clear();
RenderArgs ra = new RenderArgs(scratch);
documentWorkspace.Update();
using (new WaitCursorChanger(documentWorkspace))
{
ra.Surface.Clear(ColorBgra.White);
documentWorkspace.Document.Render(ra, false);
}
string tempName = Path.GetTempFileName() + ".bmp";
ra.Bitmap.Save(tempName, ImageFormat.Bmp);
try
{
ScanningAndPrinting.Print(documentWorkspace, tempName);
}
catch (Exception ex)
{
Utility.ShowWiaError(documentWorkspace);
Tracing.Ping(ex.ToString());
// TODO: do a "better" error dialog here
}
// Try to delete the temp file but don't worry if we can't
bool result = FileSystem.TryDeleteFile(tempName);
}
finally
{
documentWorkspace.ReturnScratchSurface(scratch);
}
}
return null;
}
开发者ID:herbqiao,项目名称:paint.net,代码行数:53,代码来源:PrintAction.cs
示例15: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
CurvesEffectConfigToken token = parameters as CurvesEffectConfigToken;
if (token != null)
{
UnaryPixelOp uop = token.Uop;
for (int i = startIndex; i < startIndex + length; ++i)
{
uop.Apply(dstArgs.Surface, srcArgs.Surface, rois[i]);
}
}
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:14,代码来源:CurvesEffect.cs
示例16: Render
public unsafe override void Render(
EffectConfigToken parameters,
RenderArgs dstArgs,
RenderArgs srcArgs,
Rectangle[] rois,
int startIndex,
int length)
{
AmountEffectConfigToken token = (AmountEffectConfigToken)parameters;
foreach (Rectangle rect in rois)
{
RenderRect(token.Amount, srcArgs.Surface, dstArgs.Surface, rect);
}
}
开发者ID:leejungho2,项目名称:xynotecgui,代码行数:15,代码来源:SharpenEffect.cs
示例17: Render
public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
{
CloudEffectConfigToken token = (CloudEffectConfigToken)parameters;
PdnRegion selectionRegion = EnvironmentParameters.GetSelection(srcArgs.Bounds);
this.r1 = token.R1;
this.r2 = token.R2;
this.r3 = token.R3;
for (int i = startIndex; i < startIndex + length; ++i)
{
Rectangle rect = rois[i];
for (int y = rect.Top; y < rect.Bottom; ++y)
{
for (int x = rect.Left; x < rect.Right; ++x)
{
if (selectionRegion.IsVisible(x, y))
{
ColorBgra srcBgra = srcArgs.Surface[x, y];
byte c = (byte)(PerlinNoise2d(x, y, token) * 255);
switch (token.DisplayOption)
{
case CloudEffect.REPLACE_SOURCE:
dstArgs.Surface[x, y] = ColorBgra.FromBgra(srcBgra.B, srcBgra.G, srcBgra.R, c);
break;
case CloudEffect.OVERLAY_PRIMARY:
ColorBgra primary = (ColorBgra)EnvironmentParameters.ForeColor;
dstArgs.Surface[x, y] = ColorBgra.FromBgra(primary.B, primary.G, primary.R, c);
break;
case CloudEffect.OVERLAY_SECONDARY:
ColorBgra secondary = (ColorBgra)EnvironmentParameters.BackColor;
dstArgs.Surface[x, y] = ColorBgra.FromBgra(secondary.B, secondary.G, secondary.R, c);
break;
case CloudEffect.REPLACE_TRANSPARENT:
dstArgs.Surface[x, y] = (0 == srcBgra.A) ? ColorBgra.FromBgra(srcBgra.B, srcBgra.G, srcBgra.R, c) : srcArgs.Surface[x, y];
break;
default:
break;
}
}
}
}
}
}
开发者ID:AKinanS,项目名称:pdn-plugins,代码行数:46,代码来源:CloudEffect.cs
示例18: ComputeCellColor
private ColorBgra ComputeCellColor(int x, int y, RenderArgs src, int cellSize)
{
Rectangle cell = GetCellBox(x, y, cellSize);
cell.Intersect(src.Bounds);
int left = cell.Left;
int right = cell.Right - 1;
int bottom = cell.Bottom - 1;
int top = cell.Top;
ColorBgra colorTopLeft = src.Surface[left, top];
ColorBgra colorTopRight = src.Surface[right, top];
ColorBgra colorBottomLeft = src.Surface[left, bottom];
ColorBgra colorBottomRight = src.Surface[right, bottom];
ColorBgra c = ColorBgra.BlendColors4W16IP(colorTopLeft, 16384, colorTopRight, 16384, colorBottomLeft, 16384, colorBottomRight, 16384);
return c;
}
开发者ID:herbqiao,项目名称:paint.net,代码行数:19,代码来源:PixelateEffect.cs
示例19: OnSetRenderInfo
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs)
{
this.pencilTipSize = newToken.GetProperty<Int32Property>(PropertyNames.PencilTipSize).Value;
this.colorRange = newToken.GetProperty<Int32Property>(PropertyNames.ColorRange).Value;
PropertyBasedEffectConfigToken blurToken = new PropertyBasedEffectConfigToken(this.blurProps);
blurToken.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, this.pencilTipSize);
this.blurEffect.SetRenderInfo(blurToken, dstArgs, srcArgs);
PropertyBasedEffectConfigToken bacToken = new PropertyBasedEffectConfigToken(this.bacProps);
bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, this.colorRange);
bacToken.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, -this.colorRange);
this.bacAdjustment.SetRenderInfo(bacToken, dstArgs, dstArgs);
this.desaturateEffect.SetRenderInfo(null, dstArgs, dstArgs);
this.invertEffect.SetRenderInfo(null, dstArgs, dstArgs);
base.OnSetRenderInfo(newToken, dstArgs, srcArgs);
}
开发者ID:herbqiao,项目名称:paint.net,代码行数:20,代码来源:PencilSketchEffect.cs
示例20: OnExecute
public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace)
{
if (this.layerIndex < 1 || this.layerIndex >= historyWorkspace.Document.Layers.Count)
{
throw new ArgumentException("layerIndex must be greater than or equal to 1, and a valid layer index. layerIndex=" +
layerIndex + ", allowableRange=[0," + historyWorkspace.Document.Layers.Count + ")");
}
int bottomLayerIndex = this.layerIndex - 1;
Rectangle bounds = historyWorkspace.Document.Bounds;
PdnRegion region = new PdnRegion(bounds);
BitmapHistoryMemento bhm = new BitmapHistoryMemento(
null,
null,
historyWorkspace,
bottomLayerIndex,
region);
BitmapLayer topLayer = (BitmapLayer)historyWorkspace.Document.Layers[this.layerIndex];
BitmapLayer bottomLayer = (BitmapLayer)historyWorkspace.Document.Layers[bottomLayerIndex];
RenderArgs bottomRA = new RenderArgs(bottomLayer.Surface);
EnterCriticalRegion();
topLayer.Render(bottomRA, region);
bottomLayer.Invalidate();
bottomRA.Dispose();
bottomRA = null;
region.Dispose();
region = null;
DeleteLayerFunction dlf = new DeleteLayerFunction(this.layerIndex);
HistoryMemento dlhm = dlf.Execute(historyWorkspace);
CompoundHistoryMemento chm = new CompoundHistoryMemento(StaticName, StaticImage, new HistoryMemento[] { bhm, dlhm });
return chm;
}
开发者ID:metadeta96,项目名称:openpdn,代码行数:40,代码来源:MergeLayerDownFunction.cs
注:本文中的RenderArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论