Search in sources :

Example 26 with java.awt.image

use of java.awt.image in project bigbluebutton by bigbluebutton.

the class ScreenCapture method useQuality.

private BufferedImage useQuality(BufferedImage image) {
    BufferedImage resultImage = graphicsConfig.createCompatibleImage(scaleWidth, scaleHeight, Transparency.BITMASK);
    resultImage.setAccelerationPriority(1);
    Graphics2D g2 = resultImage.createGraphics();
    Image scaledImage = image.getScaledInstance(scaleWidth, scaleHeight, Image.SCALE_AREA_AVERAGING);
    g2.drawImage(scaledImage, 0, 0, scaleWidth, scaleHeight, null);
    g2.dispose();
    return resultImage;
}
Also used : Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

Example 27 with java.awt.image

use of java.awt.image in project libgdx by libgdx.

the class LwjglAWTInput method showCursor.

private void showCursor(boolean visible) {
    if (!visible) {
        Toolkit t = Toolkit.getDefaultToolkit();
        Image i = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
        Cursor noCursor = t.createCustomCursor(i, new Point(0, 0), "none");
        JFrame frame = findJFrame(canvas);
        frame.setCursor(noCursor);
    } else {
        JFrame frame = findJFrame(canvas);
        frame.setCursor(Cursor.getDefaultCursor());
    }
}
Also used : JFrame(javax.swing.JFrame) Toolkit(java.awt.Toolkit) Point(java.awt.Point) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) Cursor(java.awt.Cursor) BufferedImage(java.awt.image.BufferedImage)

Example 28 with java.awt.image

use of java.awt.image in project bigbluebutton by bigbluebutton.

the class ImagePanel method paint.

public void paint(Graphics g) {
    //System.out.print("*");
    if (image != null) {
        int width = this.getSize().width;
        int height = this.getSize().height;
        double ratio = (double) width / height;
        if (image != null && image.getWidth(null) > 0) {
            // resized image
            Image aux = image.getScaledInstance(width, height, Image.SCALE_FAST);
            // wait for image loading..
            int attempts = 4;
            while ((attempts--) > 0 && aux.getWidth(null) < 0) try {
                Thread.sleep(80);
            } catch (Exception e) {
            }
            /*
            double x=width/2;
            double y=height/2;
            int dx=aux.getWidth(null)/2;
            int dy=aux.getHeight(null)/2;
            g.drawImage(aux,(int)(x-dx),(int)(y-dy),null);
            */
            g.drawImage(aux, 0, 0, null);
        }
    } else {
        g.setColor(Color.red);
        g.fillRect(0, 0, this.getSize().width, this.getSize().height);
    }
}
Also used : Image(java.awt.Image)

Example 29 with java.awt.image

use of java.awt.image in project camel by apache.

the class CxfJavaMtomProducerPayloadTest method testInvokingService.

@SuppressWarnings("unchecked")
@Test
public void testInvokingService() throws Exception {
    if (MtomTestHelper.isAwtHeadless(null, log)) {
        return;
    }
    final Holder<byte[]> photo = new Holder<byte[]>("RequestFromCXF".getBytes("UTF-8"));
    final Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));
    Exchange exchange = context.createProducerTemplate().send(MTOM_ENDPOINT_URI_MTOM_ENABLE, new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setBody(new Object[] { photo, image });
        }
    });
    // Make sure we don't put the attachement into out message
    assertEquals("The attachement size should be 0 ", 0, exchange.getOut().getAttachments().size());
    Object[] result = exchange.getOut().getBody(Object[].class);
    Holder<byte[]> photo1 = (Holder<byte[]>) result[1];
    Holder<Image> image1 = (Holder<Image>) result[2];
    assertEquals("ResponseFromCamel", new String(photo1.value, "UTF-8"));
    assertNotNull(image1.value);
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) Holder(javax.xml.ws.Holder) Image(java.awt.Image) Test(org.junit.Test)

Example 30 with java.awt.image

use of java.awt.image in project camel by apache.

the class CxfMtomConsumerTest method testInvokingService.

@Test
public void testInvokingService() throws Exception {
    if (MtomTestHelper.isAwtHeadless(null, log)) {
        return;
    }
    Holder<byte[]> photo = new Holder<byte[]>("RequestFromCXF".getBytes("UTF-8"));
    Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.detail(photo, image);
    assertEquals("ResponseFromCamel", new String(photo.value, "UTF-8"));
    assertNotNull(image.value);
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Image(java.awt.Image) Test(org.junit.Test)

Aggregations

Image (java.awt.Image)518 BufferedImage (java.awt.image.BufferedImage)265 ImageIcon (javax.swing.ImageIcon)127 Graphics2D (java.awt.Graphics2D)97 IOException (java.io.IOException)76 File (java.io.File)65 Point (java.awt.Point)53 URL (java.net.URL)51 Graphics (java.awt.Graphics)46 JLabel (javax.swing.JLabel)31 Dimension (java.awt.Dimension)28 Rectangle (java.awt.Rectangle)27 AffineTransform (java.awt.geom.AffineTransform)25 Color (java.awt.Color)24 Test (org.junit.Test)24 RenderedImage (java.awt.image.RenderedImage)21 ArrayList (java.util.ArrayList)21 Toolkit (java.awt.Toolkit)20 IIOImage (javax.imageio.IIOImage)18 MediaTracker (java.awt.MediaTracker)17