Bitmap/Midpoint circle algorithm: Difference between revisions

Content deleted Content added
Tikkanz (talk | contribs)
Tikkanz (talk | contribs)
m →‎{{header|J}}: drawCircle to drawCircles
Line 402:
)
 
NB.*drawCircledrawCircles v Draws circle(s) (x) on image (y)
NB. x is: 2-item list of boxed (y0 x0 radius) ; (color)
drawCircle=: (1&{:: ;~ [: ; [: <@getBresenhamCircle"1 (0&{::))@[ setPixels ]
</lang>
Line 409:
'''Example usage:'''
<lang j> myimg=: 0 255 0 makeRGB 25 25 NB. 25 by 25 green image
myimg=: (12 12 12 ; 255 0 0) drawCircledrawCircles myimg NB. draw red circle with radius 12
viewRGB ((12 12 9 ,: 12 12 6) ; 0 0 255) drawCircledrawCircles myimg NB. draw two more concentric circles
</lang>