Java Draw Image drawBytes(BufferedImage image, byte[] buf)

Here you can find the source of drawBytes(BufferedImage image, byte[] buf)

Description

draw Bytes

License

Apache License

Declaration

private static void drawBytes(BufferedImage image, byte[] buf) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;

public class Main {
    private static void drawBytes(BufferedImage image, byte[] buf) {
        DataBuffer dataBuffer = image.getRaster().getDataBuffer();
        for (int i = 0; i < buf.length; i += 2) {
            int pix = (buf[i] & 0xff) << 8 | (buf[i + 1] & 0xff);
            dataBuffer.setElem(i / 2, pix);
        }/*from  www  .j  a v a  2  s.c o  m*/
    }
}

Related

  1. drawBorder(BufferedImage buffImage)
  2. drawBorder(BufferedImage originalImage, Color borderColor, int borderWidth)
  3. drawBorders(final BufferedImage image, final int currentX, final int currentY, final int width, final int height, final int subImageWidth, final int subImageHeight, final Color c)
  4. drawBoundingPolygon(BufferedImage canvas, Polygon p, Color fgColour)
  5. drawBubble(BufferedImage img, Graphics g, Component component)
  6. drawCenterCrop(Graphics2D g, BufferedImage source, Rectangle dstRect)
  7. drawCenteredImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer, int imageWidth, int imageHeight, boolean shrink)
  8. DrawCross(BufferedImage bi, Point pt)
  9. drawImage(BufferedImage bi, RenderedImage im)