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 » Community » U++ community news and announcements » 2020.1 alpha
Re: 2020.1 alpha [message #53373 is a reply to message #53370] Tue, 31 March 2020 15:28 Go to previous messageGo to next message
Tom1
Messages: 788
Registered: March 2007
Contributor
Hi,

I tried with MODE_NOAA too, but some of the borders still show a 'dashed' gap. It is sharper of course in this case.

Could it be possible to fix those gaps seen in MODE_NOAA rendering and then internally use that mode with FILL_FAST while rest of the rendering is done according to the selected mode?

Or is there any other known way around this issue to clean up the visual appearance?

Best regards,

Tom

Re: 2020.1 alpha [message #53374 is a reply to message #53370] Tue, 31 March 2020 15:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12497
Registered: November 2005
Ultimate Member
Ugly quick fix:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class PainterImageMapping : public TopWindow {
public:
	typedef PainterImageMapping CLASSNAME;
	
	PainterImageMapping(){
		Sizeable();
	}
		
	virtual void Paint(Draw &draw){
		DrawPainter w(draw, GetSize());

		Image img = CreateImage(Size(500, 500), Black());

		// image coordinates
		Pointf iNW(0,0);
		Pointf iNE(img.GetWidth(),0);
		Pointf iSW(0,img.GetHeight());
		Pointf iSE(img.GetWidth(),img.GetHeight());
		
		w.Clear(White());
		
		dword flags=FILL_FAST;
		auto Do = [&](const Xform2D xform) {
			w.Fill(img, xform, flags).Stroke(2, img, xform, flags);
		};
		
		{
			Pointf nw(100,100);
			Pointf ne(700,100);
			Pointf sw(100,700);
			Pointf se(650,750);
			w.Move(nw).Line(ne).Line(se); Do(Xform2D::Map(iNW,iNE,iSE,nw,ne,se));
			w.Move(nw).Line(sw).Line(se); Do(Xform2D::Map(iNW,iSW,iSE,nw,sw,se));
		}
		{
			Pointf nw(700,100);
			Pointf ne(1400,120);
			Pointf sw(650,750);
			Pointf se(1300,720);
			w.Move(nw).Line(ne).Line(se); Do(Xform2D::Map(iNW,iNE,iSE,nw,ne,se));
			w.Move(nw).Line(sw).Line(se); Do(Xform2D::Map(iNW,iSW,iSE,nw,sw,se));
		}
		{
			Pointf nw(100,700);
			Pointf ne(650,750);
			Pointf sw(100,1200);
			Pointf se(650,1350);
			w.Move(nw).Line(ne).Line(se); Do(Xform2D::Map(iNW,iNE,iSE,nw,ne,se));
			w.Move(nw).Line(sw).Line(se); Do(Xform2D::Map(iNW,iSW,iSE,nw,sw,se));
		}
		{
			Pointf nw(650,750);
			Pointf ne(1300,720);
			Pointf sw(650,1350);
			Pointf se(1300,1220);
			w.Move(nw).Line(ne).Line(se); Do(Xform2D::Map(iNW,iNE,iSE,nw,ne,se));
			w.Move(nw).Line(sw).Line(se); Do(Xform2D::Map(iNW,iSW,iSE,nw,sw,se));
		}
	}
};

GUI_APP_MAIN
{
	PainterImageMapping().Run();
}

[Updated on: Tue, 31 March 2020 15:47]

Report message to a moderator

Re: 2020.1 alpha [message #53375 is a reply to message #53373] Tue, 31 March 2020 15:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12497
Registered: November 2005
Ultimate Member
Tom1 wrote on Tue, 31 March 2020 15:28
Hi,

I tried with MODE_NOAA too, but some of the borders still show a 'dashed' gap. It is sharper of course in this case.

Could it be possible to fix those gaps seen in MODE_NOAA rendering and then internally use that mode with FILL_FAST while rest of the rendering is done according to the selected mode?

Or is there any other known way around this issue to clean up the visual appearance?

Best regards,

Tom



Yeah, in my previous message, I really confused MODE_NOAA with FILL_FAST. So no, MODE_NOAA can be a tiny bit faster, but really works just by rounding aliasing alpha to 0 or 255.
Re: 2020.1 alpha [message #53379 is a reply to message #53375] Tue, 31 March 2020 19:09 Go to previous messageGo to next message
Tom1
Messages: 788
Registered: March 2007
Contributor
Hi,

OK, Thanks. It (adding Stroke) does work indeed, but the penalty is 40% increase in execution time.

-

Interestingly, this combo works too:
	BufferPainter w(ib,MODE_NOAA);

	dword flags=FILL_HREFLECT|FILL_VREFLECT|FILL_FAST;


But of course I do not wish to use MODE_NOAA as it ruins everything else.

Could this observation be used to tweak the same behavior out of BufferPainter using MODE_ANTIALIASED with minor modifications?

IMO, switching internally temporarily to MODE_NOAA while rendering with FILL_FAST is quite OK -- if only possible.

Best regards,

Tom

[Updated on: Tue, 31 March 2020 19:10]

Report message to a moderator

Re: 2020.1 alpha [message #53380 is a reply to message #53379] Tue, 31 March 2020 19:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12497
Registered: November 2005
Ultimate Member
Tom1 wrote on Tue, 31 March 2020 19:09
Hi,

OK, Thanks. It (adding Stroke) does work indeed, but the penalty is 40% increase in execution time.



Well, the alternative is enlarge rectangles 1 pixel... That should be fast.
Re: 2020.1 alpha [message #53383 is a reply to message #53380] Tue, 31 March 2020 22:04 Go to previous message
Tom1
Messages: 788
Registered: March 2007
Contributor
Hi,

Thanks Mirek! It works just perfectly.

I used the following pattern to sufficiently overlap and expand the triangles:
w.Move(nw+Pointf(-2,-1)).Line(ne+Pointf(1,-1)).Line(se+Pointf(1,1)).Fill(img, Xform2D::Map(iNW,iNE,iSE,nw,ne,se), flags);
w.Move(nw+Pointf(-1,-1)).Line(sw+Pointf(-1,1)).Line(se+Pointf(2,1)).Fill(img, Xform2D::Map(iNW,iSW,iSE,nw,sw,se), flags);

And: No observable slowdown! Smile

Thanks and best regards,

Tom
Previous Topic: U++/Win32 is now using CLANG toolchain
Next Topic: svn/github now has auto-generated Makefile
Goto Forum:
  


Current Time: Fri May 29 21:50:08 CEST 2020

Total time taken to generate the page: 0.02268 seconds