Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Painter and viewports
Re: Painter and viewports [message #43965 is a reply to message #43964] |
Mon, 01 December 2014 22:03   |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi Didier,
thank you for answer.
I use Painter because I need to work in floating point units, scale and so on,
and I don't want to replicate all that stuff 
Btw, I use a big painting area because I just do drawing regens when I modify it,
then I "move" the viewport over it to pan/zoom, so I spare some graphic calculations.
I found a solution, anyways.
Now I've got the problem of transparency.
I need to paint 2 transparent drawings over a background, i.e.:
// create an imagebuffer to paint inside
ImageBuffer ib(sz);
// place it on requested viewport
BufferPainter bp(ib);
bp.Scale(scale, scale);
bp.Translate(-x1 - WORK_AREA / 2, -y1 + WORK_AREA / 2);
// paint work area
INTERLOCKED_(doc->RegenMutex()) {
One<PaintingPainter> &workArea = doc->GetWorkArea();
if(!workArea.IsEmpty())
bp.Paint(*workArea);
}
// paint overlayer
bp.Paint(*doc->GetOverlayArea());
// display it
w.DrawImage(0, 0, ib);
workArea and overlayArea are both cleared with RGBAZero() color.
But when I paint on bp object (which has a white background...) I get garbage.
If I clear the painters with a color, all is ok, but I loose the overlay stuff.
|
|
|
Goto Forum:
Current Time: Tue May 13 05:25:10 CEST 2025
Total time taken to generate the page: 0.03577 seconds
|