looks like I've figured it out.
On Tue, Jul 19, 2011 at 3:38 PM, Yue Liu <yue....@mail.com> wrote: > Hello, > > In recent days I'm trying to fix the shape group shadow issues but I > think I have some misunderstandings and made things even worse. Hope I > can get some help. > > My design: > > get the shadow rectangle by shadowRect = shape->boundingRect(); > this will include the insets of shadow offsets and shadow blur caused > shadow expansion. > > I think after that I'll get a rectangle with shape's origin inside it. > > create a buffer image with shadow rectangle's size in view zoomlevel. > QRectF zoomedClipRegion = converter.documentToView(shadowRect); > QImage sourceGraphic(zoomedClipRegion.size().toSize(), > QImage::Format_ARGB32_Premultiplied); > > apply a transform to th qpainter which paints the shadow onto the image. > this part confuse me very much, currently i did: > > //offset transformation on the buffer image in pixel, shape's own coordinate > QTransform tm; > tm.translate(d->offset.x(), d->offset.y()); > QTransform tr = shape->absoluteTransformation(&converter); > QTransform offsetMatrix = tr * tm * tr.inverted(); > > //set the absolute transformation to shape so it can draw in it's own > coordinate system in pixel > KoShape::applyConversion(painter, converter); > // apply the offset transformation so it draws on the correct position > on buffer image > painter.setTransform(offsetMatrix * painter.transform()); > > //process the image and paste the image to the canvas > QPointF clippingOffset = zoomedClipRegion.topLeft(); > painter.drawImage(clippingOffset, sourceGraphic); > > But the result goes very starnge, the shadow rectangle changes a lot > when shape is moving, and the shadow position is incorrect. I must > have get something wrong. Anyone knows what's wrong with the > implementation? > > in the attachment shape group part are commented since I haven't > figure out the single shape part. > > Best Regards, > Yue Liu > _______________________________________________ calligra-devel mailing list calligra-devel@kde.org https://mail.kde.org/mailman/listinfo/calligra-devel