本文整理汇总了C#中MatterHackers.Agg.VertexSource.RoundedRect类的典型用法代码示例。如果您正苦于以下问题:C# RoundedRect类的具体用法?C# RoundedRect怎么用?C# RoundedRect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RoundedRect类属于MatterHackers.Agg.VertexSource命名空间,在下文中一共展示了RoundedRect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
RoundedRect rect = new RoundedRect(LocalBounds, 0);
//RoundedRect rect = new RoundedRect(LocalBounds, 0);
graphics2D.Render(rect, ThumbColor);
base.OnDraw(graphics2D);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:ScrollBar.cs
示例2: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
Button parentButton = (Button)Parent;
RectangleDouble Bounds = LocalBounds;
RoundedRect rectBorder = new RoundedRect(Bounds, BorderRadius);
if (parentButton.Enabled == true)
{
graphics2D.Render(rectBorder, new RGBA_Bytes(0, 0, 0));
}
else
{
graphics2D.Render(rectBorder, new RGBA_Bytes(128, 128, 128));
}
RectangleDouble insideBounds = Bounds;
insideBounds.Inflate(-BorderWidth);
RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(BorderRadius - BorderWidth, 0));
RGBA_Bytes insideColor = new RGBA_Bytes(1.0, 1.0, 1.0);
if (parentButton.FirstWidgetUnderMouse)
{
if (parentButton.MouseDownOnButton)
{
insideColor = DefaultViewFactory.DefaultBlue;
}
else
{
insideColor = DefaultViewFactory.DefaultBlue.GetAsRGBA_Floats().Blend(RGBA_Floats.White, .75).GetAsRGBA_Bytes();
}
}
graphics2D.Render(rectInside, insideColor);
base.OnDraw(graphics2D);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:35,代码来源:ButtonViewText.cs
示例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);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:9,代码来源:WindowWidget.cs
示例4: 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);
}
}
开发者ID:broettge,项目名称:MatterControl,代码行数:11,代码来源:DropDownMenuFactory.cs
示例5: 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);
}
开发者ID:fuding,项目名称:MatterControl,代码行数:15,代码来源:ActionBarBaseControls.cs
示例6: Generate
public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null)
{
if (pressedImageName == null)
{
pressedImageName = hoverImageName;
}
if (disabledImageName == null)
{
disabledImageName = normalImageName;
}
Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName);
Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName);
Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName);
Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName);
if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor)
{
InvertLightness.DoInvertLightness(normalImage);
InvertLightness.DoInvertLightness(pressedImage);
InvertLightness.DoInvertLightness(hoverImage);
InvertLightness.DoInvertLightness(disabledImage);
}
if (ActiveTheme.Instance.IsTouchScreen)
{
//normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);
RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0);
pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor);
}
ButtonViewStates buttonViewWidget = new ButtonViewStates(
new ImageWidget(normalImage),
new ImageWidget(hoverImage),
new ImageWidget(pressedImage),
new ImageWidget(disabledImage)
);
//Create button based on view container widget
Button imageButton = new Button(0, 0, buttonViewWidget);
imageButton.Margin = new BorderDouble(0);
imageButton.Padding = new BorderDouble(0);
return imageButton;
}
开发者ID:fuding,项目名称:MatterControl,代码行数:45,代码来源:ImageButtonFactory.cs
示例7: 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
示例8: DrawBorder
private void DrawBorder(Graphics2D graphics2D)
{
RectangleDouble Bounds = LocalBounds;
RoundedRect borderRect = new RoundedRect(this.LocalBounds, 0);
Stroke strokeRect = new Stroke(borderRect, borderWidth);
graphics2D.Render(strokeRect, borderColor);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:7,代码来源:DropDownList.cs
示例9: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());
IImageByte backBuffer = widgetsSubImage;
GammaLookUpTable gamma = new GammaLookUpTable(m_gamma.Value);
IRecieveBlenderByte NormalBlender = new BlenderBGRA();
IRecieveBlenderByte GammaBlender = new BlenderGammaBGRA(gamma);
ImageBuffer rasterNormal = new ImageBuffer();
rasterNormal.Attach(backBuffer, NormalBlender);
ImageBuffer rasterGamma = new ImageBuffer();
rasterGamma.Attach(backBuffer, GammaBlender);
ImageClippingProxy clippingProxyNormal = new ImageClippingProxy(rasterNormal);
ImageClippingProxy clippingProxyGamma = new ImageClippingProxy(rasterGamma);
clippingProxyNormal.clear(m_white_on_black.Checked ? new RGBA_Floats(0, 0, 0) : new RGBA_Floats(1, 1, 1));
ScanlineRasterizer ras = new ScanlineRasterizer();
ScanlineCachePacked8 sl = new ScanlineCachePacked8();
VertexSource.Ellipse e = new VertexSource.Ellipse();
// TODO: If you drag the control circles below the bottom of the window we get an exception. This does not happen in AGG.
// It needs to be debugged. Turning on clipping fixes it. But standard agg works without clipping. Could be a bigger problem than this.
//ras.clip_box(0, 0, width(), height());
// Render two "control" circles
e.init(m_x[0], m_y[0], 3, 3, 16);
ras.add_path(e);
ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
scanlineRenderer.render_scanlines_aa_solid(clippingProxyNormal, ras, sl, new RGBA_Bytes(127, 127, 127));
e.init(m_x[1], m_y[1], 3, 3, 16);
ras.add_path(e);
scanlineRenderer.render_scanlines_aa_solid(clippingProxyNormal, ras, sl, new RGBA_Bytes(127, 127, 127));
double d = m_offset.Value;
// Creating a rounded rectangle
VertexSource.RoundedRect r = new VertexSource.RoundedRect(m_x[0] + d, m_y[0] + d, m_x[1] + d, m_y[1] + d, m_radius.Value);
r.normalize_radius();
// Drawing as an outline
if (!m_DrawAsOutlineCheckBox.Checked)
{
Stroke p = new Stroke(r);
p.width(1.0);
ras.add_path(p);
}
else
{
ras.add_path(r);
}
scanlineRenderer.render_scanlines_aa_solid(clippingProxyGamma, ras, sl, m_white_on_black.Checked ? new RGBA_Bytes(255, 255, 255) : new RGBA_Bytes(0, 0, 0));
base.OnDraw(graphics2D);
}
开发者ID:jeske,项目名称:agg-sharp,代码行数:58,代码来源:rounded_rect.cs
示例10: Rectangle
public override void Rectangle(double left, double bottom, double right, double top, RGBA_Bytes color, double strokeWidth)
{
RoundedRect rect = new RoundedRect(left + .5, bottom + .5, right - .5, top - .5, 0);
Stroke rectOutline = new Stroke(rect, strokeWidth);
Render(rectOutline, color);
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:7,代码来源:ImageGraphics2D.cs
示例11: FillRectangle
public override void FillRectangle(double left, double bottom, double right, double top, IColorType fillColor)
{
RoundedRect rect = new RoundedRect(left, bottom, right, top, 0);
Render(rect, fillColor.GetAsRGBA_Bytes());
}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:5,代码来源:ImageGraphics2D.cs
示例12: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
RectangleDouble borderRectangle = LocalBounds;
RoundedRect rectBorder = new RoundedRect(borderRectangle, 0);
graphics2D.Render(new Stroke(rectBorder, BorderWidth), BorderColor);
base.OnDraw(graphics2D);
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:8,代码来源:ClickWidget.cs
示例13: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
double fontHeight = internalTextWidget.Printer.TypeFaceStyle.EmSizeInPixels;
if (Selecting
&& SelectionIndexToStartBefore != CharIndexToInsertBefore)
{
Vector2 selectPosition = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(SelectionIndexToStartBefore);
// for each selected line draw a rect for the chars of that line
if (selectPosition.y == InsertBarPosition.y)
{
RectangleDouble bar = new RectangleDouble(Math.Ceiling(selectPosition.x),
Math.Ceiling(internalTextWidget.Height + selectPosition.y),
Math.Ceiling(InsertBarPosition.x + 1),
Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y - fontHeight));
RoundedRect selectCursorRect = new RoundedRect(bar, 0);
graphics2D.Render(selectCursorRect, this.highlightColor);
}
else
{
int firstCharToHighlight = Math.Min(CharIndexToInsertBefore, SelectionIndexToStartBefore);
int lastCharToHighlight = Math.Max(CharIndexToInsertBefore, SelectionIndexToStartBefore);
int lineStart = firstCharToHighlight;
Vector2 lineStartPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(lineStart);
int lineEnd = lineStart + 1;
Vector2 lineEndPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(lineEnd);
if (lineEndPos.y != lineStartPos.y)
{
// we are starting on a '\n', adjust so we will show the cr at the end of the line
lineEndPos = lineStartPos;
}
bool firstCharOfLine = false;
for (int i = lineEnd; i < lastCharToHighlight + 1; i++)
{
Vector2 nextPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(i);
if (firstCharOfLine)
{
if (lineEndPos.y != lineStartPos.y)
{
// we are starting on a '\n', adjust so we will show the cr at the end of the line
lineEndPos = lineStartPos;
}
firstCharOfLine = false;
}
if (nextPos.y != lineStartPos.y)
{
if (lineEndPos.x == lineStartPos.x)
{
lineEndPos.x += Printer.TypeFaceStyle.GetAdvanceForCharacter(' ');
}
RectangleDouble bar = new RectangleDouble(Math.Ceiling(lineStartPos.x),
Math.Ceiling(internalTextWidget.Height + lineStartPos.y),
Math.Ceiling(lineEndPos.x + 1),
Math.Ceiling(internalTextWidget.Height + lineEndPos.y - fontHeight));
RoundedRect selectCursorRect = new RoundedRect(bar, 0);
graphics2D.Render(selectCursorRect, this.highlightColor);
lineStartPos = nextPos;
firstCharOfLine = true;
}
else
{
lineEndPos = nextPos;
}
}
if (lineEndPos.x != lineStartPos.x)
{
RectangleDouble bar = new RectangleDouble(Math.Ceiling(lineStartPos.x),
Math.Ceiling(internalTextWidget.Height + lineStartPos.y),
Math.Ceiling(lineEndPos.x + 1),
Math.Ceiling(internalTextWidget.Height + lineEndPos.y - fontHeight));
RoundedRect selectCursorRect = new RoundedRect(bar, 0);
graphics2D.Render(selectCursorRect, this.highlightColor);
}
}
}
if (this.Focused && BarIsShowing)
{
double xFraction = graphics2D.GetTransform().tx;
xFraction = xFraction - (int)xFraction;
RectangleDouble bar2 = new RectangleDouble(Math.Ceiling(InsertBarPosition.x) - xFraction,
Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y - fontHeight),
Math.Ceiling(InsertBarPosition.x + 1) - xFraction,
Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y));
RoundedRect cursorRect = new RoundedRect(bar2, 0);
graphics2D.Render(cursorRect, this.cursorColor);
}
RectangleDouble boundsPlusPoint5 = LocalBounds;
boundsPlusPoint5.Inflate(-.5);
RoundedRect borderRect = new RoundedRect(boundsPlusPoint5, 0);
Stroke borderLine = new Stroke(borderRect);
base.OnDraw(graphics2D);
}
开发者ID:annafeldman,项目名称:agg-sharp,代码行数:99,代码来源:InternalTextEditWidget.cs
示例14: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
base.OnDraw(graphics2D);
if (this.isActivePrint)
{
//RectangleDouble Bounds = LocalBounds;
//RoundedRect rectBorder = new RoundedRect(Bounds, 0);
this.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
SetTextColors(RGBA_Bytes.White);
//graphics2D.Render(new Stroke(rectBorder, 4), ActiveTheme.Instance.SecondaryAccentColor);
}
else if (this.isHoverItem)
{
RectangleDouble Bounds = LocalBounds;
RoundedRect rectBorder = new RoundedRect(Bounds, 0);
this.BackgroundColor = RGBA_Bytes.White;
SetTextColors(RGBA_Bytes.Black);
graphics2D.Render(new Stroke(rectBorder, 3), ActiveTheme.Instance.SecondaryAccentColor);
}
else
{
this.BackgroundColor = RGBA_Bytes.White;
SetTextColors(RGBA_Bytes.Black);
}
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:30,代码来源:QueueRowItem.cs
示例15: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());
ScanlineRasterizer ras = new ScanlineRasterizer();
scanline_unpacked_8 sl = new scanline_unpacked_8();
ImageClippingProxy clippingProxy = new ImageClippingProxy(widgetsSubImage);
clippingProxy.clear(new RGBA_Floats(0, 0, 0));
m_profile.text_size(8.0);
// draw a background to show how the alpha is working
int RectWidth = 32;
int xoffset = 238;
int yoffset = 171;
ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 7; j++)
{
if ((i + j) % 2 != 0)
{
VertexSource.RoundedRect rect = new VertexSource.RoundedRect(i * RectWidth + xoffset, j * RectWidth + yoffset,
(i + 1) * RectWidth + xoffset, (j + 1) * RectWidth + yoffset, 2);
rect.normalize_radius();
ras.add_path(rect);
scanlineRenderer.RenderSolid(clippingProxy, ras, sl, new RGBA_Bytes(.9, .9, .9));
}
}
}
double ini_scale = 1.0;
Transform.Affine mtx1 = Affine.NewIdentity();
mtx1 *= Affine.NewScaling(ini_scale, ini_scale);
mtx1 *= Affine.NewTranslation(center_x, center_y);
VertexSource.Ellipse e1 = new MatterHackers.Agg.VertexSource.Ellipse();
e1.init(0.0, 0.0, 110.0, 110.0, 64);
Transform.Affine mtx_g1 = Affine.NewIdentity();
mtx_g1 *= Affine.NewScaling(ini_scale, ini_scale);
mtx_g1 *= Affine.NewScaling(m_SaveData.m_scale, m_SaveData.m_scale);
mtx_g1 *= Affine.NewScaling(m_scale_x, m_scale_y);
mtx_g1 *= Affine.NewRotation(m_SaveData.m_angle);
mtx_g1 *= Affine.NewTranslation(m_SaveData.m_center_x, m_SaveData.m_center_y);
mtx_g1.invert();
RGBA_Bytes[] color_profile = new RGBA_Bytes[256]; // color_type is defined in pixel_formats.h
for (int i = 0; i < 256; i++)
{
color_profile[i] = new RGBA_Bytes(m_spline_r.spline()[i],
m_spline_g.spline()[i],
m_spline_b.spline()[i],
m_spline_a.spline()[i]);
}
VertexSourceApplyTransform t1 = new VertexSourceApplyTransform(e1, mtx1);
IGradient innerGradient = null;
switch (m_GradTypeRBox.SelectedIndex)
{
case 0:
innerGradient = new gradient_radial();
break;
case 1:
innerGradient = new gradient_diamond();
break;
case 2:
innerGradient = new gradient_x();
break;
case 3:
innerGradient = new gradient_xy();
break;
case 4:
innerGradient = new gradient_sqrt_xy();
break;
case 5:
innerGradient = new gradient_conic();
break;
}
IGradient outerGradient = null;
switch (m_GradWrapRBox.SelectedIndex)
{
case 0:
outerGradient = new gradient_reflect_adaptor(innerGradient);
break;
case 1:
outerGradient = new gradient_repeat_adaptor(innerGradient);
break;
//.........这里部分代码省略.........
开发者ID:annafeldman,项目名称:agg-sharp,代码行数:101,代码来源:gradients.cs
示例16: DoDrawAfterChildren
public void DoDrawAfterChildren(Graphics2D graphics2D)
{
RoundedRect track = new RoundedRect(GetTrackBounds(), TrackHeight / 2);
Vector2 ValuePrintPosition;
if (sliderAttachedTo.Orientation == Orientation.Horizontal)
{
ValuePrintPosition = new Vector2(sliderAttachedTo.TotalWidthInPixels / 2, -sliderAttachedTo.ThumbHeight - 12);
}
else
{
ValuePrintPosition = new Vector2(0, -sliderAttachedTo.ThumbHeight - 12);
}
// draw the track
graphics2D.Render(track, TrackColor);
// now do the thumb
RectangleDouble thumbBounds = sliderAttachedTo.GetThumbHitBounds();
RoundedRect thumbOutside = new RoundedRect(thumbBounds, sliderAttachedTo.ThumbWidth / 2);
graphics2D.Render(thumbOutside, RGBA_Floats.GetTweenColor(ThumbColor.GetAsRGBA_Floats(), RGBA_Floats.Black.GetAsRGBA_Floats(), .2).GetAsRGBA_Bytes());
thumbBounds.Inflate(-1);
RoundedRect thumbInside = new RoundedRect(thumbBounds, sliderAttachedTo.ThumbWidth / 2);
graphics2D.Render(thumbInside, ThumbColor);
}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:24,代码来源:Slider.cs
示例17: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
if (this.isHoverItem)
{
//buttonContainer.Visible = true;
}
else
{
//buttonContainer.Visible = false;
}
base.OnDraw(graphics2D);
if (this.isSelectedItem)
{
this.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
this.partLabel.TextColor = RGBA_Bytes.White;
this.selectionCheckBox.TextColor = RGBA_Bytes.White;
//RectangleDouble Bounds = LocalBounds;
//RoundedRect rectBorder = new RoundedRect(Bounds, 0);
//graphics2D.Render(new Stroke(rectBorder, 3), RGBA_Bytes.White);
}
else if (this.isHoverItem)
{
RectangleDouble Bounds = LocalBounds;
RoundedRect rectBorder = new RoundedRect(Bounds, 0);
this.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
this.partLabel.TextColor = RGBA_Bytes.White;
this.selectionCheckBox.TextColor = RGBA_Bytes.White;
graphics2D.Render(new Stroke(rectBorder, 3), ActiveTheme.Instance.PrimaryAccentColor);
}
else
{
this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 255);
this.partLabel.TextColor = RGBA_Bytes.Black;
}
}
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:43,代码来源:PrintHistoryListItem.cs
示例18: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
//Trigger thumbnail generation if neeeded
if (!thumbNailHasBeenCreated && !processingThumbnail)
{
if (SetImageFast())
{
thumbNailHasBeenCreated = true;
OnDoneRendering();
}
else
{
Task.Run(() => LoadOrCreateThumbnail());
}
}
if (this.FirstWidgetUnderMouse)
{
RoundedRect rectBorder = new RoundedRect(this.LocalBounds, 0);
//graphics2D.Render(rectBorder, this.HoverBackgroundColor);
}
graphics2D.Render(thumbnailImage, Width / 2 - thumbnailImage.Width / 2, Height / 2 - thumbnailImage.Height / 2);
base.OnDraw(graphics2D);
if (HoverBorderColor.Alpha0To255 > 0)
{
RectangleDouble Bounds = LocalBounds;
RoundedRect borderRect = new RoundedRect(this.LocalBounds, this.borderRadius);
Stroke strokeRect = new Stroke(borderRect, BorderWidth);
graphics2D.Render(strokeRect, HoverBorderColor);
}
}
开发者ID:unlimitedbacon,项目名称:MatterControl,代码行数:32,代码来源:PartThumbnailWidget.cs
示例19: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
base.OnDraw(graphics2D);
RoundedRect rect = new RoundedRect(LocalBounds, 0);
graphics2D.Render(rect, new RGBA_Bytes(OverlayColor, 50));
graphics2D.Render(new Stroke(rect, 3), OverlayColor);
}
开发者ID:ChapmanCPSC370,项目名称:MatterControl,代码行数:7,代码来源:SliceSettingsWidget.cs
示例20: OnDraw
public override void OnDraw(Graphics2D graphics2D)
{
ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());
if (!didInit)
{
didInit = true;
OnInitialize();
}
if (m_gamma.Value != m_old_gamma)
{
m_gamma_lut.SetGamma(m_gamma.Value);
ImageIO.LoadImageData("spheres.bmp", m_SourceImage);
//m_SourceImage.apply_gamma_dir(m_gamma_lut);
m_old_gamma = m_gamma.Value;
}
ImageBuffer pixf = new ImageBuffer();
switch (widgetsSubImage.BitDepth)
{
case 24:
pixf.Attach(widgetsSubImage, new BlenderBGR());
break;
case 32:
pixf.Attach(widgetsSubImage, new BlenderBGRA());
break;
default:
throw new NotImplementedException();
}
ImageClippingProxy clippingProxy = new ImageClippingProxy(pixf);
clippingProxy.clear(new RGBA_Floats(1, 1, 1));
if (m_trans_type.SelectedIndex < 2)
{
// For the affine parallelogram transformations we
// calculate the 4-th (implicit) point of the parallelogram
m_quad.SetXN(3, m_quad.GetXN(0) + (m_quad.GetXN(2) - m_quad.GetXN(1)));
m_quad.SetYN(3, m_quad.GetYN(0) + (m_quad.GetYN(2) - m_quad.GetYN(1)));
}
ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
// draw a background to show how the alpha is working
int RectWidth = 70;
int xoffset = 50;
int yoffset = 50;
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 7; j++)
{
if ((i + j) % 2 != 0)
{
VertexSource.RoundedRect rect = new VertexSource.RoundedRect(i * RectWidth + xoffset, j * RectWidth + yoffset,
(i + 1) * RectWidth + xoffset, (j + 1) * RectWidth + yoffset, 2);
rect.normalize_radius();
g_rasterizer.add_path(rect);
scanlineRenderer.RenderSolid(clippingProxy, g_rasterizer, g_scanline, new RGBA_Bytes(.2, .2, .2));
}
}
}
//--------------------------
// Render the "quad" tool and controls
g_rasterizer.add_path(m_quad);
scanlineRenderer.RenderSolid(clippingProxy, g_rasterizer, g_scanline, new RGBA_Bytes(0, 0.3, 0.5, 0.1));
// Prepare the polygon to rasterize. Here we need to fill
// the destination (transformed) polygon.
g_rasterizer.SetVectorClipBox(0, 0, Width, Height);
g_rasterizer.reset();
int b = 0;
g_rasterizer.move_to_d(m_quad.GetXN(0) - b, m_quad.GetYN(0) - b);
g_rasterizer.line_to_d(m_quad.GetXN(1) + b, m_quad.GetYN(1) - b);
g_rasterizer.line_to_d(m_quad.GetXN(2) + b, m_quad.GetYN(2) + b);
g_rasterizer.line_to_d(m_quad.GetXN(3) - b, m_quad.GetYN(3) + b);
//typedef agg::span_allocator<color_type> span_alloc_type;
span_allocator sa = new span_allocator();
image_filter_bilinear filter_kernel = new image_filter_bilinear();
ImageFilterLookUpTable filter = new ImageFilterLookUpTable(filter_kernel, true);
ImageBufferAccessorClamp source = new ImageBufferAccessorClamp(m_SourceImage);
stopwatch.Restart();
switch (m_trans_type.SelectedIndex)
{
case 0:
{
/*
agg::trans_affine tr(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);
typedef agg::span_interpolator_linear<agg::trans_affine> interpolator_type;
interpolator_type interpolator(tr);
//.........这里部分代码省略.........
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:101,代码来源:image_resample.cs
注:本文中的MatterHackers.Agg.VertexSource.RoundedRect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论