compositor.Create(raw_src);
} else {
compositor.Create(wrapped_src);
}
Kdu_dims imageDimensions = new Kdu_dims();
compositor.Get_total_composition_dims(imageDimensions);
Kdu_coords imageSize = imageDimensions.Access_size();
Kdu_coords imagePosition = imageDimensions.Access_pos();
if (useleftDouble) {
left = imagePosition.Get_x() + (int) Math.round(leftDouble * imageSize.Get_x());
}
if (usetopDouble) {
top = imagePosition.Get_y() + (int) Math.round(topDouble * imageSize.Get_y());
}
if (useheightDouble) {
height = (int) Math.round(heightDouble * imageSize.Get_y());
}
if (usewidthDouble) {
width = (int) Math.round(widthDouble * imageSize.Get_x());
}
if (useRegion) {
imageSize.Set_x(width);
imageSize.Set_y(height);
imagePosition.Set_x(left);
imagePosition.Set_y(top);
}
int reduce = 1 << params.getLevelReductionFactor();
imageSize.Set_x(imageSize.Get_x());
imageSize.Set_y(imageSize.Get_y());
imagePosition.Set_x(imagePosition.Get_x() / reduce - (1 / reduce - 1) / 2);
imagePosition.Set_y(imagePosition.Get_y() / reduce - (1 / reduce - 1) / 2);
Kdu_dims viewDims = new Kdu_dims();
viewDims.Assign(imageDimensions);
viewDims.Access_size().Set_x(imageSize.Get_x());
viewDims.Access_size().Set_y(imageSize.Get_y());
compositor.Add_compositing_layer(0, viewDims, viewDims);
if (params.getRotationDegree() == 90) {
compositor.Set_scale(true, false, true, 1.0F);
} else if (params.getRotationDegree() == 180) {
compositor.Set_scale(false, true, true, 1.0F);
} else if (params.getRotationDegree() == 270) {
compositor.Set_scale(true, true, false, 1.0F);
} else {
compositor.Set_scale(false, false, false, 1.0F);
}
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;