Search in sources :

Example 1 with ZoomOptions

use of org.intellij.images.options.ZoomOptions in project intellij-community by JetBrains.

the class ZoomOptionsImpl method equals.

public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof ZoomOptions)) {
        return false;
    }
    ZoomOptions otherOptions = (ZoomOptions) obj;
    Dimension prefferedSize = otherOptions.getPrefferedSize();
    return prefferedSize != null && prefferedHeight == prefferedSize.height && prefferedWidth == prefferedSize.width && smartZooming == otherOptions.isSmartZooming() && wheelZooming == otherOptions.isWheelZooming();
}
Also used : ZoomOptions(org.intellij.images.options.ZoomOptions)

Example 2 with ZoomOptions

use of org.intellij.images.options.ZoomOptions in project android by JetBrains.

the class LayeredImageEditor method setImage.

private void setImage(Image image) throws IOException {
    ImageDocument document = myImageEditor.getDocument();
    BufferedImage previousImage = document.getValue();
    document.setValue(Utilities.getDisplayableImage(image));
    String format = image.getFormat() + "/" + image.getColorMode();
    String description = image.getColorProfileDescription();
    if (!description.isEmpty()) {
        format += ", " + description;
    }
    document.setFormat(format);
    // from ImageEditorUI
    ImageZoomModel zoomModel = myImageEditor.getZoomModel();
    if (previousImage == null || !zoomModel.isZoomLevelChanged()) {
        Options options = OptionsManager.getInstance().getOptions();
        ZoomOptions zoomOptions = options.getEditorOptions().getZoomOptions();
        zoomModel.setZoomFactor(1.0d);
        if (zoomOptions.isSmartZooming()) {
            Dimension preferred = zoomOptions.getPrefferedSize();
            if (preferred.width > image.getWidth() && preferred.height > image.getHeight()) {
                double factor = (preferred.getWidth() / (double) image.getWidth() + preferred.getHeight() / (double) image.getHeight()) / 2.0d;
                zoomModel.setZoomFactor(Math.ceil(factor));
            }
        }
    }
}
Also used : ImageZoomModel(org.intellij.images.editor.ImageZoomModel) ZoomOptions(org.intellij.images.options.ZoomOptions) Options(org.intellij.images.options.Options) ZoomOptions(org.intellij.images.options.ZoomOptions) ImageDocument(org.intellij.images.editor.ImageDocument) BufferedImage(java.awt.image.BufferedImage)

Example 3 with ZoomOptions

use of org.intellij.images.options.ZoomOptions in project intellij-community by JetBrains.

the class EditorOptionsImpl method equals.

public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof EditorOptions)) {
        return false;
    }
    EditorOptions otherOptions = (EditorOptions) obj;
    GridOptions gridOptions = otherOptions.getGridOptions();
    TransparencyChessboardOptions chessboardOptions = otherOptions.getTransparencyChessboardOptions();
    ZoomOptions zoomOptions = otherOptions.getZoomOptions();
    return gridOptions != null && gridOptions.equals(getGridOptions()) && chessboardOptions != null && chessboardOptions.equals(getTransparencyChessboardOptions()) && zoomOptions != null && zoomOptions.equals(getZoomOptions());
}
Also used : GridOptions(org.intellij.images.options.GridOptions) ZoomOptions(org.intellij.images.options.ZoomOptions) EditorOptions(org.intellij.images.options.EditorOptions) TransparencyChessboardOptions(org.intellij.images.options.TransparencyChessboardOptions)

Aggregations

ZoomOptions (org.intellij.images.options.ZoomOptions)3 BufferedImage (java.awt.image.BufferedImage)1 ImageDocument (org.intellij.images.editor.ImageDocument)1 ImageZoomModel (org.intellij.images.editor.ImageZoomModel)1 EditorOptions (org.intellij.images.options.EditorOptions)1 GridOptions (org.intellij.images.options.GridOptions)1 Options (org.intellij.images.options.Options)1 TransparencyChessboardOptions (org.intellij.images.options.TransparencyChessboardOptions)1