当前位置: 首页>>代码示例>>Java>>正文


Java BufferedImage.TYPE_INT_RGB属性代码示例

本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_INT_RGB属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_INT_RGB属性的具体用法?Java BufferedImage.TYPE_INT_RGB怎么用?Java BufferedImage.TYPE_INT_RGB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.image.BufferedImage的用法示例。


在下文中一共展示了BufferedImage.TYPE_INT_RGB属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNPE

private static void testNPE() {

        Graphics g = null;
        try {
            String test = "\ttest\ttest2";
            BufferedImage buffImage = new BufferedImage(
                    100, 100, BufferedImage.TYPE_INT_RGB);
            g = buffImage.createGraphics();
            Segment segment = new Segment(test.toCharArray(), 0, test.length());
            Utilities.drawTabbedText(segment, 0, 0, g, null, 0);
        } finally {
            if (g != null) {
                g.dispose();
            }
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:bug8134721.java

示例2: testDrawWithNullInfo

/**
 * Draws the chart with a null info object to make sure that no exceptions 
 * are thrown (a problem that was occurring at one point).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        BufferedImage image = new BufferedImage(200 , 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, 
                null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:AreaChartTests.java

示例3: testFix_204072_MissingIcon

/** Tests that multiple instances of the same class propagate well
 * into array of actions of enclosing multiview TopComponent
 */
public void testFix_204072_MissingIcon() {
    final Image img = new BufferedImage( 10, 10, BufferedImage.TYPE_INT_RGB );
    MVElem elem1 = new MVElem();
    MVElem elem2 = new MVElem();
    MultiViewDescription desc1 = new MVDesc("desc1", img, 0, elem1);
    MultiViewDescription desc2 = new MVDesc("desc2", null, 0, elem2);
    TopComponent tc = MultiViewFactory.createMultiView(new MultiViewDescription[] { desc1, desc2 }, desc1);

    tc.open();
    tc.requestActive();
    
    assertEquals( img, tc.getIcon() );
    
    MultiViewTopComponent mvtc = ( MultiViewTopComponent ) tc;
    mvtc.getModel().setActiveDescription( desc2 );
    
    assertEquals( img, tc.getIcon() );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:MultiViewTopComponentTest.java

示例4: reverse

public ImageUtils reverse(boolean isVertical){
    int width = this.dealedImage.getWidth();
    int height = this.dealedImage.getHeight();
    double[] matrix;
    if(isVertical){
        matrix = new double[]{1, 0, 0, -1, 0,height};
    }else {
        matrix = new double[]{-1, 0, 0, 1,width,0};
    }
    AffineTransform affineTransform = new AffineTransform(matrix);
    BufferedImage newImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = newImg.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g.drawRenderedImage(this.dealedImage, affineTransform);
    g.dispose();
    this.dealedImage = newImg;

    return this;
}
 
开发者ID:wolfboys,项目名称:opencron,代码行数:19,代码来源:ImageUtils.java

示例5: paint

@Override
public void paint(Graphics g)
{
    // Gets the canvas to draw in
    BufferedImage bi = new BufferedImage(
        Constant.BOARD_CELL_SIZE * board.countColumns(),
        Constant.BOARD_CELL_SIZE * board.countRows(),
        BufferedImage.TYPE_INT_RGB
    );
    
    Graphics2D canvas = bi.createGraphics();

    // Draws the game in the canvas
    for (int i = 0; i < board.countRows(); ++i)
    {
        for (int j = 0; j < board.countColumns(); ++j)
        {
            board.getCell(new Coord2D(i, j)).draw(canvas);
        }
    }
    
    // Really paints the component
    ((Graphics2D) g).drawImage(bi, 0, 0, this);
}
 
开发者ID:wguilen,项目名称:pacman-mas,代码行数:24,代码来源:BoardGui.java

示例6: createBufferedImage

private static BufferedImage createBufferedImage(final boolean  aa) {
    final BufferedImage bi = new BufferedImage(SIZE, SIZE,
                                               BufferedImage.TYPE_INT_RGB);
    final Graphics2D bg = bi.createGraphics();
    bg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        aa ? RenderingHints.VALUE_ANTIALIAS_ON
                           : RenderingHints.VALUE_ANTIALIAS_OFF);
    bg.setColor(Color.RED);
    bg.fillRect(0, 0, SIZE, SIZE);
    bg.translate(100, 100);
    bg.rotate(Math.toRadians(90));
    bg.setColor(Color.BLACK);
    bg.setFont(bg.getFont().deriveFont(20.0f));
    bg.drawString("MMMMMMMMMMMMMMMM", 0, 0);
    bg.dispose();
    return bi;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:DrawRotatedString.java

示例7: testDrawWithNullInfo

/**
 * Draws the chart with a null info object to make sure that no exceptions 
 * are thrown (a problem that was occurring at one point).
 */
public void testDrawWithNullInfo() {

    boolean success = false;

    try {
        BufferedImage image = new BufferedImage(200 , 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        this.chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, 
                null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        success = false;
    }

    assertTrue(success);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:BarChartTests.java

示例8: main

public static void main(String[] args) {
    final BufferedImage dst_custom = createCustomBuffer();
    final BufferedImage dst_dcm = new BufferedImage(width, height,
            BufferedImage.TYPE_INT_RGB);

    renderTo(dst_custom);
    renderTo(dst_dcm);

    check(dst_custom, dst_dcm);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:RenderToCustomBufferTest.java

示例9: main

public static void main(String a[]) {
    /* prepare blank image */
    BufferedImage bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = (Graphics2D) bi.getGraphics();
    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, 50, 50);

    /* draw outline somethere in the middle of the image */
    FontRenderContext frc = new FontRenderContext(null, false, false);
    g2.setColor(Color.RED);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    GlyphVector gv = g2.getFont().createGlyphVector(frc, "test");
    g2.fill(gv.getOutline(20, 20));

    /* Check if anything was drawn.
     * If y direction is not correct then image is still blank and
     * test will fail.
     */
    int bgcolor = Color.WHITE.getRGB();
    for (int i=0; i<bi.getWidth(); i++) {
        for(int j=0; j<bi.getHeight(); j++) {
           if (bi.getRGB(i, j) != bgcolor) {
               System.out.println("Test passed.");
               return;
           }
        }
    }
    throw new RuntimeException("Outline was not detected");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:TranslatedOutlineTest.java

示例10: combine

private BufferedImage combine(BufferedImage etalonImage, BufferedImage actualImage) {
    // create the new image, canvas size is the max. of both image sizes
    int w = etalonImage.getWidth() + actualImage.getWidth() + 1;
    int h = Math.max(etalonImage.getHeight(), actualImage.getHeight());
    BufferedImage combined = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);

    // paint both images, preserving the alpha channels
    Graphics g = combined.getGraphics();
    g.drawImage(etalonImage, 0, 0, null);
    g.drawImage(actualImage, etalonImage.getWidth() + 1, 0, null);
    return combined;
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:12,代码来源:CombinedImage.java

示例11: setRGB

/**
 * A convenience method for setting ARGB pixels in an image. This tries to avoid the performance
 * penalty of BufferedImage.setRGB unmanaging the image.
 */
public static void setRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) {
	int type = image.getType();
	if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )
		image.getRaster().setDataElements( x, y, width, height, pixels );
	else
		image.setRGB( x, y, width, height, pixels, 0, width );
   }
 
开发者ID:imageprocessor,项目名称:cv4j-desktop,代码行数:11,代码来源:CV4JImage.java

示例12: initImage

public void initImage(final Graphics2D _g2d) {
	if (_g2d == null) {
		image = new BufferedImage(SensorInfo.getInstance().parameter.getAreaWidth(),
				SensorInfo.getInstance().parameter.getAreaHeight(), BufferedImage.TYPE_INT_RGB);
		g2d = image.createGraphics();
	} else {
		g2d = _g2d;
	}
}
 
开发者ID:tekrei,项目名称:CoverageGA,代码行数:9,代码来源:GeneticAlgorithmUtility.java

示例13: createTestImage

private static BufferedImage createTestImage() {
    BufferedImage img = new BufferedImage(100, 100,
                                          BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    g.setColor(Color.white);
    g.fillRect(0, 0, 100, 100);
    g.setColor(Color.black);
    g.fillRect(20, 20, 60, 60);

    return img;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:WriterResetTest.java

示例14: createTestImage

protected static BufferedImage createTestImage() {
    BufferedImage res = new BufferedImage(100, 100,
                                          BufferedImage.TYPE_INT_RGB);
    Graphics2D g = res.createGraphics();
    g.setColor(Color.red);
    g.fillRect(0,0, 100,100);
    return res;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:ReaderListenersTest.java

示例15: render

private BufferedImage render(Image img) throws InterruptedException {

        MediaTracker tracker = new MediaTracker(this);
        tracker.addImage(img, 0);
        tracker.waitForAll();
        BufferedImage bufImage = new BufferedImage(img.getWidth(null),
            img.getHeight(null), BufferedImage.TYPE_INT_RGB);
        Graphics g = bufImage.createGraphics();
        g.drawImage(img, 0, 0, null);
        g.dispose();
        return bufImage;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ImageDataContentHandler.java


注:本文中的java.awt.image.BufferedImage.TYPE_INT_RGB属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。