⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawing.java

📁 实现JAVA界面的代码GWT
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public double getY()
    {
        if(!initialized)
            initialize();
        return y;
    }

    public void setY(double y)
    {
        if(origin == Origin.READ)
        {
            if(!initialized)
                initialize();
            origin = Origin.READ_WRITE;
        }
        this.y = y;
    }

    public double getWidth()
    {
        if(!initialized)
            initialize();
        return width;
    }

    public void setWidth(double w)
    {
        if(origin == Origin.READ)
        {
            if(!initialized)
                initialize();
            origin = Origin.READ_WRITE;
        }
        width = w;
    }

    public double getHeight()
    {
        if(!initialized)
            initialize();
        return height;
    }

    public void setHeight(double h)
    {
        if(origin == Origin.READ)
        {
            if(!initialized)
                initialize();
            origin = Origin.READ_WRITE;
        }
        height = h;
    }

    private EscherContainer getReadSpContainer()
    {
        if(!initialized)
            initialize();
        return readSpContainer;
    }

    public byte[] getImageData()
    {
        Assert.verify(origin == Origin.READ || origin == Origin.READ_WRITE);
        if(!initialized)
            initialize();
        return drawingGroup.getImageData(blipId);
    }

    public byte[] getImageBytes()
        throws IOException
    {
        if(origin == Origin.READ || origin == Origin.READ_WRITE)
            return getImageData();
        Assert.verify(origin == Origin.WRITE);
        if(imageFile == null)
        {
            Assert.verify(imageData != null);
            return imageData;
        } else
        {
            byte data[] = new byte[(int)imageFile.length()];
            FileInputStream fis = new FileInputStream(imageFile);
            fis.read(data, 0, data.length);
            fis.close();
            return data;
        }
    }

    public ShapeType getType()
    {
        return type;
    }

    public void writeAdditionalRecords(jxl.write.biff.File outputFile)
        throws IOException
    {
        if(origin == Origin.READ)
        {
            outputFile.write(objRecord);
            return;
        } else
        {
            ObjRecord objrec = new ObjRecord(objectId, ObjRecord.PICTURE);
            outputFile.write(objrec);
            return;
        }
    }

    public void writeTailRecords(jxl.write.biff.File file)
        throws IOException
    {
    }

    public double getColumn()
    {
        return getX();
    }

    public double getRow()
    {
        return getY();
    }

    public boolean isFirst()
    {
        return msoDrawingRecord.isFirst();
    }

    public boolean isFormObject()
    {
        return false;
    }

    public void removeRow(int r)
    {
        if(y > (double)r)
            setY(r);
    }

    private double getWidthInPoints()
    {
        if(sheet == null)
        {
            logger.warn("calculating image width:  sheet is null");
            return 0.0D;
        }
        int firstCol = (int)x;
        int lastCol = (int)Math.ceil(x + this.width) - 1;
        CellView cellView = sheet.getColumnView(firstCol);
        int firstColWidth = cellView.getSize();
        double firstColImageWidth = (1.0D - (x - (double)firstCol)) * (double)firstColWidth;
        double pointSize = cellView.getFormat() == null ? 10D : cellView.getFormat().getFont().getPointSize();
        double firstColWidthInPoints = (firstColImageWidth * 0.58999999999999997D * pointSize) / 256D;
        int lastColWidth = 0;
        double lastColImageWidth = 0.0D;
        double lastColWidthInPoints = 0.0D;
        if(lastCol != firstCol)
        {
            cellView = sheet.getColumnView(lastCol);
            lastColWidth = cellView.getSize();
            lastColImageWidth = ((x + this.width) - (double)lastCol) * (double)lastColWidth;
            pointSize = cellView.getFormat() == null ? 10D : cellView.getFormat().getFont().getPointSize();
            lastColWidthInPoints = (lastColImageWidth * 0.58999999999999997D * pointSize) / 256D;
        }
        double width = 0.0D;
        for(int i = 0; i < lastCol - firstCol - 1; i++)
        {
            cellView = sheet.getColumnView(firstCol + 1 + i);
            pointSize = cellView.getFormat() == null ? 10D : cellView.getFormat().getFont().getPointSize();
            width += ((double)cellView.getSize() * 0.58999999999999997D * pointSize) / 256D;
        }

        double widthInPoints = width + firstColWidthInPoints + lastColWidthInPoints;
        return widthInPoints;
    }

    private double getHeightInPoints()
    {
        if(sheet == null)
        {
            logger.warn("calculating image height:  sheet is null");
            return 0.0D;
        }
        int firstRow = (int)y;
        int lastRow = (int)Math.ceil(y + this.height) - 1;
        int firstRowHeight = sheet.getRowView(firstRow).getSize();
        double firstRowImageHeight = (1.0D - (y - (double)firstRow)) * (double)firstRowHeight;
        int lastRowHeight = 0;
        double lastRowImageHeight = 0.0D;
        if(lastRow != firstRow)
        {
            lastRowHeight = sheet.getRowView(lastRow).getSize();
            lastRowImageHeight = ((y + this.height) - (double)lastRow) * (double)lastRowHeight;
        }
        double height = 0.0D;
        for(int i = 0; i < lastRow - firstRow - 1; i++)
            height += sheet.getRowView(firstRow + 1 + i).getSize();

        double heightInTwips = height + (double)firstRowHeight + (double)lastRowHeight;
        double heightInPoints = heightInTwips / 20D;
        return heightInPoints;
    }

    public double getWidth(LengthUnit unit)
    {
        double widthInPoints = getWidthInPoints();
        return widthInPoints * LengthConverter.getConversionFactor(LengthUnit.POINTS, unit);
    }

    public double getHeight(LengthUnit unit)
    {
        double heightInPoints = getHeightInPoints();
        return heightInPoints * LengthConverter.getConversionFactor(LengthUnit.POINTS, unit);
    }

    public int getImageWidth()
    {
        return getPngReader().getWidth();
    }

    public int getImageHeight()
    {
        return getPngReader().getHeight();
    }

    public double getHorizontalResolution(LengthUnit unit)
    {
        int res = getPngReader().getHorizontalResolution();
        return (double)res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit);
    }

    public double getVerticalResolution(LengthUnit unit)
    {
        int res = getPngReader().getVerticalResolution();
        return (double)res / LengthConverter.getConversionFactor(LengthUnit.METRES, unit);
    }

    private PNGReader getPngReader()
    {
        if(pngReader != null)
            return pngReader;
        byte imdata[] = null;
        if(origin == Origin.READ || origin == Origin.READ_WRITE)
            imdata = getImageData();
        else
            try
            {
                imdata = getImageBytes();
            }
            catch(IOException e)
            {
                logger.warn("Could not read image file");
                imdata = new byte[0];
            }
        pngReader = new PNGReader(imdata);
        pngReader.read();
        return pngReader;
    }

    static Class class$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw new NoClassDefFoundError(x1.getMessage());
    }

    static 
    {
        logger = Logger.getLogger(class$jxl$biff$drawing$Drawing != null ? class$jxl$biff$drawing$Drawing : (class$jxl$biff$drawing$Drawing = class$("jxl.biff.drawing.Drawing")));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -