DavidHAVE / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

drawTriangle outer bound of polygone not filled #254

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The drawTriangle functions seems to draw online the inner shape exlcuding the 
lines that make the outer of the polygon.

Exemple with the following:

u8g_DrawTriangle(u8g,0,0, 45,32, 9,42);

Pixel 0,0 does not get filled... only bounding pixel inside the polygon do get 
filled. Is this the expected behavior?

If you add the following functions you notice the outerbound of the shape is 
not the same

u8g_DrawLine(u8g,0,0,45,32);
u8g_DrawLine(u8g,45,32,9,42);
u8g_DrawLine(u8g,45,32,0,0);

Please find attached two screen shots under SDlDriver with both cases.

Original issue reported on code.google.com by philippe...@gmail.com on 12 Apr 2014 at 2:45

Attachments:

GoogleCodeExporter commented 8 years ago
Feel stupid I just read the API doc:

But still I do not understand the behavior of FLAT anyway to get the outerbound 
drawn?

Draw a triangle (filled polygon). Arguments are 16 bit and the polygon is 
clipped to the size of the display. Multiple polygons are drawn so that they 
exactly match without overlap: The left side of a polygon is drawn, the right 
side is not draw. The upper side is only draw if it is flat. In the example 
picture below, the pixel at (9,43) is drawn by the polygon procedures, but 
pixels (14,9) and (45,32) are not drawn. 

Original comment by philippe...@gmail.com on 12 Apr 2014 at 2:58

GoogleCodeExporter commented 8 years ago
I have basically implemented the algorithm from "Michael Abrash's Graphics 
Programming Black Book". The explaination is by far more complete in this book. 
I tried to give a short description, but my knowledge on english is limited, so 
maybe it is better to read the original.

The book seems to be online:
http://www.drdobbs.com/parallel/graphics-programming-black-book/184404919
I think details are in chapter 38 and 39.

Original comment by olikr...@gmail.com on 12 Apr 2014 at 4:02

GoogleCodeExporter commented 8 years ago
hope, that this issue is solved...

Original comment by olikr...@gmail.com on 16 Jun 2014 at 7:18