Java Draw Image DrawCross(BufferedImage bi, Point pt)

Here you can find the source of DrawCross(BufferedImage bi, Point pt)

Description

Draw Cross

License

BSD License

Declaration

public static void DrawCross(BufferedImage bi, Point pt) 

Method Source Code

//package com.java2s;
// LICENSE:       This file is distributed under the BSD license.

import java.awt.Point;
import java.awt.image.BufferedImage;

public class Main {
    public static void DrawCross(BufferedImage bi, Point pt) {
        final int max_r = 50, min_r = 10, color = 0xffffff;
        for (int x = pt.x - max_r; x < pt.x - min_r; x++) {
            if (x >= 0 && x < bi.getWidth())
                bi.setRGB(x, pt.y, color);
        }// w ww.j  a  v a  2  s.c  o m
        for (int x = pt.x + min_r; x < pt.x + max_r; x++) {
            if (x >= 0 && x < bi.getWidth())
                bi.setRGB(x, pt.y, color);
        }
        for (int y = pt.y - max_r; y < pt.y - min_r; y++) {
            if (y >= 0 && y < bi.getHeight())
                bi.setRGB(pt.x, y, color);
        }
        for (int y = pt.y + min_r; y < pt.y + max_r; y++) {
            if (y >= 0 && y < bi.getHeight())
                bi.setRGB(pt.x, y, color);
        }
    }
}

Related

  1. drawBoundingPolygon(BufferedImage canvas, Polygon p, Color fgColour)
  2. drawBubble(BufferedImage img, Graphics g, Component component)
  3. drawBytes(BufferedImage image, byte[] buf)
  4. drawCenterCrop(Graphics2D g, BufferedImage source, Rectangle dstRect)
  5. drawCenteredImage(Rectangle2D bounds, Graphics2D g2, Image image, ImageObserver observer, int imageWidth, int imageHeight, boolean shrink)
  6. drawImage(BufferedImage bi, RenderedImage im)
  7. drawImage(BufferedImage originalImage, BufferedImage scaledImage, int width, int height)
  8. drawImage(BufferedImage srcImg, BufferedImage img2Draw, int w, int h)
  9. drawImage(BufferedImage target, Point targetPoint, BufferedImage source)