本文整理汇总了C#中MatterHackers.Agg.RGBA_Bytes类的典型用法代码示例。如果您正苦于以下问题:C# RGBA_Bytes类的具体用法?C# RGBA_Bytes怎么用?C# RGBA_Bytes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RGBA_Bytes类属于MatterHackers.Agg命名空间,在下文中一共展示了RGBA_Bytes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SliceSelectorWidget
private int presetIndex; //For multiple materials
public SliceSelectorWidget(string label, RGBA_Bytes accentColor, string tag = null, int presetIndex = 1)
: base(FlowDirection.TopToBottom)
{
this.presetIndex = presetIndex;
this.filterLabel = label;
if (tag == null)
{
this.filterTag = label.ToLower();
}
else
{
this.filterTag = tag;
}
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5);
accentBar.BackgroundColor = accentColor;
accentBar.HAnchor = HAnchor.ParentLeftRight;
TextWidget labelText = new TextWidget(LocalizedString.Get(label).ToUpper());
labelText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
labelText.HAnchor = Agg.UI.HAnchor.ParentCenter;
labelText.Margin = new BorderDouble(0, 3, 0, 6);
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}
示例2: 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());
}
示例3: HistoryData
internal HistoryData(int Capacity, IColorType Color)
{
m_Color = Color.GetAsRGBA_Bytes();
m_Capacity = Capacity;
m_Data = new TwoSidedStack<double>();
Reset();
}
示例4: HistoryData
internal HistoryData(int capacity, IColorType lineColor)
{
this.lineColor = lineColor.GetAsRGBA_Bytes();
this.capacity = capacity;
data = new List<double>();
Reset();
}
示例5: PresetSelectorWidget
private int extruderIndex; //For multiple materials
public PresetSelectorWidget(string label, RGBA_Bytes accentColor, string tag, int extruderIndex)
: base(FlowDirection.TopToBottom)
{
this.extruderIndex = extruderIndex;
this.filterLabel = label;
this.filterTag = (tag == null) ? label.ToLower() : tag;
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5)
{
BackgroundColor = accentColor,
HAnchor = HAnchor.ParentLeftRight
};
TextWidget labelText = new TextWidget(label.Localize().ToUpper())
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
HAnchor = Agg.UI.HAnchor.ParentCenter,
Margin = new BorderDouble(0, 3, 0, 6)
};
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}
示例6: ControlButtonViewBase
public ControlButtonViewBase(string label,
double width,
double height,
double textHeight,
double borderWidth,
double borderRadius,
double padding,
RGBA_Bytes textColor,
RGBA_Bytes fillColor,
RGBA_Bytes borderColor)
: base(width, height)
{
this.borderRadius = borderRadius;
this.borderWidth = borderWidth;
this.fillColor = fillColor;
this.borderColor = borderColor;
this.padding = padding;
TextWidget buttonText = new TextWidget(label, textHeight);
buttonText.VAnchor = VAnchor.ParentCenter;
buttonText.HAnchor = HAnchor.ParentCenter;
buttonText.TextColor = textColor;
//this.AnchorAll();
this.AddChild(buttonText);
}
示例7: SetDisplayAttributes
private void SetDisplayAttributes()
{
this.separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);
this.Margin = new BorderDouble(2, 4, 2, 0);
// colors
this.textImageButtonFactory.normalFillColor = RGBA_Bytes.Transparent;
this.textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
this.textImageButtonFactory.normalTextColor = ActiveTheme.Instance.SecondaryTextColor;
this.textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
this.textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
this.textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
this.textImageButtonFactory.disabledFillColor = RGBA_Bytes.Transparent;
this.textImageButtonFactory.disabledBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);
this.textImageButtonFactory.disabledTextColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);
// other settings
this.textImageButtonFactory.FixedHeight = TallButtonHeight;
this.textImageButtonFactory.fontSize = 11;
this.textImageButtonFactory.borderWidth = 1;
this.linkButtonFactory.fontSize = 11;
}
示例8: ViewControls2D
public ViewControls2D()
{
if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen)
{
buttonHeight = 40;
}
else
{
buttonHeight = 20;
}
TextImageButtonFactory iconTextImageButtonFactory = new TextImageButtonFactory();
iconTextImageButtonFactory.AllowThemeToAdjustImage = false;
iconTextImageButtonFactory.checkedBorderColor = RGBA_Bytes.White;
BackgroundColor = new RGBA_Bytes(0, 0, 0, 120);
iconTextImageButtonFactory.FixedHeight = buttonHeight;
iconTextImageButtonFactory.FixedWidth = buttonHeight;
string translateIconPath = Path.Combine("ViewTransformControls", "translate.png");
translateButton = iconTextImageButtonFactory.GenerateRadioButton("", translateIconPath);
translateButton.Margin = new BorderDouble(3);
AddChild(translateButton);
string scaleIconPath = Path.Combine("ViewTransformControls", "scale.png");
scaleButton = iconTextImageButtonFactory.GenerateRadioButton("", scaleIconPath);
scaleButton.Margin = new BorderDouble(3);
AddChild(scaleButton);
Margin = new BorderDouble(5);
HAnchor |= Agg.UI.HAnchor.ParentLeft;
VAnchor = Agg.UI.VAnchor.ParentTop;
translateButton.Checked = true;
}
示例9: RenderSolidSingleScanLine
protected override void RenderSolidSingleScanLine(IImageByte destImage, IScanlineCache scanLineCache, RGBA_Bytes color)
{
int y = scanLineCache.y();
int num_spans = scanLineCache.num_spans();
ScanlineSpan scanlineSpan = scanLineCache.begin();
byte[] ManagedCoversArray = scanLineCache.GetCovers();
for (; ; )
{
int x = scanlineSpan.x;
int num_pix = scanlineSpan.len;
int coverIndex = scanlineSpan.cover_index;
do
{
int a = (ManagedCoversArray[coverIndex++] * color.Alpha0To255) >> 8;
m_square.draw(destImage.NewGraphics2D().Rasterizer, m_sl, destImage,
new RGBA_Bytes(color.Red0To255, color.Green0To255, color.Blue0To255, a),
x, y);
++x;
}
while (--num_pix > 0);
if (--num_spans == 0) break;
scanlineSpan = scanLineCache.GetNextScanlineSpan();
}
}
示例10: PanelSeparator
public PanelSeparator()
: base(4, 1)
{
AddHandlers();
defaultBackgroundColor = new RGBA_Bytes(200, 200, 200);
hoverBackgroundColor = new RGBA_Bytes(100, 100, 100);
Agg.Image.ImageBuffer arrowImage = new Agg.Image.ImageBuffer();
ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "icon_arrow_left_16x16.png"), arrowImage);
arrowIndicator = new ImageWidget(arrowImage);
arrowIndicator.HAnchor = Agg.UI.HAnchor.ParentCenter;
arrowIndicator.VAnchor = Agg.UI.VAnchor.ParentCenter;
arrowIndicator.Visible = true;
this.AddChild(arrowIndicator);
this.Hidden = false;
this.BackgroundColor = defaultBackgroundColor;
this.VAnchor = VAnchor.ParentBottomTop;
this.Margin = new BorderDouble(8, 0);
this.Cursor = Cursors.Hand;
SetDisplayState();
}
示例11: TextWidget
public TextWidget(string text, double x = 0, double y = 0, double pointSize = 12, Justification justification = Justification.Left, RGBA_Bytes textColor = new RGBA_Bytes(), bool ellipsisIfClipped = true, bool underline = false, RGBA_Bytes backgroundColor = new RGBA_Bytes())
{
Selectable = false;
DoubleBuffer = DoubleBufferDefault;
AutoExpandBoundsToText = false;
EllipsisIfClipped = ellipsisIfClipped;
OriginRelativeParent = new Vector2(x, y);
this.textColor = textColor;
if (this.textColor.Alpha0To255 == 0)
{
// we assume it is the default if alpha 0. Also there is no reason to make a text color of this as it will draw nothing.
this.textColor = RGBA_Bytes.Black;
}
if (backgroundColor.Alpha0To255 != 0)
{
BackgroundColor = backgroundColor;
}
base.Text = text;
StyledTypeFace typeFaceStyle = new StyledTypeFace(LiberationSansFont.Instance, pointSize, underline);
printer = new TypeFacePrinter(text, typeFaceStyle, justification: justification);
LocalBounds = printer.LocalBounds;
MinimumSize = new Vector2(LocalBounds.Width, LocalBounds.Height);
}
示例12: CopyPixels
public void CopyPixels(byte[] buffer, int bufferOffset, RGBA_Bytes sourceColor, int count)
{
do
{
buffer[bufferOffset++] = sourceColor.red;
}
while (--count != 0);
}
示例13: CreateWhiteToColor
public static ImageBuffer CreateWhiteToColor(ImageBuffer normalImage, RGBA_Bytes color)
{
ImageBuffer destImage = new ImageBuffer(normalImage.Width, normalImage.Height, 32, new BlenderBGRA());
DoWhiteToColor(destImage, normalImage, color);
return destImage;
}
示例14: RenderFeatureExtrusion
public RenderFeatureExtrusion(Vector3 start, Vector3 end, int extruderIndex, double travelSpeed, double totalExtrusionMm, double filamentDiameterMm, double layerHeight, RGBA_Bytes color)
: base(start, end, extruderIndex, travelSpeed)
{
this.color = color;
double fillamentRadius = filamentDiameterMm / 2;
double areaSquareMm = (fillamentRadius * fillamentRadius) * Math.PI;
this.extrusionVolumeMm3 = (float)(areaSquareMm * totalExtrusionMm);
this.layerHeight = (float)layerHeight;
}
示例15: HeightValueDisplay
public HeightValueDisplay(View3DWidget view3DWidget)
{
BackgroundColor = new RGBA_Bytes(RGBA_Bytes.White, 150);
this.view3DWidget = view3DWidget;
view3DWidget.meshViewerWidget.AddChild(this);
VAnchor = VAnchor.FitToChildren;
HAnchor = HAnchor.FitToChildren;
MeshViewerToDrawWith.DrawAfter += new DrawEventHandler(MeshViewerToDrawWith_Draw);
}