本文整理汇总了C#中System.Drawing.Color.ToUColor方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToUColor方法的具体用法?C# Color.ToUColor怎么用?C# Color.ToUColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Color
的用法示例。
在下文中一共展示了Color.ToUColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearColor
public void ClearColor(Color c, bool apply = true)
{
var colors = new UnityEngine.Color32[Width * Height];
for (int i = 0; i < colors.Length; i++)
colors[i] = c.ToUColor();
uTexture.SetPixels32(colors);
if (apply) Apply();
}
示例2: SetPixel
public void SetPixel(int x, int y, Color color)
{
uTexture.SetPixel(x, uTexture.height - y - 1, color.ToUColor());
}
示例3: FillQuad
public void FillQuad(Color color, PointF p1, PointF p2, PointF p3, PointF p4)
{
GL.Begin(GL.QUADS);
GL.Color(color.ToUColor());
GL.Vertex3(p1.X, p1.Y, 0);
GL.Vertex3(p2.X, p2.Y, 0);
GL.Vertex3(p3.X, p3.Y, 0);
GL.Vertex3(p4.X, p4.Y, 0);
GL.End();
}
示例4: DrawTexture
public void DrawTexture(Texture texture, float x, float y, float width, float height, Color color, float angle, PointF pivot)
{
if (texture == null) return;
if (Control != null)
Control.Batches++;
FillRate += width * height;
GUI.color = color.ToUColor();
if (!_group)
{
if (Control != null)
{
var c_position = Control.PointToScreen(Point.Zero);
x += c_position.X;
y += c_position.Y;
}
if (angle != 0)
{
Matrix4x4 matrixBackup = GUI.matrix;
GUIUtility.RotateAroundPivot(angle, new Vector2(x + pivot.X, y + pivot.Y));
GUI.DrawTexture(new Rect(x, y, width, height), texture);
GUI.matrix = matrixBackup;
}
else
GUI.DrawTexture(new Rect(x, y, width, height), texture);
}
else
{
if (Control != null)
{
var c_position = Control.PointToScreen(Point.Zero);
var g_position = _groupControlLast.PointToScreen(Point.Zero);
x += c_position.X - g_position.X;
y += c_position.Y - g_position.Y;
}
if (angle != 0)
{
Matrix4x4 matrixBackup = GUI.matrix;
GUIUtility.RotateAroundPivot(angle, new Vector2(x + pivot.X, y + pivot.Y));
GUI.DrawTexture(new Rect(x, y, width, height), texture);
GUI.matrix = matrixBackup;
}
else
GUI.DrawTexture(new Rect(x, y, width, height), texture);
}
}
示例5: DrawString
public void DrawString(string s, Font font, Color color, float x, float y, float width, float height, ContentAlignment alignment)
{
if (NoStrings) return;
if (color.A <= 0) return;
if (string.IsNullOrEmpty(s)) return;
if (Control != null)
Control.Batches += 1;
FillRate += width * height;
GUI.skin.label.alignment = TextAnchor.UpperLeft;
switch (alignment)
{
case ContentAlignment.BottomCenter:
GUI.skin.label.alignment = TextAnchor.LowerCenter;
break;
case ContentAlignment.BottomLeft:
GUI.skin.label.alignment = TextAnchor.LowerLeft;
break;
case ContentAlignment.BottomRight:
GUI.skin.label.alignment = TextAnchor.LowerRight;
break;
case ContentAlignment.MiddleCenter:
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
break;
case ContentAlignment.MiddleLeft:
GUI.skin.label.alignment = TextAnchor.MiddleLeft;
break;
case ContentAlignment.MiddleRight:
GUI.skin.label.alignment = TextAnchor.MiddleRight;
break;
case ContentAlignment.TopCenter:
GUI.skin.label.alignment = TextAnchor.UpperCenter;
break;
case ContentAlignment.TopLeft:
GUI.skin.label.alignment = TextAnchor.UpperLeft;
break;
case ContentAlignment.TopRight:
GUI.skin.label.alignment = TextAnchor.UpperRight;
break;
}
int guiSkinFontSizeBuffer = GUI_SetLabelFont(font);
GUI.color = color.ToUColor();
if (!_group)
{
Point c_position = Point.Empty;
if (Control != null)
c_position = Control.PointToScreen(Point.Zero);
GUI.Label(new Rect(c_position.X + x, c_position.Y + y, width, height), s);
}
else
{
//Point c_position = Point.Empty;
//if (Control != null)
// c_position = Control.PointToScreen(Point.Zero);
//var g_position = _groupControlLast.PointToScreen(Point.Zero);
//var position = c_position - g_position + new PointF(x, y);
GUI.Label(new Rect(x, y, width, height), s);
}
GUI.skin.label.fontSize = guiSkinFontSizeBuffer;
}
示例6: FillRectangle
public void FillRectangle(Color color, float x, float y, float width, float height)
{
if (NoFill) return;
if (color.A <= 0) return;
if (Control != null)
Control.Batches += 1;
FillRate += width * height;
GUI.color = color.ToUColor();
if (!_group)
{
Point c_position = Point.Empty;
if (Control != null)
c_position = Control.PointToScreen(Point.Zero);
GUI.DrawTexture(new Rect(c_position.X + x, c_position.Y + y, width, height), System.Windows.Forms.ApplicationBehaviour.DefaultSprite);
}
else
{
Point c_position = Point.Empty;
if (Control != null)
c_position = Control.PointToScreen(Point.Zero);
var g_position = _groupControlLast.PointToScreen(Point.Zero);
x += c_position.X - g_position.X;
y += c_position.Y - g_position.Y;
GUI.DrawTexture(new Rect(x, y, width, height), System.Windows.Forms.ApplicationBehaviour.DefaultSprite);
//UnityEngine.Graphics.DrawTexture(new Rect(c_position.X - g_position.X + x, c_position.Y - g_position.Y + y, width, height), System.Windows.Forms.Application.DefaultSprite, new Rect(), 0, 0, 0, 0, brush.Color.ToUColor(), DefaultMaterial);
}
}