Lines Matching refs:source
2 * Copyright (C) 2011 The Android Open Source Project
71 * @param source The source image.
76 public static BufferedImage scaledImage(BufferedImage source, int width, int height) {
77 Image scaledImage = source.getScaledInstance(width, height, Image.SCALE_SMOOTH);
90 * @param source The source image.
92 * @return A new, blurred image, or the source image if no blur is performed.
94 public static BufferedImage blurredImage(BufferedImage source, double radius) {
96 return source;
131 BufferedImage paddedSource = paddedImage(source, r);
134 return blurredPaddedImage.getSubimage(r, r, source.getWidth(), source.getHeight());
141 * @param source The source image.
144 public static BufferedImage invertedAlphaImage(BufferedImage source) {
148 return operatedImage(source, new RescaleOp(scaleFactors, offsets, null));
154 * @param source The source image.
158 public static BufferedImage operatedImage(BufferedImage source, BufferedImageOp op) {
159 BufferedImage newImage = newArgbBufferedImage(source.getWidth(), source.getHeight());
161 g.drawImage(source, op, 0, 0);
168 * @param source The source image.
172 public static BufferedImage filledImage(BufferedImage source, Paint paint) {
173 BufferedImage newImage = newArgbBufferedImage(source.getWidth(), source.getHeight());
175 g.drawImage(source, 0, 0, null);
178 g.fillRect(0, 0, source.getWidth(), source.getHeight());
185 * @param source The source image.
187 * @return A new, padded image, or the source image if no padding is performed.
189 public static BufferedImage paddedImage(BufferedImage source, int padding) {
191 return source;
195 source.getWidth() + padding * 2, source.getHeight() + padding * 2);
197 g.drawImage(source, padding, padding, null);
204 * @param source The source image.
205 * @return A new, trimmed image, or the source image if no trim is performed.
207 public static BufferedImage trimmedImage(BufferedImage source) {
209 final int srcWidth = source.getWidth();
210 final int srcHeight = source.getHeight();
211 Raster raster = source.getRaster();
231 return source;
234 return source.getSubimage(l, t, r - l + 1, b - t + 1);
239 * {@link Effect}s applied. Note that drawn effects may be outside the bounds of the source
243 * @param source The source image.
248 public static void drawEffects(Graphics2D g, BufferedImage source, int x, int y,
272 blurredImage(source, effect.radius),
279 final Rectangle imageRect = new Rectangle(0, 0, source.getWidth(), source.getHeight());
285 g2.drawImage(source, 0, 0, null);
304 g3.drawImage(source, (int) effect.xOffset, (int) effect.yOffset, null);
324 * @param source The source image.
328 public static void drawCenterInside(Graphics2D g, BufferedImage source, Rectangle dstRect) {
329 final int srcWidth = source.getWidth();
330 final int srcHeight = source.getHeight();
334 Image scaledImage = scaledImage(source, scaledWidth, scaledHeight);
348 Image scaledImage = scaledImage(source, scaledWidth, scaledHeight);
367 * @param source The source image.
371 public static void drawCenterCrop(Graphics2D g, BufferedImage source, Rectangle dstRect) {
372 final int srcWidth = source.getWidth();
373 final int srcHeight = source.getHeight();
377 Image scaledImage = scaledImage(source, scaledWidth, scaledHeight);
391 Image scaledImage = scaledImage(source, scaledWidth, scaledHeight);