Line has enough info to translate ppt commands into Java graphics calls.

The sample code is below.

    public void draw(Graphics2D graphics, Line line){
        java.awt.Rectangle anchor = line.getAnchor();
        Color color = line.getLineColor();
        if (color != null){
            graphics.setColor(color);
            float width = (float)line.getLineWidth();
            Stroke stroke = new BasicStroke(width);
            graphics.setStroke(stroke);

            EscherSpRecord spRecord = 
line.getSpContainer().getChildById(EscherSpRecord.RECORD_ID);
            
            boolean flipped = (spRecord.getFlags() & 
EscherSpRecord.FLAG_FLIPVERT) != 0;
            if (flipped)
                graphics.drawLine(anchor.x, anchor.y+anchor.height, 
anchor.x+anchor.width, anchor.y);
            else
                graphics.drawLine(anchor.x, anchor.y, anchor.x+anchor.width, 
anchor.y+anchor.height);
        }
    }

Yegor
    

q> hi.... I am writing an application java that, taken in input a file .ppt, it
q> allows to display it in a window similar to that used in PowerPoint. Until
q> now I have developed these points:
q> - TextBox (I have to resolve a problem on the color of the font.... there is
q> no match among the color of PowerPoint and that extracted by the font);
q> - Image;
q> I now have a problem with the lines..... I have not found a method to
q> extract the start point and the end point of the line..... the information
q> extracted by the anchor are not enough to be able to redraw the line.....
q> so.... if someone can help me..... thanks to everybody
q> sorry for my english....


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to