当前位置: 首页>>代码示例>>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;未经允许,请勿转载。