<!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>
&gt; On Sunday 03 May 2009 19:18:32 Cyrille Berger wrote:<br>
&gt; &gt; On Friday 01 May 2009, LukasT.dev@gmail.com wrote:<br>
&gt; &gt; &gt; There are some nice commits from Cyrille in trunk about the preview of<br>
&gt; &gt; &gt; the brush on the canvas. So far it is little buggy. When you select the<br>
&gt; &gt; &gt; Pixel Brush and select the diameter e.g. 25 and try to paint, you will<br>
&gt; &gt; &gt; get the wrong result.<br>
&gt; &gt;<br>
&gt; &gt; I know, I have been delaying investigating that until we decide to use<br>
&gt; &gt; KisBoundary(Painter) or your equivalent code.<br>
&gt;<br>
&gt; What I need is coordinates system that I can relay on. I did detection of<br>
&gt; the edge pixels in my paintop. I detect the boundary of the brush and the<br>
&gt; results are in absolute coordinates (QPointF). I would do<br>
&gt; painter.paintPoint(QPointF) but before that I need to know how to translate<br>
&gt; my absolute coordinates I get from KisPaintDevice to the coordinates in the<br>
&gt; screen which will respect the zoom and resolution and related attributes<br>
&gt; 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>&gt; &gt; &gt; I have some questions about the code as I don't understand it a bit:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The code is in PaintOpSettings object.Will it be possible to change the<br>
&gt; &gt; &gt; state of the shape of the preview throught stroke painting? The way I<br>
&gt; &gt; &gt; see it now would be : add some variable to Settings Object and call<br>
&gt; &gt; &gt; setter in the paintAt? There is reference to settings object in the<br>
&gt; &gt; &gt; constructor, so paintop would have to make member with reference.<br>
&gt; &gt;<br>
&gt; &gt; In 1.6 brushoutline is disabled when painting. The only usefull outline<br>
&gt; &gt; when painting is the one of the source of duplicating. (which probably<br>
&gt; &gt; means we need to pass an enum to paintOutline(Rect) to indicate the state<br>
&gt; &gt; (for now painting/notpainting) ).<br>
&gt;<br>
&gt; I think some brushes could have outline even when painting, e.g. ArtRage<br>
&gt; shows it all the time. It is nice feedback result but may be slow for some<br>
&gt; 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>&gt; &gt; &gt; This returns the area of KisImage that should be recomposited? If so I<br>
&gt; &gt; &gt; would propose to just return the QRectF which would represent the size<br>
&gt; &gt; &gt; of the brush and handle the pixelToDocument higher in the API as I'm<br>
&gt; &gt; &gt; really confused with it.<br>
&gt; &gt;<br>
&gt; &gt; No because, QPainter works with view coordinates, and I think<br>
&gt; &gt; paintOutlineRect and paintOutline should work in the same coordinate<br>
&gt; &gt; system. It's probably worth to have a common API for computing this<br>
&gt; &gt; things, for instance in KisBrush for use by all KisBrush based paint op.<br>
&gt; &gt; I don't think there is a way to make QPainter works in image coordinates<br>
&gt; &gt; instead, and anyway, I don't think we want to do that, that would make<br>
&gt; &gt; paintOutline rather inconsistent with every other place where we draw<br>
&gt; &gt; things on the canvas.<br>
&gt;<br>
&gt; There is process that translate the coordinates and the part of it could be<br>
&gt; higher in API. Something like documentToView and imagePixels methods. They<br>
&gt; are going to be called in every paintop anyway right? You can't reinterpret<br>
&gt; that coordinates in different way anyway I suppose. e.g. the duplicate<br>
&gt; paintop uses one more outline but it is just translated, there is just easy<br>
&gt; 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>