當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageObserver.WIDTH屬性代碼示例

本文整理匯總了Java中java.awt.image.ImageObserver.WIDTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java ImageObserver.WIDTH屬性的具體用法?Java ImageObserver.WIDTH怎麽用?Java ImageObserver.WIDTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.image.ImageObserver的用法示例。


在下文中一共展示了ImageObserver.WIDTH屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setDimensions

public void setDimensions(int w, int h) {
    if (src != null) {
        src.checkSecurity(null, false);
    }

    image.setDimensions(w, h);

    newInfo(image, (ImageObserver.WIDTH | ImageObserver.HEIGHT),
            0, 0, w, h);

    if (w <= 0 || h <= 0) {
        imageComplete(ImageConsumer.IMAGEERROR);
        return;
    }

    if (width != w || height != h) {
        // dimension mismatch => trigger recreation of the buffer
        bimage = null;
    }

    width = w;
    height = h;

    availinfo |= ImageObserver.WIDTH | ImageObserver.HEIGHT;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:ImageRepresentation.java

示例2: imageUpdate

@Override
public boolean imageUpdate(Image img, int infoflags, int x, int y,
    int width, int height) {

    if (image != img) {
        throw new RuntimeException("Original image is not passed "
            + "to the observer");
    }

    if ((infoflags & ImageObserver.WIDTH) != 0) {
        if (width != IMAGE_WIDTH) {
            throw new RuntimeException("Original width is not passed "
                + "to the observer");
        }
    }

    if ((infoflags & ImageObserver.HEIGHT) != 0) {
        if (height != IMAGE_HEIGHT) {
            throw new RuntimeException("Original height is not passed "
                + "to the observer");
        }
    }

    return (infoflags & ALLBITS) == 0;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:MultiResolutionImageTest.java

示例3: setDimensions

@Override
    public void setDimensions(int w, int h){
        if (src != null) {
            src.checkSecurity(null, false);
        }
        
        image.setDimensions(w, h);
//        bitmap = new cli.System.Drawing.Bitmap(w, h);
        
        newInfo(image, (ImageObserver.WIDTH | ImageObserver.HEIGHT),
                0, 0, w, h);

        if (w <= 0 || h <= 0) {
            imageComplete(ImageConsumer.IMAGEERROR);
            return;
        }

        width = w;
        height = h;

        availinfo |= ImageObserver.WIDTH | ImageObserver.HEIGHT;
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:ImageRepresentation.java

示例4: imageUpdate

@Override
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {

    if (image != img) {
        throw new RuntimeException("Original image is not passed to the observer");
    }

    if ((infoflags & ImageObserver.WIDTH) != 0) {
        if (width != IMAGE_WIDTH) {
            throw new RuntimeException("Original width is not passed to the observer");
        }
    }

    if ((infoflags & ImageObserver.HEIGHT) != 0) {
        if (height != IMAGE_HEIGHT) {
            throw new RuntimeException("Original height is not passed to the observer");
        }
    }

    return (infoflags & ALLBITS) == 0;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:21,代碼來源:MultiResolutionImageTest.java

示例5: getWidth

/**
 * Return the width of the original image source.
 * If the width isn't known, then the image is reconstructed.
 */
public int getWidth() {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.WIDTH) == 0) {
        reconstruct(ImageObserver.WIDTH);
    }
    return width;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:ToolkitImage.java

示例6: infoDone

synchronized void infoDone(int status) {
    if (status == ImageConsumer.IMAGEERROR ||
        ((~availinfo) & (ImageObserver.WIDTH |
                         ImageObserver.HEIGHT)) != 0) {
        addInfo(ImageObserver.ERROR);
    } else if ((availinfo & ImageObserver.PROPERTIES) == 0) {
        setProperties(null);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:ToolkitImage.java

示例7: check

public int check(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.ERROR) == 0 &&
        ((~availinfo) & (ImageObserver.WIDTH |
                         ImageObserver.HEIGHT |
                         ImageObserver.PROPERTIES)) != 0) {
        addWatcher(iw, false);
    }
    return availinfo;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:ToolkitImage.java

示例8: getWidth

/**
 * Return the width of the original image source.
 * If the width isn't known, then the ImageObserver object will be
 * notified when the data is available.
 */
public synchronized int getWidth(ImageObserver iw) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    if ((availinfo & ImageObserver.WIDTH) == 0) {
        addWatcher(iw, true);
        if ((availinfo & ImageObserver.WIDTH) == 0) {
            return -1;
        }
    }
    return width;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:ToolkitImage.java

示例9: imageUpdate

public boolean imageUpdate(Image img, int flags, int x, int y,
                           int newWidth, int newHeight ) {
    if (img != image && img != disabledImage ||
        image == null || getParent() == null) {

        return false;
    }

    // Bail out if there was an error:
    if ((flags & (ABORT|ERROR)) != 0) {
        repaint(0);
        synchronized(ImageView.this) {
            if (image == img) {
                // Be sure image hasn't changed since we don't
                // initialy synchronize
                image = null;
                if ((state & WIDTH_FLAG) != WIDTH_FLAG) {
                    width = DEFAULT_WIDTH;
                }
                if ((state & HEIGHT_FLAG) != HEIGHT_FLAG) {
                    height = DEFAULT_HEIGHT;
                }
            } else {
                disabledImage = null;
            }
            if ((state & LOADING_FLAG) == LOADING_FLAG) {
                // No need to resize or repaint, still in the process
                // of loading.
                return false;
            }
        }
        updateAltTextView();
        safePreferenceChanged();
        return false;
    }

    if (image == img) {
        // Resize image if necessary:
        short changed = 0;
        if ((flags & ImageObserver.HEIGHT) != 0 && !getElement().
              getAttributes().isDefined(HTML.Attribute.HEIGHT)) {
            changed |= 1;
        }
        if ((flags & ImageObserver.WIDTH) != 0 && !getElement().
              getAttributes().isDefined(HTML.Attribute.WIDTH)) {
            changed |= 2;
        }

        synchronized(ImageView.this) {
            if ((changed & 1) == 1 && (state & WIDTH_FLAG) == 0) {
                width = newWidth;
            }
            if ((changed & 2) == 2 && (state & HEIGHT_FLAG) == 0) {
                height = newHeight;
            }
            if ((state & LOADING_FLAG) == LOADING_FLAG) {
                // No need to resize or repaint, still in the process of
                // loading.
                return true;
            }
        }
        if (changed != 0) {
            // May need to resize myself, asynchronously:
            safePreferenceChanged();
            return true;
        }
    }

    // Repaint when done or when new pixels arrive:
    if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
        repaint(0);
    }
    else if ((flags & SOMEBITS) != 0 && sIsInc) {
        repaint(sIncRate);
    }
    return ((flags & ALLBITS) == 0);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:77,代碼來源:ImageView.java

示例10: getResolutionVariantObserver

public static ImageObserver getResolutionVariantObserver(
        final Image image, final ImageObserver observer,
        final int imgWidth, final int imgHeight,
        final int rvWidth, final int rvHeight, boolean concatenateInfo) {

    if (observer == null) {
        return null;
    }

    synchronized (ObserverCache.INSTANCE) {
        ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(observer);

        if (o == null) {

            o = (Image resolutionVariant, int flags,
                    int x, int y, int width, int height) -> {

                        if ((flags & (ImageObserver.WIDTH | BITS_INFO)) != 0) {
                            width = (width + 1) / 2;
                        }

                        if ((flags & (ImageObserver.HEIGHT | BITS_INFO)) != 0) {
                            height = (height + 1) / 2;
                        }

                        if ((flags & BITS_INFO) != 0) {
                            x /= 2;
                            y /= 2;
                        }

                        if(concatenateInfo){
                            flags &= ((ToolkitImage) image).
                                    getImageRep().check(null);
                        }

                        return observer.imageUpdate(
                                image, flags, x, y, width, height);
                    };

            ObserverCache.INSTANCE.put(observer, o);
        }
        return o;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:44,代碼來源:MultiResolutionToolkitImage.java


注:本文中的java.awt.image.ImageObserver.WIDTH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。