|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.latexdraw.util.ImageCropper
public final class ImageCropper
This singleton removes white margins of an image.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
23/01/12
Field Summary | |
---|---|
static ImageCropper |
INSTANCE
The singleton. |
Constructor Summary | |
---|---|
private |
ImageCropper()
|
Method Summary | |
---|---|
java.awt.Image |
cropImage(java.awt.image.BufferedImage img)
Removes the white margins of the given image. |
private int |
getBottom(java.awt.image.BufferedImage img,
int width,
int height,
int left,
int right)
Gets the bottom position where a pixel is not white. |
private int |
getLeft(java.awt.image.BufferedImage img,
int width,
int height)
Gets the left position where a pixel is not white. |
private int |
getRight(java.awt.image.BufferedImage img,
int width,
int height)
Gets the right position where a pixel is not white. |
private int |
getTop(java.awt.image.BufferedImage img,
int width,
int height,
int left,
int right)
Gets the top position where a pixel is not white. |
private boolean |
hasColouredPixelColumn(java.awt.image.BufferedImage image,
int x,
int imgHeight)
|
private boolean |
hasColouredPixelRow(java.awt.image.BufferedImage image,
int y,
int min,
int max)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ImageCropper INSTANCE
Constructor Detail |
---|
private ImageCropper()
Method Detail |
---|
public java.awt.Image cropImage(java.awt.image.BufferedImage img)
img
- The image to crop.
private int getBottom(java.awt.image.BufferedImage img, int width, int height, int left, int right)
private int getTop(java.awt.image.BufferedImage img, int width, int height, int left, int right)
private int getRight(java.awt.image.BufferedImage img, int width, int height)
private int getLeft(java.awt.image.BufferedImage img, int width, int height)
private boolean hasColouredPixelColumn(java.awt.image.BufferedImage image, int x, int imgHeight)
private boolean hasColouredPixelRow(java.awt.image.BufferedImage image, int y, int min, int max)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |