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