Exemplo n.º 1
0
		public override Draw.Image Shift(Geometry2D.Integer.Size offset)
		{
			Raster.Image result = null;
			if (this is Monochrome)
				result = new Monochrome(this.Size);
			else if (this is Bgr)
				result = new Bgr(this.Size);
			else if (this is Bgra)
				result = new Bgra(this.Size);
			else if (this is Yuyv)
				result = new Yuyv(this.Size);
			int offsetX = Kean.Math.Integer.Modulo(this is Yuyv && Kean.Math.Integer.Modulo(offset.Width, 2) != 0 ? offset.Width + 1 : offset.Width, this.Size.Width);
			int length = (this.Size.Width - offsetX) * this.BytesPerPixel;
			int line = this.Size.Width * this.BytesPerPixel;
			for (int y = 0; y < this.Size.Height; y++)
				{
					int destination = Kean.Math.Integer.Modulo(y + offset.Height, this.Size.Height) * this.Stride;
					result.Buffer.CopyFrom(this.Buffer, this.Stride * y, destination + offsetX * this.BytesPerPixel, length);
					result.Buffer.CopyFrom(this.Buffer, this.Stride * y + length, destination, line - length);
				}
			return result;
		}
Exemplo n.º 2
0
		protected Bgr(Bgr original) :
			base(original) { }
Exemplo n.º 3
0
		public Raster.Image Read()
		{
			Raster.Image result = null;
			switch (this.Type)
			{
				default:
				case TextureType.Rgba:
					result = new Raster.Bgra(this.Size);
					break;
				case TextureType.Rgb:
					result = new Raster.Bgr(this.Size);
					break;
				case TextureType.Monochrome:
					result = new Raster.Monochrome(this.Size);
					break;
			}
			this.Use();
			this.Read(result.Pointer);
			this.UnUse();
			return result;
		}