本文整理汇总了C#中Color4类的典型用法代码示例。如果您正苦于以下问题:C# Color4类的具体用法?C# Color4怎么用?C# Color4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color4类属于命名空间,在下文中一共展示了Color4类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Vertex3
/// <summary>
/// Constructor for the Vertex3 class, takes float variables for the x y and z positions, as well as a color.
/// </summary>
/// <param name="x">The float representation of the Vertex3's x position.</param>
/// <param name="y">The float representation of the Vertex3's y position.</param>
/// <param name="z">The float representation of the Vertex3's z position.</param>
/// <param name="color">The color of this particular Vertex3.</param>
public Vertex3(float x, float y, float z, Color4 color)
{
this.x = x;
this.y = y;
this.z = z;
this.myColor = color;
}
开发者ID:Zordonia,项目名称:AdvisIXAccel,代码行数:14,代码来源:Vertex3.cs
示例2: DrawRect
public static void DrawRect(float x, float y, float z, float width, float height, int lineWidth, Color4 color)
{
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
GL.LineWidth(lineWidth);
FillRect(x, y, z, width, height, color);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
}
开发者ID:jikoriko,项目名称:OpentkEngine,代码行数:7,代码来源:Graphics.cs
示例3: BlendState
/// <summary>
/// Initializes a new instance of the <see cref="BlendState" /> class.
/// </summary>
/// <param name="device">The device local.</param>
/// <param name="description">The description.</param>
/// <param name="blendFactor">The blend factor.</param>
/// <param name="mask">The mask.</param>
private BlendState(GraphicsDevice device, BlendStateDescription description, Color4 blendFactor, int mask) : base(device)
{
Description = description;
BlendFactor = blendFactor;
MultiSampleMask = mask;
Initialize(new Direct3D11.BlendState(GraphicsDevice, Description));
}
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:14,代码来源:BlendState.cs
示例4: BasicVec4
public BasicVec4(Color4 v)
{
x = v.R;
y = v.G;
z = v.B;
w = v.A;
}
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:7,代码来源:ModelViewer.cs
示例5: BooleanIndicator
// Main constructor:
public BooleanIndicator(RenderSet render_set, double x, double y)
: base(render_set, x, y, 1.0, 1.0, null, Texture.Get("sprite_indicator"))
{
State = false;
_Color = new Color4(Color.SkyBlue);
_NextLayer = new LayeredSprite(render_set, x, y, 1.0, 1.0, null, Texture.Get ("sprite_indicator_gloss"));
}
开发者ID:qwook,项目名称:hungry,代码行数:8,代码来源:BooleanIndicator.cs
示例6: GetData
public override Color4[] GetData(int subresource)
{
var data = _subresources[subresource].Data;
var result = new Color4[data.Length];
Utilities.Copy(data, result);
return result;
}
开发者ID:modulexcite,项目名称:rasterizr,代码行数:7,代码来源:Texture3D.cs
示例7: Material
public Material()
{
Ambient = new Color4(1, 1, 1);
Diffuse = new Color4(1, 1, 1);
Specular = new Color4(1, 1, 1);
SpecularExponent = 0.1f;
}
开发者ID:lvarvel,项目名称:aura,代码行数:7,代码来源:Material.cs
示例8: Initialize
/// <summary>
/// Initializes with the specified colors.
/// </summary>
/// <param name="colors">The colors.</param>
/// <msdn-id>ee719750</msdn-id>
/// <unmanaged>HRESULT IWICPalette::InitializeCustom([In, Buffer] void* pColors,[In] unsigned int cCount)</unmanaged>
/// <unmanaged-short>IWICPalette::InitializeCustom</unmanaged-short>
public void Initialize(Color4[] colors)
{
var rawColors = new Color[colors.Length];
for (int i = 0; i < rawColors.Length; i++)
rawColors[i] = (Color)colors[i];
Initialize(rawColors);
}
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:14,代码来源:Palette.cs
示例9: Cube
/// <summary>
/// 立方体を作成する
/// </summary>
/// <param name="_position">中心座標</param>
/// <param name="_size">1辺の長さ</param>
/// <param name="_color">表示色</param>
public Cube(Vector3 _position, float _size, Color4 _color)
{
// 各パラメーターを設定
this.position = _position;
this.size = _size;
this.color = _color;
}
开发者ID:aokomoriuta,项目名称:StudiesOfOpenTK,代码行数:13,代码来源:Cube.cs
示例10: Cube
/// <summary>
/// 立方体を作成する
/// </summary>
/// <param name="_size">1辺の長さ</param>
/// <param name="_color">表示色</param>
public Cube(float _size, Color4 _color)
{
// 各パラメーターを設定
this.position = new Vector3();
this.size = _size;
this.color = _color;
}
开发者ID:aokomoriuta,项目名称:StudiesOfOpenTK,代码行数:12,代码来源:Cube.cs
示例11: Draw
/// <summary>
/// Draws this shape using the given scale and offset.
/// </summary>
public void Draw(Render Render, Color4 Color, Vector Offset, double Scale)
{
Render.Vertex(Destination.TopLeft * Scale + Offset, Source.TopLeft, Color);
Render.Vertex(Destination.BottomLeft * Scale + Offset, Source.BottomLeft, Color);
Render.Vertex(Destination.BottomRight * Scale + Offset, Source.BottomRight, Color);
Render.Vertex(Destination.TopRight * Scale + Offset, Source.TopRight, Color);
}
开发者ID:dzamkov,项目名称:Hailstone,代码行数:10,代码来源:Render.cs
示例12: EnvLight
/// <summary>
/// Creates instance of EnvLight
/// </summary>
public EnvLight ()
{
Position = Vector3.Zero;
RadiusInner = 0;
RadiusOuter = 1;
Intensity = new Color4(1,1,1,0);
}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:10,代码来源:EnvLight.cs
示例13: Vertex
public Vertex(Vector4 position, Color4 color, Vector2 textureCoordinate)
{
Position = position;
Color = color;
TextureCoordinate = textureCoordinate;
_pad0 = Vector2.Zero; // important to align the vertex to a 16 byte boundary
}
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:7,代码来源:Program.cs
示例14: ColorBox
/// <summary>
/// position is top left of box.
/// </summary>
/// <param name="position"></param>
/// <param name="size"></param>
/// <param name="color"></param>
public ColorBox(Vector2 position, Vector2 size, Color4 color)
{
this.position = position;
this.size = size;
model = Matrix4.CreateTranslation(position.X, position.Y, 0);
Color = color;
float[] vertices = new float[]
{
0, 0,
0, size.Y,
size.X, 0,
size.X, size.Y
};
uint[] indices = new uint[]
{
0, 1, 2, 3
};
VBO vert = new VBO(), ind = new VBO();
vert.SetData(ref vertices, BufferUsageHint.StaticDraw);
ind.SetData(ref indices, BufferUsageHint.StaticDraw);
bufSet = new BufferSet();
bufSet.VertexBuffer = vert;
bufSet.IndexBuffer = ind;
bufSet.VertexSize = 2;
bufSet.DrawMode = BeginMode.TriangleStrip;
bufSet.SetDrawState(DrawStates.Vertex);
}
开发者ID:Robmaister,项目名称:RoversSpirit,代码行数:37,代码来源:ColorBox.cs
示例15: Pixel
public Pixel(Color4 color)
: this()
{
RedF = color.R;
GreenF = color.G;
BlueF = color.B;
}
开发者ID:NightmareX1337,项目名称:ULF,代码行数:7,代码来源:GraphicsManager.cs
示例16: TextSprite
public TextSprite(Loc2D loc, string text, Color4 color)
{
EffectLoc = loc;
Text = text;
ActionDone = false;
Color = color;
}
开发者ID:blastboy,项目名称:PMD-Toolkit,代码行数:7,代码来源:TextSprite.cs
示例17: DrawTexture
/// <summary>
/// The base DrawTexture function.
/// </summary>
/// <param name="texture">The texture to draw</param>
/// <param name="destRectangle">The destination rectangle, in pixel space, where the texture is drawn</param>
/// <param name="sourceRectangle">The source within the texture, values must be between [0-1]</param>
/// <param name="color">The color to be applied</param>
/// <param name="rotation">The rotation, in degrees to be applied</param>
/// <param name="origin">The origin of the rotation, this value is in pixel space referenced from the top left of destRectangle</param>
public static void DrawTexture(Texture2D texture, RectangleF destRectangle, RectangleF sourceRectangle, Color4 color, float rotation, Vector2 origin)
{
RectangleF atlasRect = texture.TextureCoordRect;
RectangleF sourceInAtlasCoords = new RectangleF(atlasRect.Left + atlasRect.Width * sourceRectangle.Left, atlasRect.Top + atlasRect.Height * sourceRectangle.Top,
atlasRect.Width * sourceRectangle.Width, atlasRect.Height * sourceRectangle.Height);
GL.Enable(EnableCap.Texture2D);
GL.PushMatrix();
GL.Translate(destRectangle.Left + origin.X, destRectangle.Top + origin.Y, 0);
GL.Rotate(rotation, 0.0f, 0.0f, 1.0f);
GL.Translate(-origin.X, -origin.Y, 0);
GL.BindTexture(TextureTarget.Texture2D, texture.ID);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
float width = destRectangle.Width;
float height = destRectangle.Height;
GL.Color4(color);
GL.Begin(PrimitiveType.Quads);
GL.TexCoord2(sourceInAtlasCoords.Left, sourceInAtlasCoords.Top);
GL.Vertex2(0.0f, 0.0f);
GL.TexCoord2(sourceInAtlasCoords.Right, sourceInAtlasCoords.Top);
GL.Vertex2(width, 0.0f);
GL.TexCoord2(sourceInAtlasCoords.Right, sourceInAtlasCoords.Bottom);
GL.Vertex2(width, height);
GL.TexCoord2(sourceInAtlasCoords.Left, sourceInAtlasCoords.Bottom);
GL.Vertex2(0.0f, height);
GL.End();
GL.PopMatrix();
GL.Disable(EnableCap.Texture2D);
}
开发者ID:JeanmarcBell,项目名称:BGEngine,代码行数:43,代码来源:DrawHelper.cs
示例18: OutputParticle
/// <summary>
/// 粒子を作成する
/// </summary>
/// <param name="_x">中心座標</param>
/// <param name="_d">直径</param>
/// <param name="_color">表示色</param>
public OutputParticle(Vector3 _x, float _d, Color4 _color)
{
// 各パラメーターを設定
this.X = _x;
this.d = _d;
this.color = _color;
}
开发者ID:aokomoriuta,项目名称:StudiesOfOpenTK,代码行数:13,代码来源:OutputParticle.cs
示例19: CreateRadialGradientBrush
private RadialGradientBrush CreateRadialGradientBrush(DeviceContext context, float width, float height, Color4 color1, Color4 color2, float color1Position, float color2Position)
{
GradientStop[] stops = new GradientStop[2];
//stops[0] = new GradientStop() { Color = new Color4(0.85f, 0, 0, 1.0f), Position = 0.0f };
//stops[1] = new GradientStop() { Color = new Color4(0.22f, 0, 0, 1.0f), Position = 1.0f };
stops[0] = new GradientStop() { Color = color1, Position = color1Position };
stops[1] = new GradientStop() { Color = color2, Position = color2Position };
GradientStopCollection gsc = new GradientStopCollection(context, stops, ExtendMode.Clamp);
RadialGradientBrush brush = new RadialGradientBrush(
context,
new RadialGradientBrushProperties()
{
RadiusX = width / 1.3f,
RadiusY = height / 1.3f,
Center = new Vector2(width / 2.0f, height / 2.0f),
GradientOriginOffset = new Vector2(0, 0)
},
gsc);
return brush;
}
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:26,代码来源:DxRenderer.BackgroundComposer.Shapes.cs
示例20: FromValues
private static ColorRamp FromValues(string name, params OpenTK.Graphics.Color4[] colors)
{
var sizeX = 2;
var sizeY = 1;
var data = new Color4[sizeY, sizeX];
//var dX = sizeX / (float)colors.Length;
//var dY = sizeY / (float)colors.Length;
// var colorIndex = 0;
for (int i = 0; i < sizeY; i++)
{
for (int j = 0; j < sizeX; j++)
{
//var t = dX * (j / colors.Length);
var cindex = j % colors.Length;
data[i, j] = colors[cindex];
}
}
var texture = new DataTexture<Color4>
{
Name = "color-ramp-" + name,
InternalFormat = PixelInternalFormat.Rgb,
Data2D = data,
Params = new TextureBase.Parameters
{
GenerateMipmap = false,
MinFilter = TextureMinFilter.Linear,
MagFilter = TextureMagFilter.Linear
}};
return new ColorRamp(name, texture);
}
开发者ID:smalld,项目名称:particle_system,代码行数:34,代码来源:ColorRamp.cs
注:本文中的Color4类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论