protected YuvPlanar(Buffer.Sized buffer, Geometry2D.Integer.Size size, CoordinateSystem coordinateSystem, Geometry2D.Integer.Shell crop) : base(buffer, size, coordinateSystem, crop) { this.Y = this.CreateY(); this.U = this.CreateU(); this.V = this.CreateV(); }
protected YuvPlanar(YuvPlanar original) : base(original) { this.Y = this.CreateY(); this.U = this.CreateU(); this.V = this.CreateV(); }
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; }
protected Monochrome(Monochrome original) : base(original) { }
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; }