本文整理汇总了C#中MatterHackers.Agg.RectangleDouble类的典型用法代码示例。如果您正苦于以下问题:C# RectangleDouble类的具体用法?C# RectangleDouble怎么用?C# RectangleDouble使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RectangleDouble类属于MatterHackers.Agg命名空间,在下文中一共展示了RectangleDouble类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetClippingRect
public override void SetClippingRect(RectangleDouble clippingRect)
{
cachedClipRect = clippingRect;
GL.Scissor((int)Math.Floor(Math.Max(clippingRect.Left, 0)), (int)Math.Floor(Math.Max(clippingRect.Bottom, 0)),
(int)Math.Ceiling(Math.Max(clippingRect.Width, 0)), (int)Math.Ceiling(Math.Max(clippingRect.Height, 0)));
GL.Enable(EnableCap.ScissorTest);
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:7,代码来源:RendererOpenGL.cs
示例2: Equals
public bool Equals(RectangleDouble other, double epsilon)
{
return Math.Abs(Left - other.Left) <= epsilon
&& Math.Abs(Bottom - other.Bottom) <= epsilon
&& Math.Abs(Right - other.Right) <= epsilon
&& Math.Abs(Top - other.Top) <= epsilon;
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:7,代码来源:RectangleDouble.cs
示例3: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
int thumbHeight = 10;
//graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Black);
double bottom = textScrollWidget.Position0To1 * (Height - thumbHeight);// the 2 is the border
RectangleDouble thumb = new RectangleDouble(0, bottom, Width, bottom + thumbHeight);// the 1 is the border
graphics2D.FillRectangle(thumb, RGBA_Bytes.DarkGray);
base.OnDraw(graphics2D);
}
开发者ID:fuding,项目名称:MatterControl,代码行数:9,代码来源:TextScrolBar.cs
示例4: CreditsMenu
public CreditsMenu(RectangleDouble bounds)
{
BoundsRelativeToParent = bounds;
GameImageSequence cancelButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "NumPlayersCancelButton");
Button cancelGameButton = new Button(400, 200, new ButtonViewThreeImage(cancelButtonSequence.GetImageByIndex(0), cancelButtonSequence.GetImageByIndex(1), cancelButtonSequence.GetImageByIndex(2)));
AddChild(cancelGameButton);
cancelGameButton.Click += new Button.ButtonEventHandler(OnCancelMenuButton);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:9,代码来源:CreditsScreen.cs
示例5: PlayfieldView
public PlayfieldView(RectangleDouble bounds)
{
BoundsRelativeToParent = bounds;
GameImageSequence menuButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "MenuButtonFromGame");
Button menuButton = new Button(400, 12, new ButtonViewThreeImage(menuButtonSequence.GetImageByIndex(0), menuButtonSequence.GetImageByIndex(1), menuButtonSequence.GetImageByIndex(2)));
AddChild(menuButton);
menuButton.Click += new Button.ButtonEventHandler(EscapeMenu);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:9,代码来源:PlayFieldView.cs
示例6: bounding_rect_single
public static bool bounding_rect_single(IVertexSource vs, int path_id, ref RectangleDouble rect)
{
double x1, y1, x2, y2;
bool rValue = bounding_rect_single(vs, path_id, out x1, out y1, out x2, out y2);
rect.Left = x1;
rect.Bottom = y1;
rect.Right = x2;
rect.Top = y2;
return rValue;
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:10,代码来源:agg_bounding_rect.cs
示例7: blur
public blur()
{
m_rbuf2 = new ImageBuffer();
m_shape_bounds = new RectangleDouble();
m_method = new RadioButtonGroup(new Vector2(10.0, 10.0), new Vector2(130.0, 60.0));
m_radius = new Slider(new Vector2(130 + 10.0, 10.0 + 4.0), new Vector2(290, 8.0));
m_shadow_ctrl = new PolygonEditWidget(4);
m_channel_r = new CheckBox(10.0, 80.0, "Red");
m_channel_g = new CheckBox(10.0, 95.0, "Green");
m_channel_b = new CheckBox(10.0, 110.0, "Blue");
m_FlattenCurves = new CheckBox(10, 315, "Convert And Flatten Curves");
m_FlattenCurves.Checked = true;
AddChild(m_method);
m_method.AddRadioButton("Stack Blur");
m_method.AddRadioButton("Recursive Blur");
m_method.AddRadioButton("Channels");
m_method.SelectedIndex = 1;
AddChild(m_radius);
m_radius.SetRange(0.0, 40.0);
m_radius.Value = 15.0;
m_radius.Text = "Blur Radius={0:F2}";
AddChild(m_shadow_ctrl);
AddChild(m_channel_r);
AddChild(m_channel_g);
AddChild(m_channel_b);
AddChild(m_FlattenCurves);
m_channel_g.Checked = true;
m_sl = new ScanlineCachePacked8();
StyledTypeFace typeFaceForLargeA = new StyledTypeFace(LiberationSansFont.Instance, 300, flatenCurves: false);
m_path = typeFaceForLargeA.GetGlyphForCharacter('a');
Affine shape_mtx = Affine.NewIdentity();
shape_mtx *= Affine.NewTranslation(150, 100);
m_path = new VertexSourceApplyTransform(m_path, shape_mtx);
m_shape = new FlattenCurves(m_path);
bounding_rect.bounding_rect_single(m_shape, 0, ref m_shape_bounds);
m_shadow_ctrl.SetXN(0, m_shape_bounds.Left);
m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom);
m_shadow_ctrl.SetXN(1, m_shape_bounds.Right);
m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom);
m_shadow_ctrl.SetXN(2, m_shape_bounds.Right);
m_shadow_ctrl.SetYN(2, m_shape_bounds.Top);
m_shadow_ctrl.SetXN(3, m_shape_bounds.Left);
m_shadow_ctrl.SetYN(3, m_shape_bounds.Top);
m_shadow_ctrl.line_color(new RGBA_Floats(0, 0.3, 0.5, 0.3));
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:54,代码来源:blur.cs
示例8: RandomFillWidget
public RandomFillWidget(Point2D size)
{
LocalBounds = new RectangleDouble(0, 0, size.x, size.y);
image = new ImageBuffer(size.x, size.y, 32, new BlenderBGRA());
Random rand = new Random();
Graphics2D imageGraphics = image.NewGraphics2D();
for (int i = 0; i < 30; i++)
{
imageGraphics.Circle(rand.NextDouble() * image.Width, rand.NextDouble() * image.Height, rand.NextDouble() * 10 + 5, RGBA_Bytes.Red);
}
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:12,代码来源:ScrollableWidgetTestPage.cs
示例9: GetTrackBounds
private RectangleDouble GetTrackBounds()
{
RectangleDouble trackBounds;
if (sliderAttachedTo.Orientation == Orientation.Horizontal)
{
trackBounds = new RectangleDouble(0, -TrackHeight / 2, sliderAttachedTo.TotalWidthInPixels, TrackHeight / 2);
}
else
{
trackBounds = new RectangleDouble(-TrackHeight / 2, 0, TrackHeight / 2, sliderAttachedTo.TotalWidthInPixels);
}
return trackBounds;
}
开发者ID:broettge,项目名称:MatterControl,代码行数:13,代码来源:DoubleSolidSlider.cs
示例10: WindowWidget
public WindowWidget(RectangleDouble InBounds)
{
int sizeOfDragBar = 20;
BackgroundColor = RGBA_Bytes.White;
OriginRelativeParent = new Vector2(InBounds.Left, InBounds.Bottom);
LocalBounds = new RectangleDouble(0, 0, InBounds.Width, InBounds.Height);
DragBarColor = RGBA_Bytes.LightGray;
dragBar = new TitleBarWidget(new RectangleDouble(0, InBounds.Height - sizeOfDragBar, InBounds.Width, InBounds.Height));
//dragBar.DebugShowBounds = true;
base.AddChild(dragBar);
//clientArea.DebugShowBounds = true;
base.AddChild(clientArea);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:17,代码来源:WindowWidget.cs
示例11: RayTraceWidget
public RayTraceWidget(int width = 200, int height = 200)
{
trackballTumbleWidget = new TrackballTumbleWidget();
trackballTumbleWidget.DoOpenGlDrawing = false;
trackballTumbleWidget.DrawRotationHelperCircle = false;
//trackballTumbleWidget.DrawGlContent += trackballTumbleWidget_DrawGlContent;
trackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;
AddChild(trackballTumbleWidget);
totalTime.Start();
CreateScene();
LocalBounds = new RectangleDouble(0, 0, width, height);
trackballTumbleWidget.TrackBallController.Scale = .03;
trackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(0, 0, MathHelper.Tau / 16)));
trackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .19, 0, 0)));
trackballTumbleWidget.AnchorAll();
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:21,代码来源:RayTracerWiget.cs
示例12: OnDraw
public override void OnDraw(Agg.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);
if (this.isUnderlined)
{
//Printer.TypeFaceStyle.DoUnderline = true;
RectangleDouble underline = new RectangleDouble(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom);
graphics2D.Rectangle(underline, buttonText.TextColor);
}
base.OnDraw(graphics2D);
}
开发者ID:broettge,项目名称:MatterControl,代码行数:22,代码来源:LinkButtonFactory.cs
示例13: HowManyPlayersMenu
public HowManyPlayersMenu(RectangleDouble bounds)
{
BoundsRelativeToParent = bounds;
GameImageSequence onePlayerButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "OnePlayerButton");
Button onePlayerGameButton = new Button(270, 310, new ButtonViewThreeImage(onePlayerButtonSequence.GetImageByIndex(0), onePlayerButtonSequence.GetImageByIndex(1), onePlayerButtonSequence.GetImageByIndex(2)));
AddChild(onePlayerGameButton);
onePlayerGameButton.Click += new EventHandler(OnStartOnePlayerGameButton);
GameImageSequence twoPlayerButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "TwoPlayerButton");
Button twoPlayerGameButton = new Button(400, 310, new ButtonViewThreeImage(twoPlayerButtonSequence.GetImageByIndex(0), twoPlayerButtonSequence.GetImageByIndex(1), twoPlayerButtonSequence.GetImageByIndex(2)));
AddChild(twoPlayerGameButton);
twoPlayerGameButton.Click += new EventHandler(OnStartTwoPlayerGameButton);
GameImageSequence fourPlayerButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "FourPlayerButton");
Button fourPlayerGameButton = new Button(530, 310, new ButtonViewThreeImage(fourPlayerButtonSequence.GetImageByIndex(0), fourPlayerButtonSequence.GetImageByIndex(1), fourPlayerButtonSequence.GetImageByIndex(2)));
AddChild(fourPlayerGameButton);
fourPlayerGameButton.Click += new EventHandler(OnStartFourPlayerGameButton);
GameImageSequence cancelButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "NumPlayersCancelButton");
Button cancelGameButton = new Button(400, 210, new ButtonViewThreeImage(cancelButtonSequence.GetImageByIndex(0), cancelButtonSequence.GetImageByIndex(1), cancelButtonSequence.GetImageByIndex(2)));
AddChild(cancelGameButton);
cancelGameButton.Click += new EventHandler(OnCancelMenuButton);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:23,代码来源:HowManyPlayersMenu.cs
示例14: NeedsToBeSmaller
private bool NeedsToBeSmaller(RectangleDouble partScreenBounds, RectangleDouble goalBounds)
{
if (partScreenBounds.Bottom < goalBounds.Bottom
|| partScreenBounds.Top > goalBounds.Top
|| partScreenBounds.Left < goalBounds.Left
|| partScreenBounds.Right > goalBounds.Right)
{
return true;
}
return false;
}
开发者ID:CodeMangler,项目名称:MatterControl,代码行数:12,代码来源:ThumbnailTracer.cs
示例15: ScaleMeshToView
private void ScaleMeshToView(List<MeshGroup> loadedMeshGroups)
{
if (loadedMeshGroups != null)
{
AxisAlignedBoundingBox meshBounds = GetAxisAlignedBoundingBox(loadedMeshGroups);
bool done = false;
double scallFraction = .1;
RectangleDouble goalBounds = new RectangleDouble(0, 0, size.x, size.y);
goalBounds.Inflate(-10);
while (!done)
{
RectangleDouble partScreenBounds = GetScreenBounds(meshBounds);
if (!NeedsToBeSmaller(partScreenBounds, goalBounds))
{
trackballTumbleWidget.TrackBallController.Scale *= (1 + scallFraction);
partScreenBounds = GetScreenBounds(meshBounds);
// If it crossed over the goal reduct the amount we are adjusting by.
if (NeedsToBeSmaller(partScreenBounds, goalBounds))
{
scallFraction /= 2;
}
}
else
{
trackballTumbleWidget.TrackBallController.Scale *= (1 - scallFraction);
partScreenBounds = GetScreenBounds(meshBounds);
// If it crossed over the goal reduct the amount we are adjusting by.
if (!NeedsToBeSmaller(partScreenBounds, goalBounds))
{
scallFraction /= 2;
if (scallFraction < .001)
{
done = true;
}
}
}
}
}
}
开发者ID:CodeMangler,项目名称:MatterControl,代码行数:43,代码来源:ThumbnailTracer.cs
示例16: OnDraw
public override void OnDraw(Agg.Graphics2D graphics2D)
{
base.OnDraw(graphics2D);
if (this.isUnderlined)
{
//Printer.TypeFaceStyle.DoUnderline = true;
RectangleDouble underline = new RectangleDouble(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom);
graphics2D.Rectangle(underline, this.TextColor);
}
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:10,代码来源:BaseConnectionWidget.cs
示例17: SetClippingRect
public abstract void SetClippingRect(RectangleDouble rect_d);
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:1,代码来源:Graphics2D.cs
示例18: PartsAreInPrintVolume
private bool PartsAreInPrintVolume()
{
if (ActiveSliceSettings.Instance != null
&& !ActiveSliceSettings.Instance.CenterOnBed()
&& ActivePrinterProfile.Instance.ActivePrinter != null)
{
AxisAlignedBoundingBox allBounds = MeshViewerWidget.GetAxisAlignedBoundingBox(MeshGroups);
bool onBed = allBounds.minXYZ.z > -.001 && allBounds.minXYZ.z < .001; // really close to the bed
RectangleDouble bedRect = new RectangleDouble(0, 0, ActiveSliceSettings.Instance.BedSize.x, ActiveSliceSettings.Instance.BedSize.y);
bedRect.Offset(ActiveSliceSettings.Instance.BedCenter - ActiveSliceSettings.Instance.BedSize / 2);
bool inBounds = bedRect.Contains(new Vector2(allBounds.minXYZ)) && bedRect.Contains(new Vector2(allBounds.maxXYZ));
return onBed && inBounds;
}
return true;
}
开发者ID:gobrien4418,项目名称:MatterControl,代码行数:18,代码来源:View3DWidget.cs
示例19: SavingFunction
public void SavingFunction()
{
currentlySaving = true;
countThatHaveBeenSaved = 0;
// first create images for all the parts
foreach (FileNameAndPresentationName stlFileNames in stlFilesToPrint)
{
Mesh loadedMesh = StlProcessing.Load(stlFileNames.fileName);
if (loadedMesh != null)
{
AxisAlignedBoundingBox aabb = loadedMesh.GetAxisAlignedBoundingBox();
RectangleDouble bounds2D = new RectangleDouble(aabb.minXYZ.x, aabb.minXYZ.y, aabb.maxXYZ.x, aabb.maxXYZ.y);
double widthInMM = bounds2D.Width + PartMarginMM * 2;
double textSpaceMM = 5;
double heightMM = textSpaceMM + bounds2D.Height + PartMarginMM * 2;
TypeFacePrinter typeFacePrinter = new TypeFacePrinter(stlFileNames.presentationName, 28, Vector2.Zero, Justification.Center, Baseline.BoundsCenter);
double sizeOfNameX = typeFacePrinter.GetSize().x + PartMarginPixels * 2;
Vector2 sizeOfRender = new Vector2(widthInMM * PixelPerMM, heightMM * PixelPerMM);
ImageBuffer imageOfPart = new ImageBuffer((int)(Math.Max(sizeOfNameX, sizeOfRender.x)), (int)(sizeOfRender.y), 32, new BlenderBGRA());
typeFacePrinter.Origin = new Vector2(imageOfPart.Width / 2, (textSpaceMM / 2) * PixelPerMM);
Graphics2D partGraphics2D = imageOfPart.NewGraphics2D();
RectangleDouble rectBounds = new RectangleDouble(0, 0, imageOfPart.Width, imageOfPart.Height);
double strokeWidth = .5 * PixelPerMM;
rectBounds.Inflate(-strokeWidth / 2);
RoundedRect rect = new RoundedRect(rectBounds, PartMarginMM * PixelPerMM);
partGraphics2D.Render(rect, RGBA_Bytes.LightGray);
Stroke rectOutline = new Stroke(rect, strokeWidth);
partGraphics2D.Render(rectOutline, RGBA_Bytes.DarkGray);
PolygonMesh.Rendering.OrthographicZProjection.DrawTo(partGraphics2D, loadedMesh, new Vector2(-bounds2D.Left + PartMarginMM, -bounds2D.Bottom + textSpaceMM + PartMarginMM), PixelPerMM, RGBA_Bytes.Black);
partGraphics2D.Render(typeFacePrinter, RGBA_Bytes.Black);
partImagesToPrint.Add(new PartImage(imageOfPart));
}
countThatHaveBeenSaved++;
if (UpdateRemainingItems != null)
{
UpdateRemainingItems(this, new StringEventArgs(Path.GetFileName(stlFileNames.presentationName)));
}
}
partImagesToPrint.Sort(BiggestToLittlestImages);
PdfDocument document = new PdfDocument();
document.Info.Title = "MatterHackers Parts Sheet";
document.Info.Author = "MatterHackers Inc.";
document.Info.Subject = "This is a list of the parts that are in a queue from MatterControl.";
document.Info.Keywords = "MatterControl, STL, 3D Printing";
int nextPartToPrintIndex = 0;
int plateNumber = 1;
bool done = false;
while (!done && nextPartToPrintIndex < partImagesToPrint.Count)
{
PdfPage pdfPage = document.AddPage();
CreateOnePage(plateNumber++, ref nextPartToPrintIndex, pdfPage);
}
try
{
// save the final document
document.Save(pathAndFileToSaveTo);
// Now try and open the document. This will lanch whatever PDF viewer is on the system and ask it
// to show the file (at least on Windows).
Process.Start(pathAndFileToSaveTo);
}
catch (Exception)
{
}
OnDoneSaving();
currentlySaving = false;
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:76,代码来源:PartsSheetCreator.cs
示例20: FillRectangle
public void FillRectangle(RectangleDouble rect, IColorType fillColor)
{
FillRectangle(rect.Left, rect.Bottom, rect.Right, rect.Top, fillColor);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:4,代码来源:Graphics2D.cs
注:本文中的MatterHackers.Agg.RectangleDouble类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论