本文整理汇总了C#中RGBA_Bytes类的典型用法代码示例。如果您正苦于以下问题:C# RGBA_Bytes类的具体用法?C# RGBA_Bytes怎么用?C# RGBA_Bytes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RGBA_Bytes类属于命名空间,在下文中一共展示了RGBA_Bytes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenMenuContents
internal OpenMenuContents(ObservableCollection<MenuItem> MenuItems, GuiWidget widgetRelativeTo, Vector2 openOffset, Direction direction, RGBA_Bytes backgroundColor, RGBA_Bytes borderColor, int borderWidth, double maxHeight, bool alignToRightEdge)
{
this.MenuItems = new List<MenuItem>();
this.MenuItems.AddRange(MenuItems);
this.alignToRightEdge = alignToRightEdge;
this.openOffset = openOffset;
this.borderWidth = borderWidth;
this.borderColor = borderColor;
this.BackgroundColor = backgroundColor;
this.direction = direction;
this.widgetRelativeTo = widgetRelativeTo;
scrollingWindow = new ScrollableWidget(true);
{
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
foreach (MenuItem menu in MenuItems)
{
menu.ClearRemovedFlag();
topToBottom.AddChild(menu);
menu.DoClickFunction = AllowClickingItems;
}
topToBottom.HAnchor = UI.HAnchor.ParentLeft | UI.HAnchor.FitToChildren;
topToBottom.VAnchor = UI.VAnchor.ParentBottom;
Width = topToBottom.Width;
Height = topToBottom.Height;
scrollingWindow.AddChild(topToBottom);
}
scrollingWindow.HAnchor = HAnchor.ParentLeftRight;
scrollingWindow.VAnchor = VAnchor.ParentBottomTop;
if (maxHeight > 0 && Height > maxHeight)
{
MakeMenuHaveScroll(maxHeight);
}
AddChild(scrollingWindow);
LostFocus += new EventHandler(DropListItems_LostFocus);
GuiWidget topParent = widgetRelativeTo.Parent;
while (topParent.Parent != null)
{
// Regretably we don't know who it is that is the window that will actually think it is moving relative to its parent
// but we need to know anytime our widgetRelativeTo has been moved by any change, so we hook them all.
if (!widgetRefList.Contains(topParent))
{
widgetRefList.Add(topParent);
topParent.PositionChanged += new EventHandler(widgetRelativeTo_PositionChanged);
topParent.BoundsChanged += new EventHandler(widgetRelativeTo_PositionChanged);
}
topParent = topParent.Parent;
}
topParent.AddChild(this);
widgetRelativeTo_PositionChanged(widgetRelativeTo, null);
widgetRelativeTo.Closed += widgetRelativeTo_Closed;
}
示例2: 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())
{
pointSize *= GlobalPointSizeScaleRatio;
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);
}
示例3: BlendSolidVerticalSpan
//--------------------------------------------------------------------
public unsafe override void BlendSolidVerticalSpan(int x, int y,
uint len,
RGBA_Bytes c,
byte* covers)
{
PixelFormat.BlendSolidHorizontalSpan(y, x, len, c, covers);
}
示例4: TestGetHashCode
public void TestGetHashCode()
{
{
RGBA_Bytes a = new RGBA_Bytes(10, 11, 12);
RGBA_Bytes b = new RGBA_Bytes(10, 11, 12);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
{
RGBA_Floats a = new RGBA_Floats(10, 11, 12);
RGBA_Floats b = new RGBA_Floats(10, 11, 12);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
{
BorderDouble a = new BorderDouble(10, 11, 12, 13);
BorderDouble b = new BorderDouble(10, 11, 12, 13);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
{
Point2D a = new Point2D(10, 11);
Point2D b = new Point2D(10, 11);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
{
RectangleDouble a = new RectangleDouble(10, 11, 12, 13);
RectangleDouble b = new RectangleDouble(10, 11, 12, 13);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
{
RectangleInt a = new RectangleInt(10, 11, 12, 13);
RectangleInt b = new RectangleInt(10, 11, 12, 13);
Assert.IsTrue(a.GetHashCode() == b.GetHashCode());
}
}
示例5: CopyPixels
public void CopyPixels(byte[] buffer, int bufferOffset, RGBA_Bytes sourceColor, int count)
{
do
{
buffer[bufferOffset++] = sourceColor.red;
}
while (--count != 0);
}
示例6: span_gouraud_rgba
public span_gouraud_rgba(RGBA_Bytes c1,
RGBA_Bytes c2,
RGBA_Bytes c3,
double x1, double y1,
double x2, double y2,
double x3, double y3)
: this(c1, c2, c3, x1, y1, x2, y2, x3, y3, 0)
{
}
示例7: AddText
private void AddText(string tabText, GuiWidget widgetState, RGBA_Bytes textColor, RGBA_Bytes backgroundColor, double pointSize)
{
tabTitle = new TextWidget(tabText, pointSize: pointSize, textColor: textColor);
tabTitle.AutoExpandBoundsToText = true;
widgetState.AddChild(tabTitle);
widgetState.Selectable = false;
widgetState.SetBoundsToEncloseChildren();
widgetState.BackgroundColor = backgroundColor;
}
示例8: RadioButtonViewText
public RadioButtonViewText(string label)
{
labelTextWidget = new TextWidget(label, 12);
AddChild(labelTextWidget);
LocalBounds = GetLocalBounds();
inactiveColor = new RGBA_Bytes(0.0, 0.0, 0.0);
activeColor = new RGBA_Bytes(0.4, 0.0, 0.0);
}
示例9: BlendPixel
public void BlendPixel(byte[] pDestBuffer, int bufferOffset, RGBA_Bytes sourceColor)
{
int OneOverAlpha = base_mask - sourceColor.alpha;
unchecked
{
int y = (sourceColor.red * 77) + (sourceColor.green * 151) + (sourceColor.blue * 28);
int gray = (y >> 8);
gray = (byte)((((gray - (int)(pDestBuffer[bufferOffset])) * sourceColor.alpha) + ((int)(pDestBuffer[bufferOffset]) << base_shift)) >> base_shift);
pDestBuffer[bufferOffset] = (byte)gray;
}
}
示例10: CopyPixels
public void CopyPixels(byte[] pDestBuffer, int bufferOffset, RGBA_Bytes sourceColor, int count)
{
do
{
int y = (sourceColor.red * 77) + (sourceColor.green * 151) + (sourceColor.blue * 28);
int gray = (y >> 8);
pDestBuffer[bufferOffset] = (byte)gray;
bufferOffset += bytesBetweenPixelsInclusive;
}
while (--count != 0);
}
示例11: createState
private GuiWidget createState(string word, double width, double height, ref RGBA_Bytes backgroundColor, ref RGBA_Bytes interiorColor, ref RGBA_Bytes thumbColor, ref RGBA_Bytes textColor)
{
TextWidget text = new TextWidget(word, pointSize: 10, textColor: textColor);
text.VAnchor = VAnchor.ParentCenter;
SwitchView switchGraphics = new SwitchView(width, height, word == onText, backgroundColor, interiorColor, thumbColor, textColor);
switchGraphics.VAnchor = VAnchor.ParentCenter;
switchGraphics.Margin = new BorderDouble(5, 0, 0, 0);
GuiWidget switchNormalToPressed = new FlowLayoutWidget(FlowDirection.LeftToRight, text, switchGraphics);
return switchNormalToPressed;
}
示例12: span_gouraud
//--------------------------------------------------------------------
public span_gouraud(RGBA_Bytes c1,
RGBA_Bytes c2,
RGBA_Bytes c3,
double x1, double y1,
double x2, double y2,
double x3, double y3,
double d)
{
m_vertex = (0);
colors(c1, c2, c3);
triangle(x1, y1, x2, y2, x3, y3, d);
}
示例13: SwitchView
internal SwitchView(double width, double height, bool startValue,
RGBA_Bytes backgroundColor, RGBA_Bytes interiorColor, RGBA_Bytes thumbColor, RGBA_Bytes exteriorColor)
{
this.startValue = startValue;
switchWidth = width;
switchHeight = height;
thumbHeight = height;
thumbWidth = width / 4;
InteriorColor = interiorColor;
ExteriorColor = exteriorColor;
ThumbColor = thumbColor;
LocalBounds = new RectangleDouble(0, 0, width, height);
}
示例14: DynamicDropDownMenu
public DynamicDropDownMenu(GuiWidget buttonView, Direction direction = Direction.Down, double pointSize = 12)
: base(buttonView, direction, pointSize)
{
menuItems = new TupleList<string, Func<bool>>();
TextColor = RGBA_Bytes.Black;
NormalArrowColor = RGBA_Bytes.Black;
HoverArrowColor = RGBA_Bytes.Black;
BorderWidth = 1;
BorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200);
this.SelectionChanged += new EventHandler(AltChoices_SelectionChanged);
}
示例15: SimpleTextTabWidget
public SimpleTextTabWidget(TabPage tabPageControledByTab, string internalTabName, double pointSize,
RGBA_Bytes selectedTextColor, RGBA_Bytes selectedBackgroundColor,
RGBA_Bytes normalTextColor, RGBA_Bytes normalBackgroundColor)
: base(internalTabName, new GuiWidget(), new GuiWidget(), new GuiWidget(), tabPageControledByTab)
{
AddText(tabPageControledByTab.Text, selectedWidget, selectedTextColor, selectedBackgroundColor, pointSize);
AddText(tabPageControledByTab.Text, normalWidget, normalTextColor, normalBackgroundColor, pointSize);
//hoverWidget;
tabPageControledByTab.TextChanged += new EventHandler(tabPageControledByTab_TextChanged);
SetBoundsToEncloseChildren();
}