本文整理汇总了C#中Pixel类的典型用法代码示例。如果您正苦于以下问题:C# Pixel类的具体用法?C# Pixel怎么用?C# Pixel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pixel类属于命名空间,在下文中一共展示了Pixel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetColor
public virtual void SetColor(int x, int y, ColorRGBA color)
{
// Create a pixel for the color
Pixel pel = new Pixel(PixRectInfo.GetPixelInformation(), Pixel.GetBytesForColor(PixRectInfo.GetPixelInformation(), color));
SetPixel(x, y, pel);
}
示例2: Clear
public virtual void Clear(Pixel color)
{
for (uint i = 0; i < Data.Length; i++)
{
Data[i] = color;
}
}
示例3: getLonLatFromViewPortPx
public LonLat getLonLatFromViewPortPx(Pixel viewPortPx)
{
LonLat lonlat = null;
if (viewPortPx != null)
{
Size size = _map.getSize();
LonLat center = _map.getCenter();
if (center != null)
{
float res = _map.getResolution().Value;
float delta_x = (float)(viewPortPx.x - (size.Width / 2));
float delta_y = (float)(viewPortPx.y - (size.Height / 2));
lonlat = new LonLat(center.lon + delta_x * res,
center.lat - delta_y * res);
if (_wrapDateLine)
{
lonlat = lonlat.wrapDateLine(_maxExtent);
}
}
}
return lonlat;
}
示例4: Node
public Node( Pixel data, int level )
{
// This creates a leaf by default.
//location = (NodeLocation)(-1);
this.level = level;
BecomeLeaf( data );
}
示例5: Test_IEquatable
public void Test_IEquatable()
{
Pixel first = new Pixel(0, 0, 3);
first.SetChannel(0, 100);
first.SetChannel(1, 100);
first.SetChannel(2, 100);
Assert.IsFalse(first == null);
Assert.IsFalse(first.Equals(null));
Assert.IsTrue(first.Equals(first));
Assert.IsTrue(first.Equals((object)first));
Pixel second = new Pixel(10, 10, 3);
second.SetChannel(0, 100);
second.SetChannel(1, 0);
second.SetChannel(2, 100);
Assert.IsTrue(first != second);
Assert.IsTrue(!first.Equals(second));
Assert.IsTrue(!first.Equals((object)second));
second.SetChannel(1, 100);
Assert.IsTrue(first == second);
Assert.IsTrue(first.Equals(second));
Assert.IsTrue(first.Equals((object)second));
}
示例6: RawImage
public RawImage( int zoom, Rectangle bounds, Pixel[,] memory )
{
this.zoom = zoom;
this.bounds = bounds;
if ( memory.GetLength(0) != bounds.Width || memory.GetLength(1) != bounds.Height ) throw new ArgumentOutOfRangeException( "memory" );
this.memory = memory;
}
示例7: AddColor
public TransparencyColor AddColor(Pixel color)
{
TransparencyColor transparencyColor = new TransparencyColor(color, 2, 0);
this._colorList.Add(transparencyColor);
this.SetDirty();
return transparencyColor;
}
示例8: BackNForth
public void BackNForth()
{
Pixel[] start = new Pixel[]
{
Pixel.Colour.Red,
Pixel.Colour.Red,
Pixel.Colour.Red,
Pixel.Colour.Red,
Pixel.Colour.Green,
Pixel.Colour.Green,
Pixel.Colour.Green,
Pixel.Colour.Green,
Pixel.Colour.Blue,
Pixel.Colour.Blue,
Pixel.Colour.Blue,
Pixel.Colour.Blue
};
Update(start);
Thread.Sleep(200);
for (int j = 1; j < 5; j++) {
for (int i = 0; i < 20; i++) {
RotateDisplay();
Thread.Sleep(100);
}
for (int h = 0; h < 20; h++) {
RotateDisplay(-1);
Thread.Sleep(100);
}
}
}
示例9: updateSize
private void updateSize()
{
Size newSize = getCurrentSize();
Size oldSize = getSize();
if (oldSize == Size.Empty)
{
_size = oldSize = newSize;
}
if (!newSize.Equals(oldSize))
{
_size = newSize;
// @@@ notify layers on resize?
if (_baseLayer != null)
{
Pixel center = new Pixel((float)(newSize.Width / 2), (float)(newSize.Height / 2));
LonLat lonlat = getLonLatFromViewPortPx(center);
int zoom = getZoom().Value;
_zoom = null;
setCenter(getCenter(), zoom, null, null);
}
}
}
示例10: Superpixels
private double s = 0; // Superpixel Intervall Int
#endregion Fields
#region Constructors
// =============== Konstruktor ===============
public Superpixels(Image<Bgr, Byte> imageBgr, int superpixelCount)
{
// Werte setzen
k = superpixelCount;
n = imageBgr.Width * imageBgr.Height;
s = Math.Sqrt((double)n / (double)k);
area = Convert.ToInt32(2 * s * 2 * s);
m = 12;
// BGR to LAB Umrechnung und Vektormatrix erstellen
imageLab = imageBgr.Convert<Lab, Byte>();
pixels = new Pixel[imageBgr.Width, imageBgr.Height];
for (int r = 0; r < imageLab.Height; r++)
{
for (int c = 0; c < imageLab.Width; c++)
{
double l = (double)imageLab.Data[r, c, 0] * 100 / 255;
double a = (double)imageLab.Data[r, c, 1] - 128;
double b = (double)imageLab.Data[r, c, 2] - 128;
Bgr bgr = new Bgr(imageBgr.Data[r, c, 0], imageBgr.Data[r, c, 1], imageBgr.Data[r, c, 2]);
pixels[c, r] = new Pixel(new Vector5(l, a, b, c, r), bgr);
//Console.WriteLine("BGR = " + imageBgr.Data[r, c, 0] + " " + imageBgr.Data[r, c, 1] + " " + imageBgr.Data[r, c, 2]);
//Console.WriteLine("RGB = " + imageBgr.Data[r, c, 2] + " " + imageBgr.Data[r, c, 1] + " " + imageBgr.Data[r, c, 0]);
//Console.WriteLine("LAB = " + labValues[r, c].X + " " + labValues[r, c].Y + " " + labValues[r, c].Z);
}
}
}
示例11: GenerateRandomPixel
private static Pixel GenerateRandomPixel(int xMax, int yMax, Random random)
{
var randomX = random.Next(xMax);
var randomY = random.Next(yMax);
var pixel = new Pixel(randomX, randomY);
return pixel;
}
示例12: start
public static Pixel[] start()
{
Pixel[] pixels = new Pixel[Constants.WIN_X * Constants.WIN_Y];
Point3 viewPlane = new Point3(-Constants.WIN_X / 2, -Constants.WIN_X / 2, 0);
createScene();
for (int y = 0; y < Constants.WIN_Y; y++)
{
for (int x = 0; x < Constants.WIN_X; x++)
{
Pixel p = new Pixel();
p.rect.X = x;
p.rect.Y = Constants.WIN_Y - 1 - y;
Point3 viewPixel = new Point3();
viewPixel.x = viewPlane.x + x;
viewPixel.y = viewPlane.y + y;
viewPixel.z = viewPlane.z;
Ray r = new Ray();
r.direction = Point3.vectorize(layout.Cam.Eye, viewPixel);
r.start = layout.Cam.Eye;
p.color = fireRay(r, Constants.MIN_DEPTH, null);
pixels[y * Constants.WIN_X + x] = p;
}
}
return pixels;
}
示例13: IsBlack
public static bool IsBlack(Pixel p)
{
if (p.R == 0 && p.G == 0 && p.B == 0)
return true;
else
return false;
}
示例14: Unshade32
public RawImage Unshade32( int zoom, Rectangle bounds, int[] colorbuffer, int[] idbuffer, int[] borderbuffer )
{
if ( bounds.Width*bounds.Height != colorbuffer.Length )
throw new ArgumentOutOfRangeException( "colorbuffer", "The colorbuffer and bounds parameters have mismatching sizes" );
if ( colorbuffer.Length != idbuffer.Length || colorbuffer.Length != borderbuffer.Length )
throw new ArgumentOutOfRangeException( "colorbuffer", "The various buffers have mismatching sizes." );
int bufidx = 0;
Pixel[,] memory = new Pixel[bounds.Width, bounds.Height];
for ( int y=0; y<bounds.Height; ++y ) {
for ( int x=0; x<bounds.Width; ++x ) {
// Shading
memory[x,y].Color = (byte)((0xFF-((colorbuffer[bufidx] >> 16) & 0xFF))>>2);
// ID
memory[x,y].ID = idc.ConvertRGB( idbuffer[bufidx] );
// Border
unchecked {
memory[x,y].Border = (byte)((borderbuffer[bufidx] & (int)0xFF0000) > 0 ? 2 : 0);
}
bufidx++;
}
}
return new RawImage( zoom, bounds, memory );
}
示例15: PixelToBytes
public static void PixelToBytes(Pixel[] src, int srcIndex, ref byte[] bytes, ref int destIndex, int bytesPerPixel)
{
for (int index = 0; index < bytesPerPixel; index++)
{
bytes[destIndex++] = (byte)(src[srcIndex].Value >> (index * 8));
}
}