本文整理汇总了C#中MatterHackers.Agg.Graphics2D.Render方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics2D.Render方法的具体用法?C# Graphics2D.Render怎么用?C# Graphics2D.Render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.Graphics2D
的用法示例。
在下文中一共展示了Graphics2D.Render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTo
public static void DrawTo(Graphics2D graphics2D, Mesh meshToDraw, Vector2 offset, double scale, RGBA_Bytes silhouetteColor)
{
graphics2D.Rasterizer.gamma(new gamma_power(.3));
PathStorage polygonProjected = new PathStorage();
foreach (Face face in meshToDraw.Faces)
{
if (face.normal.z > 0)
{
polygonProjected.remove_all();
bool first = true;
foreach (FaceEdge faceEdge in face.FaceEdges())
{
Vector2 position = new Vector2(faceEdge.firstVertex.Position.x, faceEdge.firstVertex.Position.y);
position += offset;
position *= scale;
if (first)
{
polygonProjected.MoveTo(position.x, position.y);
first = false;
}
else
{
polygonProjected.LineTo(position.x, position.y);
}
}
graphics2D.Render(polygonProjected, silhouetteColor);
}
}
graphics2D.Rasterizer.gamma(new gamma_none());
}
示例2: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
GameImageSequence menuBackground = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "CreditsScreen");
graphics2D.Render(menuBackground.GetImageByIndex(0), 0, 0);
base.OnDraw(graphics2D);
}
示例3: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Black);
RoundedRect boundsRect = new RoundedRect(dragBar.BoundsRelativeToParent, 0);
graphics2D.Render(boundsRect, DragBarColor);
base.OnDraw(graphics2D);
}
示例4: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
GameImageSequence background = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "GameBackground");
graphics2D.Render(background.GetImageByIndex(0), 0, 0);
m_Playfield.Draw(graphics2D);
base.OnDraw(graphics2D);
}
示例5: DrawBorder
private void DrawBorder(Graphics2D graphics2D)
{
if (borderColor.Alpha0To255 > 0)
{
RectangleDouble boarderRectangle = LocalBounds;
RoundedRect rectBorder = new RoundedRect(boarderRectangle, 0);
graphics2D.Render(new Stroke(rectBorder, borderWidth), borderColor);
}
}
示例6: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
RectangleDouble Bounds = LocalBounds;
RoundedRect rectBorder = new RoundedRect(Bounds, this.borderRadius);
graphics2D.Render(rectBorder, borderColor);
RectangleDouble insideBounds = Bounds;
insideBounds.Inflate(-this.borderWidth);
RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(this.borderRadius - this.borderWidth, 0));
graphics2D.Render(rectInside, this.fillColor);
base.OnDraw(graphics2D);
}
示例7: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
byte alpha = (byte)(alphaSlider.Value * 255);
for (int i = 0; i < lionShape.NumPaths; i++)
{
lionShape.Colors[i].Alpha0To255 = alpha;
}
Affine transform = Affine.NewIdentity();
transform *= Affine.NewTranslation(-lionShape.Center.x, -lionShape.Center.y);
transform *= Affine.NewScaling(lionScale, lionScale);
transform *= Affine.NewRotation(angle + Math.PI);
transform *= Affine.NewSkewing(skewX / 1000.0, skewY / 1000.0);
transform *= Affine.NewTranslation(Width / 2, Height / 2);
// This code renders the lion:
VertexSourceApplyTransform transformedPathStorage = new VertexSourceApplyTransform(lionShape.Path, transform);
graphics2D.Render(transformedPathStorage, lionShape.Colors, lionShape.PathIndex, lionShape.NumPaths);
base.OnDraw(graphics2D);
}
示例8: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
if (borderColor.Alpha0To255 > 0)
{
RectangleDouble borderRectangle = LocalBounds;
if (borderWidth > 0)
{
if (borderWidth == 1)
{
graphics2D.Rectangle(borderRectangle, borderColor);
}
else
{
//boarderRectangle.Inflate(-borderWidth / 2);
RoundedRect rectBorder = new RoundedRect(borderRectangle, this.borderRadius);
graphics2D.Render(new Stroke(rectBorder, borderWidth), borderColor);
}
}
}
if (this.fillColor.Alpha0To255 > 0)
{
RectangleDouble insideBounds = LocalBounds;
insideBounds.Inflate(-this.borderWidth);
RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(this.borderRadius - this.borderWidth, 0));
graphics2D.Render(rectInside, this.fillColor);
}
base.OnDraw(graphics2D);
}
示例9: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
if (loadedGCode != null)
{
Affine transform = TotalTransform;
CreateGrid(transform);
double gridLineWidths = 0.2 * layerScale;
Stroke stroke = new Stroke(grid, gridLineWidths);
if (RenderGrid)
{
graphics2D.Render(stroke, new RGBA_Bytes(190, 190, 190, 255));
}
RenderType renderType = RenderType.Extrusions;
if (RenderMoves)
{
renderType |= RenderType.Moves;
}
if (RenderRetractions)
{
renderType |= RenderType.Retractions;
}
if (RenderSpeeds)
{
renderType |= RenderType.SpeedColors;
}
if (SimulateExtrusion)
{
renderType |= RenderType.SimulateExtrusion;
}
gCodeRenderer.Render(graphics2D, activeLayerIndex, transform, layerScale, renderType,
FeatureToStartOnRatio0To1, FeatureToEndOnRatio0To1);
}
base.OnDraw(graphics2D);
}
示例10: PrintTopOfPage
private double PrintTopOfPage(ImageBuffer plateInventoryImage, Graphics2D plateGraphics)
{
plateGraphics.Clear(RGBA_Bytes.White);
double currentlyPrintingHeightPixels = plateInventoryImage.Height - PageMarginMM.Top * PixelPerMM;
string logoPathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PartSheetLogo.png");
if(File.Exists(logoPathAndFile))
{
ImageBuffer logoImage = new ImageBuffer();
ImageIO.LoadImageData(logoPathAndFile, logoImage);
currentlyPrintingHeightPixels -= logoImage.Height;
plateGraphics.Render(logoImage, (plateInventoryImage.Width - logoImage.Width) / 2, currentlyPrintingHeightPixels);
}
currentlyPrintingHeightPixels -= PartPaddingPixels;
double underlineHeightMM = 1;
RectangleDouble lineBounds = new RectangleDouble(0, 0, plateInventoryImage.Width - PageMarginPixels.Left * 2, underlineHeightMM * PixelPerMM);
lineBounds.Offset(PageMarginPixels.Left, currentlyPrintingHeightPixels - lineBounds.Height);
plateGraphics.FillRectangle(lineBounds, RGBA_Bytes.Black);
return currentlyPrintingHeightPixels - (lineBounds.Height + PartPaddingPixels);
}
示例11: render_gpc
private void render_gpc(Graphics2D graphics2D)
{
switch (m_polygons.SelectedIndex)
{
case 0:
{
//------------------------------------
// Two simple paths
//
PathStorage ps1 = new PathStorage();
PathStorage ps2 = new PathStorage();
double x = m_x - Width / 2 + 100;
double y = m_y - Height / 2 + 100;
ps1.MoveTo(x + 140, y + 145);
ps1.LineTo(x + 225, y + 44);
ps1.LineTo(x + 296, y + 219);
ps1.ClosePolygon();
ps1.LineTo(x + 226, y + 289);
ps1.LineTo(x + 82, y + 292);
ps1.MoveTo(x + 220, y + 222);
ps1.LineTo(x + 363, y + 249);
ps1.LineTo(x + 265, y + 331);
ps1.MoveTo(x + 242, y + 243);
ps1.LineTo(x + 268, y + 309);
ps1.LineTo(x + 325, y + 261);
ps1.MoveTo(x + 259, y + 259);
ps1.LineTo(x + 273, y + 288);
ps1.LineTo(x + 298, y + 266);
ps2.MoveTo(100 + 32, 100 + 77);
ps2.LineTo(100 + 473, 100 + 263);
ps2.LineTo(100 + 351, 100 + 290);
ps2.LineTo(100 + 354, 100 + 374);
graphics2D.Render(ps1, new RGBA_Floats(0, 0, 0, 0.1).GetAsRGBA_Bytes());
graphics2D.Render(ps2, new RGBA_Floats(0, 0.6, 0, 0.1).GetAsRGBA_Bytes());
CreateAndRenderCombined(graphics2D, ps1, ps2);
}
break;
case 1:
{
//------------------------------------
// Closed stroke
//
PathStorage ps1 = new PathStorage();
PathStorage ps2 = new PathStorage();
Stroke stroke = new Stroke(ps2);
stroke.width(10.0);
double x = m_x - Width / 2 + 100;
double y = m_y - Height / 2 + 100;
ps1.MoveTo(x + 140, y + 145);
ps1.LineTo(x + 225, y + 44);
ps1.LineTo(x + 296, y + 219);
ps1.ClosePolygon();
ps1.LineTo(x + 226, y + 289);
ps1.LineTo(x + 82, y + 292);
ps1.MoveTo(x + 220 - 50, y + 222);
ps1.LineTo(x + 265 - 50, y + 331);
ps1.LineTo(x + 363 - 50, y + 249);
ps1.close_polygon(ShapePath.FlagsAndCommand.FlagCCW);
ps2.MoveTo(100 + 32, 100 + 77);
ps2.LineTo(100 + 473, 100 + 263);
ps2.LineTo(100 + 351, 100 + 290);
ps2.LineTo(100 + 354, 100 + 374);
ps2.ClosePolygon();
graphics2D.Render(ps1, new RGBA_Floats(0, 0, 0, 0.1).GetAsRGBA_Bytes());
graphics2D.Render(stroke, new RGBA_Floats(0, 0.6, 0, 0.1).GetAsRGBA_Bytes());
CreateAndRenderCombined(graphics2D, ps1, stroke);
}
break;
case 2:
{
//------------------------------------
// Great Britain and Arrows
//
PathStorage gb_poly = new PathStorage();
PathStorage arrows = new PathStorage();
GreatBritanPathStorage.Make(gb_poly);
make_arrows(arrows);
Affine mtx1 = Affine.NewIdentity();
Affine mtx2 = Affine.NewIdentity();
mtx1 *= Affine.NewTranslation(-1150, -1150);
mtx1 *= Affine.NewScaling(2.0);
mtx2 = mtx1;
//.........这里部分代码省略.........
示例12: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
graphics2D.Render(imageToFillOn, imageOffset);
base.OnDraw(graphics2D);
}
示例13: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
if (this.queueDataView.EditMode)
{
selectionCheckBoxContainer.Visible = true;
actionButtonContainer.Visible = false;
}
else
{
selectionCheckBoxContainer.Visible = false;
}
base.OnDraw(graphics2D);
RectangleDouble Bounds = LocalBounds;
RoundedRect rectBorder = new RoundedRect(Bounds, 0);
if (this.isActivePrint && !this.queueDataView.EditMode)
{
this.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
SetTextColors(RGBA_Bytes.White);
this.viewButton.BackgroundColor = RGBA_Bytes.White;
this.viewButtonLabel.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
//Draw interior border
graphics2D.Render(new Stroke(rectBorder, 3), ActiveTheme.Instance.SecondaryAccentColor);
}
else if (this.isSelectedItem)
{
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
this.partLabel.TextColor = RGBA_Bytes.White;
this.partStatus.TextColor = RGBA_Bytes.White;
this.selectionCheckBox.TextColor = RGBA_Bytes.White;
this.viewButton.BackgroundColor = RGBA_Bytes.White;
this.viewButtonLabel.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
}
else if (this.IsHoverItem)
{
this.BackgroundColor = RGBA_Bytes.White;
this.partLabel.TextColor = RGBA_Bytes.Black;
this.selectionCheckBox.TextColor = RGBA_Bytes.Black;
this.partStatus.TextColor = RGBA_Bytes.Black;
this.viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
this.viewButtonLabel.TextColor = RGBA_Bytes.White;
//Draw interior border
graphics2D.Render(new Stroke(rectBorder, 3), ActiveTheme.Instance.SecondaryAccentColor);
}
else
{
this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 255);
SetTextColors(RGBA_Bytes.Black);
this.selectionCheckBox.TextColor = RGBA_Bytes.Black;
this.partStatus.TextColor = RGBA_Bytes.Black;
this.viewButton.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
this.viewButtonLabel.TextColor = RGBA_Bytes.White;
}
}
示例14: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
base.OnDraw(graphics2D);
RectangleDouble boarderRectangle = LocalBounds;
RoundedRect rectBorder = new RoundedRect(boarderRectangle, 0);
graphics2D.Render(new Stroke(rectBorder, 1), new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200));
}
示例15: Render
public override void Render(Graphics2D graphics2D, Affine transform, double layerScale, RenderType renderType)
{
if ((renderType & RenderType.Extrusions) == RenderType.Extrusions)
{
double extrusionLineWidths = 0.2 * layerScale;
RGBA_Bytes extrusionColor = RGBA_Bytes.Black;
//extrusionColor = color;
PathStorage pathStorage = new PathStorage();
VertexSourceApplyTransform transformedPathStorage = new VertexSourceApplyTransform(pathStorage, transform);
Stroke stroke = new Stroke(transformedPathStorage, extrusionLineWidths);
stroke.line_cap(LineCap.Round);
stroke.line_join(LineJoin.Round);
pathStorage.Add(start.x, start.y, ShapePath.FlagsAndCommand.CommandMoveTo);
pathStorage.Add(end.x, end.y, ShapePath.FlagsAndCommand.CommandLineTo);
graphics2D.Render(stroke, 0, extrusionColor);
}
}