<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">On Sunday 03 May 2009, LukasT.dev@gmail.com wrote:<br>
> On Sunday 03 May 2009 19:18:32 Cyrille Berger wrote:<br>
> > On Friday 01 May 2009, LukasT.dev@gmail.com wrote:<br>
> > > There are some nice commits from Cyrille in trunk about the preview of<br>
> > > the brush on the canvas. So far it is little buggy. When you select the<br>
> > > Pixel Brush and select the diameter e.g. 25 and try to paint, you will<br>
> > > get the wrong result.<br>
> ><br>
> > I know, I have been delaying investigating that until we decide to use<br>
> > KisBoundary(Painter) or your equivalent code.<br>
><br>
> What I need is coordinates system that I can relay on. I did detection of<br>
> the edge pixels in my paintop. I detect the boundary of the brush and the<br>
> results are in absolute coordinates (QPointF). I would do<br>
> painter.paintPoint(QPointF) but before that I need to know how to translate<br>
> my absolute coordinates I get from KisPaintDevice to the coordinates in the<br>
> screen which will respect the zoom and resolution and related attributes<br>
> which come into the way :)<br>
What do you call absolute coordinates ? Image coordinate, or view coordinate ? If it's image coordinate, it's more than a paintPoint (since in a view a pixel of the image/brush outline can be represented by more or less pixels than in the image depending of the zoom level), I strongly suggest to have a look at ui/kis_boundary_painter.*<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>> > > I have some questions about the code as I don't understand it a bit:<br>
> > ><br>
> > > The code is in PaintOpSettings object.Will it be possible to change the<br>
> > > state of the shape of the preview throught stroke painting? The way I<br>
> > > see it now would be : add some variable to Settings Object and call<br>
> > > setter in the paintAt? There is reference to settings object in the<br>
> > > constructor, so paintop would have to make member with reference.<br>
> ><br>
> > In 1.6 brushoutline is disabled when painting. The only usefull outline<br>
> > when painting is the one of the source of duplicating. (which probably<br>
> > means we need to pass an enum to paintOutline(Rect) to indicate the state<br>
> > (for now painting/notpainting) ).<br>
><br>
> I think some brushes could have outline even when painting, e.g. ArtRage<br>
> shows it all the time. It is nice feedback result but may be slow for some<br>
> paintops. If it will be configurable, we win.<br>
Somehow, I feel it will be slow for most paintop... Right now it's rather fast, but drawing a circle is way more faster than drawing a brush outline.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>> > > This returns the area of KisImage that should be recomposited? If so I<br>
> > > would propose to just return the QRectF which would represent the size<br>
> > > of the brush and handle the pixelToDocument higher in the API as I'm<br>
> > > really confused with it.<br>
> ><br>
> > No because, QPainter works with view coordinates, and I think<br>
> > paintOutlineRect and paintOutline should work in the same coordinate<br>
> > system. It's probably worth to have a common API for computing this<br>
> > things, for instance in KisBrush for use by all KisBrush based paint op.<br>
> > I don't think there is a way to make QPainter works in image coordinates<br>
> > instead, and anyway, I don't think we want to do that, that would make<br>
> > paintOutline rather inconsistent with every other place where we draw<br>
> > things on the canvas.<br>
><br>
> There is process that translate the coordinates and the part of it could be<br>
> higher in API. Something like documentToView and imagePixels methods. They<br>
> are going to be called in every paintop anyway right? You can't reinterpret<br>
> that coordinates in different way anyway I suppose. e.g. the duplicate<br>
> paintop uses one more outline but it is just translated, there is just easy<br>
> relation between them.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>If I get you correctly, you want a convenient function for pixelToView ? I suppose we can add that in KisImage that would take also take a KoViewConverter and do the call documenToView(pixelToDocument()).<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>-- <br>
Cyrille Berger</p></body></html>