[scribus] image width and frame width

ale rimoldi ale.comp_06 at xox.ch
Sat Jan 26 09:43:05 UTC 2019


hi developpers

yesterday i've been working on

0015448: when an image is set to fit the frame, it should just fit it
https://bugs.scribus.net/view.php?id=15448

i' almost done, but there is one last feature that must get in and i
can't figure out how to complete it:

making sure that the image is always in the frame (when "fit to frame"
is selected).

checking that the image does not go below zero was easy.
what i cannot figure out is: how to make sure that the image does not
overflow on "the other side".

i've been looking at

void PageItem::adjustPictScale()
https://github.com/scribusproject/scribus/blob/master/scribus/pageitem.cpp#L9729

which -- among other tings -- should scale the image to the frame size

and i came up with

if (m_imageXOffset / 10 + static_cast<double>(OrigW) *
	m_imageXScale > m_width) {
	newX = 0;
}
if (m_imageYOffset / 10 + static_cast<double>(OrigH) *
	m_imageYScale > m_height) {
	newY = 0;
}

but it does not do the job.

the relevant variables seem to be:

m_width: the width of the frame
m_imageXOffset: the left offset of the image in the frame
OrigW: the size of the iamge
m_imageXScale: the horizontal scale of the image
pixm.width(): again, the size of the image

does anybody have a hint how to:

- combine those variable
- find other relevant variables
- find a snippet that helps me solve the issue

any idea?

ciao
a.l.e



More information about the scribus mailing list