kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28254
GerbView GAL: issue with draw order and negative items
Hi all,
I've run into a problem while porting GerbView to GAL that doesn't have an
obvious best solution to me, so I thought I would ask those with more
knowledge of the GAL for ideas.
Gerber files rely on a fixed draw order. This becomes important when some
draw objects in the file are negative, because they must "unpaint" things
that appeared earlier in the file, but not things later in the file.
My initial approach to the GAL port was to create a painter that paints
each GERBER_DRAW_ITEM, and add all GERBER_DRAW_ITEMS to the VIEW upon file
load. This works, as long as there aren't negative objects in the Gerber
file. Since VIEW calls upon objects to be painted in an order that doesn't
necessarily have anything to do with the order they were added to the VIEW
(because of being stored in an R-Tree), negative objects don't properly
mask positive ones.
One solution would be to just add entire Gerber images to the VIEW instead
of the draw objects within the images, and then the drawing code could draw
all items at once and make sure to do it in the right order, but this seems
like an ugly hack and I think it would bypass the off-screen object culling
and possibly cause other problems / make some features harder to implement.
Another would be to implement some sort of render order sorting inside
VIEW, but I haven't looked in to that much yet, so I'm not sure how
complicated it would be.
Does anyone have suggestions for this problem?
Thanks,
Jon
Follow ups