Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
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 Wink
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.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Should RGBA have got 4 arguments constructor?
Next Topic: Simplest way to add jpg or png to a layout, for logos, image visble off/on for status, etc.
Goto Forum:
  


Current Time: Wed May 22 06:42:08 CEST 2024

Total time taken to generate the page: 0.01358 seconds