Pencil tool precision on zoomed canvas

Bug #672232 reported by aaulia
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Pinta
Fix Released
Medium
Unassigned

Bug Description

OS: Ubuntu 10.10
Pinta 0.5
How to reproduce: create a 32x32 canvas, zoom to something like 1000%, turn on grid, try using the pencil tool, the pixel appear not in the area/grid that I was clicking, instead it appear on the adjacent grid.

Tags: basic
Revision history for this message
Jonathan Pobst (jpobst) wrote :
Changed in pinta:
importance: Undecided → Medium
milestone: none → 0.6
status: New → Fix Committed
Revision history for this message
aaulia (aaulia) wrote :

Just want to update on this issue, this is not yet fixed in 0.6, I just tried the 0.6 release by building the source found on the Pinta website, and the issue is still there. I mainly doing pixel art for hobby, I love Paint.NET a lot, which is why I use Pinta on Linux, but this bug is hindering me in using Pinta comfortably :(

Changed in pinta:
status: Fix Committed → Incomplete
Revision history for this message
Shrimp (shrimpie) wrote :

The problem seems to be when you hold down the mouse button to continue painting. It works as expected on single clicks.

1. 32 x 32 canvas
2. Zoom 3600%
3. Turn on pixel grid
4. Choose pencil tool
5. Click on a box; while the mouse button is still down, move to the next box on the right (it paints to the top of the first box)

Revision history for this message
grofaty (grofaty) wrote :

I tried this on Pinta 0.6 on Windows XP sp3, but can't reproduce the problem. Maybe this is only on Pinta/Ubuntu.

aaulia, I have changed status to New. "Incomplete" status in Launchpad is for reported bugs that don't have enough info for developer to work on, so developers SKIP reading incomplete bug report until sufficient info is provided by bug reporter.

Changed in pinta:
status: Incomplete → New
Revision history for this message
Jonathan Pobst (jpobst) wrote :

Interesting, this does indeed only seem to occur on Linux and not on Windows.

Jonathan Pobst (jpobst)
Changed in pinta:
milestone: 0.6 → none
Revision history for this message
David Collins (davidapc) wrote :

This seems to be a Cairo bug on function "LineTo"
When given the startPoint and endpoint, it seems to offset the pixel location by -1 horzontal, and -1 vertical.
For instance, given "MoveTo" 1,1 and LineTo 1,2, the pixels that get filled in are 0,0 and 0,1

Revision history for this message
David Collins (davidapc) wrote :

Okay, I think I've got it.
Essentially, we are asking Cairo to draw a "between" pixels. Cairo takes the coordinates 0.5, 0.5 to be in the middle of the top left pixel, so if you give it the coordinates of 1,1, it will take that to be the bottom right corner of the top left pixel, but it can also be interpreted as the corner of three other pixels (the surrounding pixels).

From what I can guess, if a coordinate is given that could easily belong to more than one pixel, Cairo selects the Pixel to choose differently depending on what platform it's on (Windows, Ubuntu etc.), hence this bug.

To fix this, I've offset the values so that the pencil always draw starting in the middle of the pixel, to the middle of the other pixel (we could use the absolute values to give super accuracy, but that might be a bit much for now)

I've included a patch that should fix the Pencil, however the same fundamental problem affects a few other tools like Paintbrush and eraser (if you restrict them to 1px and zoom in).

Revision history for this message
Jonathan Pobst (jpobst) wrote :

Committed in https://github.com/jpobst/Pinta/commit/47e72fa009e550f438cec95df4a9735c58719e06.

Thanks for tracking this down and providing a patch!

Changed in pinta:
milestone: none → 0.7
status: New → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

I have installed Pinta 0.7 on Ubuntu 10.10 using PPA from nilarimogard/webupd8. More info about PPA: http://www.webupd8.org/2011/03/install-pinta-07-drawing-image-editing.html

Problem is fixed.

Changed in pinta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.