001
014
015 package com.liferay.portal.kernel.image;
016
017 import com.liferay.portal.model.Image;
018
019 import java.awt.image.BufferedImage;
020 import java.awt.image.RenderedImage;
021
022 import java.io.File;
023 import java.io.IOException;
024 import java.io.InputStream;
025 import java.io.OutputStream;
026
027 import java.util.concurrent.Future;
028
029
033 public interface ImageTool {
034
035 public static final String TYPE_BMP = "bmp";
036
037 public static final String TYPE_GIF = "gif";
038
039 public static final String TYPE_JPEG = "jpg";
040
041 public static final String TYPE_NOT_AVAILABLE = "na";
042
043 public static final String TYPE_PNG = "png";
044
045 public static final String TYPE_TIFF = "tiff";
046
047 public Future<RenderedImage> convertCMYKtoRGB(byte[] bytes, String type);
048
049 public BufferedImage convertImageType(BufferedImage sourceImage, int type);
050
051 public RenderedImage crop(
052 RenderedImage renderedImage, int height, int width, int x, int y);
053
054 public void encodeGIF(RenderedImage renderedImage, OutputStream os)
055 throws IOException;
056
057 public void encodeWBMP(RenderedImage renderedImage, OutputStream os)
058 throws IOException;
059
060 public BufferedImage getBufferedImage(RenderedImage renderedImage);
061
062 public byte[] getBytes(RenderedImage renderedImage, String contentType)
063 throws IOException;
064
065 public Image getDefaultCompanyLogo();
066
067 public Image getDefaultOrganizationLogo();
068
069 public Image getDefaultSpacer();
070
071 public Image getDefaultUserFemalePortrait();
072
073 public Image getDefaultUserMalePortrait();
074
075 public Image getImage(byte[] bytes)
076 throws IOException;
077
078 public Image getImage(File file) throws IOException;
079
080 public Image getImage(InputStream is) throws IOException;
081
082 public Image getImage(InputStream is, boolean cleanUpStream)
083 throws IOException;
084
085 public boolean isNullOrDefaultSpacer(byte[] bytes);
086
087 public ImageBag read(byte[] bytes) throws IOException;
088
089 public ImageBag read(File file) throws IOException;
090
091 public ImageBag read(InputStream inputStream) throws IOException;
092
093 public RenderedImage scale(RenderedImage renderedImage, int width);
094
095 public RenderedImage scale(
096 RenderedImage renderedImage, int maxHeight, int maxWidth);
097
098 public abstract void write(
099 RenderedImage renderedImage, String contentType, OutputStream os)
100 throws IOException;
101
102 }