Issue 120707 - When converting to bitmaps, thick lines with line cap 'Flat' generate additional space
Summary: When converting to bitmaps, thick lines with line cap 'Flat' generate additio...
Status: CONFIRMED
Alias: None
Product: Draw
Classification: Application
Component: editing (show other issues)
Version: 3.4.0
Hardware: PC Windows XP
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2012-08-24 22:51 UTC by Lance Gropper
Modified: 2012-09-05 21:56 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Export of problems. (8.68 KB, image/png)
2012-08-24 22:51 UTC, Lance Gropper
no flags Details
Simplified Example (10.19 KB, application/vnd.oasis.opendocument.graphics)
2012-08-28 15:41 UTC, Lance Gropper
no flags Details
Strange color demo (8.31 KB, application/vnd.oasis.opendocument.graphics)
2012-08-28 15:49 UTC, Lance Gropper
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Lance Gropper 2012-08-24 22:51:51 UTC
Created attachment 79132 [details]
Export of problems.

When a object or group is converted to a bitmap, strange things happen - sometimes there is a resize on one axis by 1 pixel, and sometimes colors are introduced that weren't there. The attached image was created entirely in OO Draw. Here's a description of how it was made, and what is wrong: This was done with the grid set to 0.25" vertically and horizontally - i.e. 4 squares per inch. The black background was only made to show the white edges. The corners were made by creating a 45 degree white line, converting it to a curve, then setting the curve handles so each was half-way vertically above or horizontally away from the point. The line thickness was set to the second level of thickness. The color was changed to white. The background started off as a grey square, with the border set to 0" invisible. All grey squares were copied from this one before anything was done to it. One corner was deleted, then the two corners which go against the curve were converted to curves as was the line. This was moved to be behind the line (line was set to front), and it was grouped. The middle is just a square, the sides just have vertical lines. The ones with lines running through the middle just had additional horizontal lines added. Again, all grey areas have the borders set to a width of 0" with the line being invisible. Each one with more than one object was grouped. Each one was clicked on and the convert to bitmap function was used. Here's a description of the problems: For starters, after conversion, the corners no longer lined up with the snap points, and all squares were realigned/re-snapped. I think this is because it used the thickness of the curves and lines and added them to the grey areas. But in addition to this: If you look very carefully, the upper and lower two curves have white lines along the inner edges. Both of the left and right sides have white lines on the upper and lower edges. The top and bottom squares have white lines on the left and right sides. The top square has no white line on the bottom, but the bottom square has a white line on the top. The upper middle square has a white line on the left and top. The lower middle square has white lines all around.

So to sum it up: One problem looks like mine, but the other does not: The problem which is mine apparently is not taking into consideration the thickness of the outer lines when converting it to a bitmap, so the bitmaps didn't line up after being resized, but the main concern is that the extra white lines are appearing all over the place - and it's not artifacting - they really are in the image, and aren't even consistent in each square.
Comment 1 Regina Henschel 2012-08-25 14:46:41 UTC
Your report is hard to read. Please reduce your scenario to as little as possible to show the defect. Please do not only attach the resulting bitmap but the original odg-file too.

Please try to distinguish between errors when using thick lines and other errors. Please look at bug 113080 in addition.

AOO 3.4.1 is out, please try it there.

How do you generate the bitmap? Do you use Modify > Convert > Bitmap? Or do you use File > Export > png? Or do you copy the object and then insert it as bitmap?

The generated bitmap depends on the Anti-Aliasing setting. What is your setting in Tools > Options > OpenOffice.org > View?
Comment 2 Lance Gropper 2012-08-28 15:41:41 UTC
Created attachment 79202 [details]
Simplified Example
Comment 3 Lance Gropper 2012-08-28 15:44:35 UTC
Hello Regina:

Attached is a "simplified example" of one of the two problems. What was done is the grid was set to 0.25", a diagonal 1" line was drawn. It was converted to a curve using the point edit function, converting each point to a curve, and draging the handles vertically or horizontally to 1/2" away from the point, so the curve is a 90 degree curve. The line thickness was changed to 0.10". The space this curve occupies is exactly 1"x1". I duplicated the curve, then using the Modify->Convert->To Bitmap function. The result is the bitmap is no longer 1"x1" - it is now 1.1"x1.1".

To keep it simple, I'm sending the second example separately...

Lance
Comment 4 Lance Gropper 2012-08-28 15:49:28 UTC
Created attachment 79203 [details]
Strange color demo

Second example:

This one is intermittent/unpredictable, so it didn't completely do it this time, but here's the description: Using again the 0.25"x0.25" grid, I created a black square. I duplicated it and used the Modify->Convert->To Bitmap on the duplicate. The duplicate now has a top-edge which is not black (it's light grey). It's not anti-aliasing, or the grey would be all the way around, plus the background has no color, so how would it know what color to add as an intermediary between the black and "nothing." There are two other parts to this: 1) It does not always occur on the same side of the square - sometimes other side(s) or all sides; and 2) On occasion (not always, but this is the main bug), it will export with this grey line (when using File->Export->Selection, and choosing PNG).
Comment 5 Regina Henschel 2012-08-28 18:25:10 UTC
The second example shows the correct and desired behavior, when Anti-Aliasing is enabled. Goto Tools > Options > OpenOffice.org > View and uncheck "Use Anti-Aliasing". When you then convert the drawing to bitmap no gray pixels are added.

The first example shows a bug.

To reproduce the bug:
1. Draw a line. (any straight line, arc, any line)
2. Set the line width to 1 cm.
3. Make sure, that the line ends are set to 'Flat'.
4. Context menu > Convert > To Bitmap
5. Context menu of bitmap > Line > Continuous
Notice, that there is space between line end and the border line of the bitmap.

You get the same error this way:
4. Copy line to clipboard
5. Insert special with kind 'bitmap'.
Now you get a bitmap with white background. Set the page background to a color and you see again, that there is space between line end and picture edge.

If you set the line ends to 'Square' or to 'Round' and do steps 4 and 5 again, you can notice, that now the bitmap has the correct size and you can notice that the space in case of 'Flat' line ends are the same as the additional room needed for the line caps. But the error was not introduced with line caps, it can be seen already in OOo3.2
Comment 6 Lance Gropper 2012-08-28 18:28:17 UTC
Hello Regina:

But it's not antialiasing - it's adding a grey line to the top. If it were antialiasing, each row of pixels in the bitmap would have grey pixels on the left and right side - it's only adding one pixel of grey to the top...

Lance
Comment 7 Regina Henschel 2012-08-28 19:31:07 UTC
You are right, the gray pixel should be on all edges or on no one. But that is another issue. I have written bug 120744.
Comment 8 Armin Le Grand 2012-09-03 15:47:31 UTC
ALG: Added me to CC
Comment 9 Regina Henschel 2012-09-05 21:56:17 UTC
*** Issue 120825 has been marked as a duplicate of this issue. ***