exactBounds

Casper Boemann cbr at boemann.dk
Tue Jul 17 21:45:47 CEST 2007


On Tuesday 17 July 2007 21:06, Sven Langkamp wrote:
> On 7/17/07, Casper Boemann <cbr at boemann.dk> wrote:
> > On Tuesday 17 July 2007 19:45, Sven Langkamp wrote:
> > > On 7/17/07, Casper Boemann <cbr at boemann.dk> wrote:
> > > > On Tuesday 17 July 2007 13:27, Sven Langkamp wrote:
> > > > > > KisPaintDevice::exactBounds is intented to return the bound of
> > > > > > the paint device, aka the rectangle where there are pixels on the
> > > > > > paint device,
> > > >
> > > > and
> > > >
> > > > > > it has allways been the case in 1.5/1.6, and if its different in
> >
> > 2.0,
> >
> > > > > > then you have found a bug ;) . Beside, a paint device is not
> > > > > > necesseraly use with an image.
> > > > >
> > > > > In selectedExactRect there is (for defaultpixel != SELECTED_MIN):
> > > > > exactBounds().unite(m_parentPaintDevice->exactBounds());
> > > > > Which I think should return the image bounds.
> > > >
> > > > no it should return where there are affect _actual_ pixels. Which is
> > > > why we united we the actual pixels of the device when default is not
> > > > MIN
> > > >
> > > > Two kind of operations can be thought of:
> > > >  - do stuff to every pixel selected. As in filling the entire
> > > > selection. - do stuff with selected pixels. As in copying what you
> > > > have selected
> > > >
> > > > setDirty in your case is of the first kind. For that you need to do
> > > > some extra
> > > > stuff yourself. Please don't change the method. I however think there
> > > > is another method called something like "does this rect boud
> > > > everything" that you might be able to use (this is off the top of my
> > > > head though)
> > >
> > > oops, I already changed it.
> >
> > Then please revert it, because lots of stuff depend on the old behaviour
>
> That stuff already broke before the change ;)
>
> > > For example: If I do "select all" on an empty paintdevice the size of
> > > the paintdevice and the selection are 0, but filling the selection
> > > would fill the whole image.  In that case the image bounds have to be
> > > returned.
> >
> > Yeah AFTER you have filled it ;)
> >
> > but not at the point where you have only selected all. The code that
> > fills should look at the defaultPixel and possibly use the image
> > dimensions, but do
> > NOT change selectedExactRect
>
> That doesn't make sense to me. Why does filling change the selection size?
> All pixels that are not inside the exact selection are defaultpixel,
> so why is the unite needed?
when you select all you have an infinite selection ( implemented by setting 
the default pixel of the selection)

please note we are talking of two different concepts: size and extent

The size doesn't change when you fill - it's infinite in both cases

but the extent (ie selectedExactRect()) does change as now you have messed 
with a lot of pixels

it's needed because we want to know the rect that specifies where there are 
actual pixels that needs our attention.



> _______________________________________________
> kimageshop mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop

-- 
best regards / venlig hilsen
Casper Boemann


More information about the kimageshop mailing list