Bitmap/Bresenham's line algorithm: Difference between revisions

Content deleted Content added
imported>Chinhouse
Chkas (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 10:
{{trans|Python}}
 
<syntaxhighlight lang="11l">T Colour = BVec3
Byte r, g, b
 
F (r, g, b)
.r = r
.g = g
.b = b
 
F ==(other)
R .r == other.r & .g == other.g & .b == other.b
 
V black = Colour(0, 0, 0)
Line 109 ⟶ 100:
+-----------------+
</pre>
 
=={{header|360 Assembly}}==
{{trans|Rexx}}
Line 1,476 ⟶ 1,468:
=={{header|EasyLang}}==
 
[https://easylang.devonline/show/#cod=XZHNboMwEITvPMUeG0W4NrSHSnHehQRHQkoJMiRl3z6zePkrAsv7MTNe2118XKnrw0AjMRkyGRH9Pl4B9Sd9gWEUFsN1IGuK72nITNaJs47V371pobbElkZH7OaUeiRP1aWnD+AcioPQXmjuZNrcxHaCS6r531SkAJ4DWAJYA3gbwBLASwDvAkKMokVO3byoUAv6OiNbLUkDtkhM2m4XqkE16Xxkhwqe7dDchXjZctXW0odf+wgFKiRriUVBzuhkVKIL535tBA8Cjx6noMTs7KedVNxH6XtFnNy8dRtc1HJHhbXk5LUyXbmC6St/7N4AQOV/R7lxOJu9AQ== Run it]
 
{{trans|C}}
Line 1,519 ⟶ 1,511:
drawline 300 200 200 10
</syntaxhighlight>
 
 
=={{header|Elm}}==
Line 2,836 ⟶ 2,827:
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro].
<syntaxhighlight lang="miniscript">
Img.linedrawLine = function(img, x0, y0, x1, y1, colr)
Img = new Image
Img.create = function(w,h,c)
if c == null then c = color.black
i = Image.create(w,h, c)
j = new Img
j._handle = i._handle
j.width = w
j.height = h
return j
end function
Img.pixelColor = color.white
Img.line = function(x0, y0, x1, y1)
sign = function(a, b)
if a < b then return 1
Line 2,867 ⟶ 2,847:
while true
selfimg.setPixel x0, y0, self.pixelColorcolr
if x0 == x1 and y0 == y1 then break
e2 = err
Line 2,879 ⟶ 2,859:
end if
end while
self.setPixel x0, y0, self.pixelColor
end function
 
img= ImgImage.create(320, 320)
drawLine img.line, 0, 0, 250, 300, color.red
gfx.clear
gfx.drawImage img, 0, 0
 
</syntaxhighlight>