Align outside border to grid

i hope it is no dupe. If it is then i’m sorry..

I simple want to create a textureatlas for libgdx.

Therefore i try to wrap all my 2D images/textures into one Image and select my desired images within the atlas at runtime.

In Inkscape I setup up a grid with many tiny rectangles which are representing the corresponding area of each image, respecting an aspect ratio of 4:3.

But i start to struggle with a simple pause symbol.

As soon as i stroke the path representing the border of the rectangle i notice that the border breaks out of the corresponding area into the area of another image.

enter image description here

How can i align the outside border to the grid independently of the stroke width.

Any help is appreciated.

Thanks in advance.

Answer

When drawing a line in Inkscape, you’re always drawing the centerline. The stroke will always be centered around that center line you’ve drawn. It has been like this for ages, and we’re still waiting for the day that this changes. However, starting with SVG2, this feature might be implemented, at least in the SVG specification. Hopefully someone will then quickly implement this in Inkscape too.

For now however, you will have to work around this, by either:

  • Using e.g. a 1 px grid, and a 2 px stroke width. Now you can manually snap your centerline exactly 1px inside the outer border.

  • Using snapping to align the visual bounding box to the grid.

You might also be interested in the Pixel-Snap Extension.

Attribution
Source : Link , Question Author : Mike , Answer Author : Wrzlprmft

Leave a Comment