DO NOT REPLY [Bug 45391] New: Line dimensions are not proper when read from a PPT

View: New views
2 Messages — Rating Filter:   Alert me  

DO NOT REPLY [Bug 45391] New: Line dimensions are not proper when read from a PPT

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=45391

           Summary: Line dimensions are not proper when read from a PPT
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
        AssignedTo: dev@...
        ReportedBy: vinu.kumar@...


Created an attachment (id=22250)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22250)
Sampe ppt for the bug

Following code is for reading a line in the ppt and converting to a graphics
object.

// Read all shapes
...

if  (type == ShapeTypes.Line)
{
  Line l = (Line)s;
  Rectangle a = l.getAnchor();
  int w = a.width;
  int h = a.height;
  double x = a.getX();
  double y = a.getY();

  BufferedImage img = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  Graphics2D g = img.createGraphics();
  l.draw(graphics);
  // ... Draw the image

}

The issue is the height and width returned from anchor is smaller that actual
size.

If a ppt has a table, the table is drawn half.


--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


DO NOT REPLY [Bug 45391] Line dimensions are not proper when read from a PPT

by Bugzilla from bugzilla@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

https://issues.apache.org/bugzilla/show_bug.cgi?id=45391


Yegor Kozlov <yegor@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #1 from Yegor Kozlov <yegor@...>  2008-07-21 11:08:32 PST ---
Anchor doesn't take into account the line width.
If you want to draw individual lines you need to set the image dimensions
as max(linewidth, anchor.width) and max(linewidth, anchor.height):

   Rectangle2D a = l.getAnchor2D();
   double w = Math.max(a.getWidth(), l.getLineWidth());
   double h = Math.max(a.getHeight(), l.getLineWidth());

   BufferedImage img = new BufferedImage((int) Math.round(w), (int)
Math.round(h), BufferedImage.TYPE_INT_RGB);

Regards,
Yegor


--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...