public override void BlitToMemory(BasicBox srcBox, PixelBox dst)
{
if (!this._buffer.Contains(srcBox))
{
throw new ArgumentException("Source box out of range.");
}
if (srcBox.Left == 0 && srcBox.Right == Width && srcBox.Top == 0 && srcBox.Bottom == Height && srcBox.Front == 0 &&
srcBox.Back == Depth && dst.Width == Width && dst.Height == Height && dst.Depth == Depth &&
GLPixelUtil.GetGLOriginFormat(dst.Format) != 0)
{
// The direct case: the user wants the entire texture in a format supported by GL
// so we don't need an intermediate buffer
download(dst);
}
else
{
// Use buffer for intermediate copy
allocateBuffer();
// Download entire buffer
download(this._buffer);
if (srcBox.Width != dst.Width || srcBox.Height != dst.Height || srcBox.Depth != dst.Depth)
{
//TODO Implement Image.Scale
throw new Exception("Image scaling not yet implemented");
// We need scaling
//Image.Scale( _buffer.GetSubVolume( srcBox ), dst, ImageFilter.BiLinear );
}
else
{
// Just copy the bit that we need
PixelConverter.BulkPixelConversion(this._buffer.GetSubVolume(srcBox), dst);
}
freeBuffer();
}
}