Modified Preview Canvas

- Now the Preview can show free space around the image (the image's
corner will coincide with the center of the preview area)
- Editing objects can now be manipulated in this free space
- The editing mechanism has been split : it was completely handled in
rtengine before, now rtengine still handle the pipette's data provider,
but rtgui now handle the objects data provider.
- Bugfix: when using coarse rotate in the Editor panel, the Gradient
widgets are now correctly displayed
This commit is contained in:
Hombre
2016-01-29 22:09:56 +01:00
parent 8c3e6eab95
commit 4665b88788
22 changed files with 1413 additions and 848 deletions

View File

@@ -204,27 +204,19 @@ Glib::RefPtr<Gdk::Pixbuf> PreviewHandler::getRoughImage (int x, int y, int w, in
h = image->getHeight() * totalZoom;
}
int ix = x * zoom;
int iy = y * zoom;
x *= zoom;
y *= zoom;
if (ix < 0) {
ix = 0;
if ((x + w) / totalZoom > previewImg->get_width()) {
w = previewImg->get_width() * totalZoom - x;
}
if (iy < 0) {
iy = 0;
}
if ((ix + w) / totalZoom > previewImg->get_width()) {
ix = previewImg->get_width() * totalZoom - w;
}
if ((iy + h) / totalZoom > previewImg->get_height()) {
iy = previewImg->get_height() * totalZoom - h;
if ((y + h) / totalZoom > previewImg->get_height()) {
h = previewImg->get_height() * totalZoom - y;
}
resPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, w, h);
previewImg->scale (resPixbuf, 0, 0, w, h, -ix, -iy, totalZoom, totalZoom, Gdk::INTERP_NEAREST);
previewImg->scale (resPixbuf, 0, 0, w, h, -x, -y, totalZoom, totalZoom, Gdk::INTERP_NEAREST);
}
return resPixbuf;