本文整理汇总了C#中MatterHackers.Agg.RectangleDouble类的典型用法代码示例。如果您正苦于以下问题:C# RectangleDouble类的具体用法?C# RectangleDouble怎么用?C# RectangleDouble使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RectangleDouble类属于MatterHackers.Agg命名空间,在下文中一共展示了RectangleDouble类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
}
}
}
}