Bitmap/Midpoint circle algorithm: Difference between revisions

m
{{out}}
(Updated D entry)
m ({{out}})
Line 1:
{{task|Raster graphics operations}}Using the data storage type defined [[Basic_bitmap_storage|on this page]] for raster images, write an implementation of the '''midpoint circle algorithm''' (also known as '''Bresenham's circle algorithm'''). <BR>
write an implementation of the '''midpoint circle algorithm'''
(also known as '''Bresenham's circle algorithm'''). <BR>
([[wp:Midpoint_circle_algorithm|definition on Wikipedia]]).
 
=={{header|Ada}}==
<lang ada>procedure Circle
Line 43 ⟶ 46:
Circle (X, (8, 8), 5, Black);
Print (X);</lang>
{{out}}
Sample output:
<pre>
 
Line 118 ⟶ 121:
(print OF class image)(x)
)</lang>
{{out}}
'''Output:'''
<pre>
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Line 1,042 ⟶ 1,045:
END CIRCLE;
</lang>
Output{{out}} for three circles centered at the origin.
<langpre>
....................|....................
................2222*1111................
Line 1,085 ⟶ 1,088:
................5555*6666................
....................|....................
</langpre>
 
=={{header|PureBasic}}==
Line 1,200 ⟶ 1,203:
+-------------------------+
'''
 
</lang>
 
Line 1,297 ⟶ 1,299:
minY=min(minY,yy); maxY=max(maxY,yy)
return</lang>
{{out}}
'''output'''
<pre style="height:70ex">
·······················│·······················
Anonymous user