Repository navigation
Draw the line art of Line Attributes - #240
Merged
Merged
Conversation
Lines were drawn from corner to corner of the object's box, centred on that path, so a line thicker than 1 px came out slanted and half clipped: a 40x8 line with line width 8 was a parallelogram instead of a solid bar (Open-Agriculture#231). Lines only 1 px high or wide ignored the line width. ISO 11783-6 (B.10.1, Figure B.4) draws every point with a square paintbrush of the line width, the point being the brush's upper left corner. The line now runs from (0, 0) to (width - line width, height - line width), or mirrored for bottom left to top right, with the brush painted at each point of a Bresenham line. Where the box is narrower than the brush, the end point stays at 0 and the brush is clipped to the box, as in the figure's examples. A line width of 0 draws nothing, as for rectangles. Closes Open-Agriculture#231 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Gunics Balázs <gunicsba@gmail.com>
With any side suppressed, the remaining sides were drawn with drawLine along the box edges. drawLine centres the stroke on the edge, so half of every side was clipped away: line width 2 showed as 1 px, and the right and bottom sides, on x = width and y = height, were mostly outside the box (Open-Agriculture#232). ISO 11783-6 draws shapes with a square paintbrush of the line width that stays inside the object's box. Each side that is not suppressed is now a strip of the line width along the inside of its edge, which is also what drawRect did for rectangles without suppressed sides, so those look the same. Closes Open-Agriculture#232 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Gunics Balázs <gunicsba@gmail.com>
The line art of a Line Attributes object was not used anywhere, so dashed and dotted lines were drawn solid (Open-Agriculture#233). ISO 11783-6 (B.14.3) gives it one bit per paintbrush spot, the size of the line width, read from the most significant bit and repeated every 16 spots: 1 bits are drawn in the line colour, 0 bits are skipped. - Output Line: each point of the brush line is drawn only if the bit of its spot (its step along the line divided by the brush size) is set. - Output Rectangle: the pattern runs clockwise around the box from the top left corner, one bit per brush sized spot along the sides; a suppressed side still takes its share of the pattern. - Output Ellipse and Output Polygon, which are drawn as strokes: the pattern becomes dashes and gaps, one line width per bit. Solid lines (0xFFFF) are drawn as before. Closes Open-Agriculture#233 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Gunics Balázs <gunicsba@gmail.com>
The brush reaches brush size - 1 steps past its point, so every dash grew into the gap after it: with a 5 px line, 0x5555 drew 9 px dashes and 1 px gaps. The brush is now painted only where everything it covers is drawn, so a bit is exactly one line width along the line, as on the NX9 and Solsteer View-T in Open-Agriculture#233. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instead of skipping the whole brush when it covers a skipped spot, only the slices of the brush that cover drawn spots are painted. Dashes and gaps stay one line width long, and a spot cut short by the end of the line is now drawn for the part that fits, as the NX9 does in Open-Agriculture#233. All six lines of data mask 1009 in that pool now match the NX9 pixel for pixel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Open-Agriculture#238 was squashed into main as it is in this branch, so the branch's OutputLineComponent.cpp, which builds on it, is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sujandumaru
reviewed
Nov 5, 2026
A dash painted the brush at every point of the line, keeping the slices in its spot. On a sloped line the brush after a step reached one row past the spot, which added a pixel to the dash. ISO 11783-6:2018 Figure B.15 shows each spot as one brush, at the point that many brush sizes along the line. A spot cut short by the end of the line is the part of the last brush that fits, so straight lines draw the same pixels. Also cite the figures by their 2018 numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gunicsba
added a commit
to gunicsba/AgIsoVirtualTerminal
that referenced
this pull request
Nov 5, 2026
The stack and the VT don't use anonymous namespaces, and members are easier to spot and share with similar objects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sujandumaru
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #233.
The line art of a Line Attributes object was not used anywhere, so every dashed and dotted line was drawn solid. ISO 11783-6:2018 (B.14.3, Table B.48, Figures B.14 and B.15) gives it one bit per paintbrush spot, the size of the line width, read from the most significant bit and repeated every 16 spots. 1 bits are drawn in the line colour, and 0 bits are skipped so the background shows.
Solid lines (
0xFFFF) take the same code path as before. The helper is the new header-onlyinclude/LineArt.hpp.Before and after, over the whole collection
I rendered all 30 pools of AgIsoObjectPoolCollection with vt-render, with #238 and #239 applied, with and without this commit. 6 of 3,970 images changed: one mask and its screen in each of
627223e9,a4b54f27andecd03d36. No solid shape changed, so solid rectangles, ellipses and polygons look as before. The collection has 246 dashed shapes, but most are in containers that start hidden.The Väderstad planter (
a4b54f27) draws a small chart whose ±5 and ±10 gridlines are dotted and whose 0 line is solid. Before, all the gridlines looked alike:The whole mask, before, diff and after:
Notes
The collection images above were made before the two Output Line commits, which shorten the dashes of dashed Output Lines to one line width per bit.
With the one brush per spot rule, 26 of 4,170 images change compared with the rule before it, all in
c99438bd(samplePool3):dm_1008, the soft key mask and the screens that show it.Difference from the NX9 on sloped lines: the dash lengths and extents match, but the NX9's pattern is one bit earlier than ours. On line 13019 (
2727, width 5) its dashes start at 5, 20 and 45 px and ours at 10 and 25 px. Straight lines are not shifted. Figure B.15 b and c start with the first bit of the pattern, so this PR follows the figure. The Solsteer View-T differs from both, and 4.6.21 leaves the exact presentation to the VT.🤖 Generated with Claude Code