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 » U++ Library : Other (not classified elsewhere) » Painter DrawLineStroke proposal
Painter DrawLineStroke proposal [message #23895] Wed, 02 December 2009 08:49 Go to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello Mirek

Very recently there have been a change in DrawLineStroke() so that from now all lines are rounded. All previous calls to LineCap() are useless:

void Painter::DrawLineStroke(int width, Color color)
{
        Begin();
        LineCap(LINECAP_ROUND);   <<=== Line added
        switch(width) {
                case PEN_NULL:
                        Stroke(0, color);
                        End();
                        return;
                case PEN_SOLID:
                        Stroke(1, color);
                        break;
                case PEN_DASH:
                        Dash("18 6");
                        break;
                case PEN_DOT:
                        Dash("3 3");
                        break;
                case PEN_DASHDOT:
                        Dash("9 6 3 6");
                        break;
                case PEN_DASHDOTDOT:
                        Dash("9 3 3 3 3 3");
                        break;
        default:
                Stroke(width, color);
                End();
                return;
        }
        Stroke(1, color);
        End();
}


It would be good if you could remove that line Smile

Best regards
Koldo


Best regards
Iñaki
Re: Painter DrawLineStroke proposal [message #23906 is a reply to message #23895] Fri, 04 December 2009 08:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 02 December 2009 02:49

Hello Mirek

Very recently there have been a change in DrawLineStroke() so that from now all lines are rounded. All previous calls to LineCap() are useless:

void Painter::DrawLineStroke(int width, Color color)
{
        Begin();
        LineCap(LINECAP_ROUND);   <<=== Line added
        switch(width) {
                case PEN_NULL:
                        Stroke(0, color);
                        End();
                        return;
                case PEN_SOLID:
                        Stroke(1, color);
                        break;
                case PEN_DASH:
                        Dash("18 6");
                        break;
                case PEN_DOT:
                        Dash("3 3");
                        break;
                case PEN_DASHDOT:
                        Dash("9 6 3 6");
                        break;
                case PEN_DASHDOTDOT:
                        Dash("9 3 3 3 3 3");
                        break;
        default:
                Stroke(width, color);
                End();
                return;
        }
        Stroke(1, color);
        End();
}


It would be good if you could remove that line Smile

Best regards
Koldo



This is to improve the similarity of Painter and host platform Draw. Win32 basic line draw has caps rounded...

If you need full control, please use Painter API.

Mirek
Re: Painter DrawLineStroke proposal [message #23908 is a reply to message #23906] Fri, 04 December 2009 09:37 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello Mirek

So do I have to do this?:

void MyClass::Paint(Draw& drw) 
{
	Size sz = GetSize();
	ImageBuffer ib(sz);
	BufferPainter w(ib);	
	w.Clear(RGBAZero());

	w.LineCap(LINECAP_BUTT);		
	
	if (MY_ACTUAL_IMPLEMENTATION) 
		w.DrawLine(0, 0, 20, 20, 5, Black());	// w.LineCap(LINECAP_BUTT) does nothing
	else {			// Proposed implementation
		w.Move(0, 0);
		w.Line(20, 20);
		w.Stroke(5, Black());
	}
	
	drw.DrawImage(0, 0, ib);
}


I mean I cannot use DrawLine() and instead I have to use Move().Line.Stroke().

Best regards
Koldo


Best regards
Iñaki
Re: Painter DrawLineStroke proposal [message #23909 is a reply to message #23908] Fri, 04 December 2009 11:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Yes.
Previous Topic: Util.cpp static sIniFile BUG FIX
Next Topic: Polymorphic XML
Goto Forum:
  


Current Time: Sat Apr 20 09:02:52 CEST 2024

Total time taken to generate the page: 0.03326 seconds