compositor.Get_total_composition_dims(viewDims);
Kdu_coords viewSize = viewDims.Access_size();
compositor.Set_buffer_surface(viewDims);
int[] imgBuffer = new int[viewSize.Get_x() * viewSize.Get_y()];
Kdu_compositor_buf compositorBuffer = compositor.Get_composition_buffer(viewDims);
int regionBufferSize = 0;
int[] kduBuffer = null;
Kdu_dims newRegion = new Kdu_dims();
while (compositor.Process(100000, newRegion)) {
Kdu_coords newOffset = newRegion.Access_pos();
Kdu_coords newSize = newRegion.Access_size();
newOffset.Subtract(viewDims.Access_pos());
int newPixels = newSize.Get_x() * newSize.Get_y();
if (newPixels == 0)
continue;
if (newPixels > regionBufferSize) {
regionBufferSize = newPixels;
kduBuffer = new int[regionBufferSize];
}
compositorBuffer.Get_region(newRegion, kduBuffer);
int imgBuffereIdx = newOffset.Get_x() + newOffset.Get_y() * viewSize.Get_x();
int kduBufferIdx = 0;
int xDiff = viewSize.Get_x() - newSize.Get_x();
for (int j = 0; j < newSize.Get_y(); j++, imgBuffereIdx += xDiff) {
for (int i = 0; i < newSize.Get_x(); i++) {