本文整理汇总了C#中Color.GetRed方法的典型用法代码示例。如果您正苦于以下问题:C# Color.GetRed方法的具体用法?C# Color.GetRed怎么用?C# Color.GetRed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color.GetRed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Color
/**
* Color
*
* @param newcolor
*/
public Color(Color newcolor)
{
red = newcolor.GetRed();
green = newcolor.GetGreen();
blue = newcolor.GetBlue();
}
示例2: Write
/**
* Write
*
* @param brightness
* @param x
* @param y
* @param color
*/
public void Write(double brightness, int x, int y, Color color)
{
color.Scale(brightness);
double max = color.FindMax();
if(max > 1.0f)
{
color.Scale(1.0f / max);
}
SetRed(x, y, color.GetRed() * 255);
SetGreen(x, y, color.GetGreen() * 255);
SetBlue(x, y, color.GetBlue() * 255);
//System.out.println( "Set "+x+","+y+"="+Pixels[y * GetWidth() + x] );
}
示例3: SetBackgroundColor
/**
* Background color
*/
public void SetBackgroundColor(Color color){
EscherOptRecord opt = (EscherOptRecord)Shape.GetEscherChild(shape.GetSpContainer(), EscherOptRecord.RECORD_ID);
if (color == null) {
Shape.SetEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, -1);
}
else {
int rgb = new Color(color.GetBlue(), color.GetGreen(), color.GetRed(), 0).GetRGB();
Shape.SetEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, rgb);
}
}
示例4: Shade
public virtual Color Shade(Vector3D p, Vector3D n, Vector3D v, ArrayList lights,
ArrayList objects, Color bgnd)
{
IEnumerator lightSources = lights.GetEnumerator();
float r = 0;
float g = 0;
float b = 0;
while (lightSources.MoveNext())
{
Light light = (Light)lightSources.Current;
if (light.lightType == Light.AMBIENT)
{
r += ka * ir * light.ir;
g += ka * ig * light.ig;
b += ka * ib * light.ib;
}
else
{
Vector3D l;
if (light.lightType == Light.POINT)
{
l = new Vector3D(light.lvec.x - p.x, light.lvec.y - p.y, light.lvec.z - p.z);
l.Normalize();
}
else
{
l = new Vector3D(-light.lvec.x, -light.lvec.y, -light.lvec.z);
}
// Check if the surface point is in shadow
Vector3D poffset = new Vector3D(p.x + TINY * l.x, p.y + TINY * l.y, p.z + TINY *
l.z);
Ray shadowRay = new Ray(poffset, l);
if (shadowRay.Trace(objects))
{
break;
}
float lambert = Vector3D.Dot(n, l);
if (lambert > 0)
{
if (kd > 0)
{
float diffuse = kd * lambert;
r += diffuse * ir * light.ir;
g += diffuse * ig * light.ig;
b += diffuse * ib * light.ib;
}
if (ks > 0)
{
lambert *= 2;
float spec = v.Dot(lambert * n.x - l.x, lambert * n.y - l.y, lambert * n.z - l.z);
if (spec > 0)
{
spec = ks * ((float)Math.Pow((double)spec, (double)ns));
r += spec * light.ir;
g += spec * light.ig;
b += spec * light.ib;
}
}
}
}
}
// Compute illumination due to reflection
if (kr > 0)
{
float t = v.Dot(n);
if (t > 0)
{
t *= 2;
Vector3D reflect = new Vector3D(t * n.x - v.x, t * n.y - v.y, t * n.z - v.z);
Vector3D poffset = new Vector3D(p.x + TINY * reflect.x, p.y + TINY * reflect.y, p
.z + TINY * reflect.z);
Ray reflectedRay = new Ray(poffset, reflect);
if (reflectedRay.Trace(objects))
{
Color rcolor = reflectedRay.Shade(lights, objects, bgnd);
r += kr * rcolor.GetRed();
g += kr * rcolor.GetGreen();
b += kr * rcolor.GetBlue();
}
else
{
r += kr * bgnd.GetRed();
g += kr * bgnd.GetGreen();
b += kr * bgnd.GetBlue();
}
}
}
// Add code for refraction here
r = (r > 1f) ? 1f : r;
g = (g > 1f) ? 1f : g;
b = (b > 1f) ? 1f : b;
return new Color(r, g, b);
}
示例5: Scale
/**
* Scale
*
* @param factor
* @param color
*/
public void Scale(double factor, Color color)
{
red *= factor * color.GetRed();
green *= factor * color.GetGreen();
blue *= factor * color.GetBlue();
}
示例6: Combine
/**
* Combine
*
* @param color1
* @param color2
* @param color2factor
* @param color3
* @param color4
* @param color5
*/
public void Combine(Color color1, Color color2, double color2factor, Color color3, Color color4, Color color5)
{
red = color1.GetRed() + color2.GetRed() * color2factor + color3.GetRed() + color4.GetRed() + color5.GetRed();
green = color1.GetGreen() + color2.GetGreen() * color2factor + color3.GetGreen() + color4.GetGreen() + color5.GetGreen();
blue = color1.GetBlue() + color2.GetBlue() * color2factor + color3.GetBlue() + color4.GetBlue() + color5.GetBlue();
}
示例7: Mix
/**
* Mix
*
* @param factor
* @param color1
* @param color2
*/
public void Mix(double factor, Color color1, Color color2)
{
red += factor * color1.GetRed() * color2.GetRed();
green += factor * color1.GetGreen() * color2.GetGreen();
blue += factor * color1.GetBlue() * color2.GetBlue();
}
示例8: GetLineColor
/**
* @return color of the line. If color is not Set returns <code>java.awt.Color.black</code>
*/
public Color GetLineColor()
{
EscherOptRecord opt = (EscherOptRecord)GetEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
EscherSimpleProperty p1 = (EscherSimpleProperty)GetEscherProperty(opt, EscherProperties.LINESTYLE__COLOR);
EscherSimpleProperty p2 = (EscherSimpleProperty)GetEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
int p2val = p2 == null ? 0 : p2.PropertyValue;
Color clr = null;
if ((p2val & 0x8) != 0 || (p2val & 0x10) != 0)
{
int rgb = p1 == null ? 0 : p1.PropertyValue;
if (rgb >= 0x8000000)
{
int idx = rgb % 0x8000000;
if (Sheet != null)
{
ColorSchemeAtom ca = Sheet.GetColorScheme();
if (idx >= 0 && idx <= 7) rgb = ca.GetColor(idx);
}
}
Color tmp = new Color(rgb, true);
clr = new Color(tmp.GetBlue(), tmp.GetGreen(), tmp.GetRed());
}
return clr;
}