當前位置: 首頁>>代碼示例>>Java>>正文


Java CGInterpolationQuality類代碼示例

本文整理匯總了Java中org.robovm.apple.coregraphics.CGInterpolationQuality的典型用法代碼示例。如果您正苦於以下問題:Java CGInterpolationQuality類的具體用法?Java CGInterpolationQuality怎麽用?Java CGInterpolationQuality使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CGInterpolationQuality類屬於org.robovm.apple.coregraphics包,在下文中一共展示了CGInterpolationQuality類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createThumbnail

import org.robovm.apple.coregraphics.CGInterpolationQuality; //導入依賴的package包/類
/**
 * 
 * @param image
 * @param thumbnailSize
 * @param borderSize
 * @param cornerRadius
 * @param quality
 * @return a copy of this image that is squared to the thumbnail size. If
 *         transparentBorder is non-zero, a transparent border of the given
 *         size will be added around the edges of the thumbnail. (Adding a
 *         transparent border of at least one pixel in size has the
 *         side-effect of antialiasing the edges of the image when rotating
 *         it using Core Animation.)
 */
public static UIImage createThumbnail(UIImage image, int thumbnailSize, int borderSize, int cornerRadius,
        CGInterpolationQuality quality) {
    UIImage resizedImage = resize(image, UIViewContentMode.ScaleAspectFill,
            new CGSize(thumbnailSize, thumbnailSize), quality);

    // Crop out any part of the image that's larger than the thumbnail size
    // The cropped rect must be centered on the resized image
    // Round the origin points so that the size isn't altered when
    // CGRectIntegral is later invoked
    CGRect cropRect = new CGRect(Math.round((resizedImage.getSize().getWidth() - thumbnailSize) / 2),
            Math.round((resizedImage.getSize().getHeight() - thumbnailSize) / 2), thumbnailSize, thumbnailSize);
    UIImage croppedImage = crop(resizedImage, cropRect);

    UIImage transparentBorderImage = borderSize != 0 ? addTransparentBorder(croppedImage, borderSize)
            : croppedImage;

    return createRoundedCornerImage(transparentBorderImage, cornerRadius, borderSize);
}
 
開發者ID:robovm,項目名稱:robovm-samples,代碼行數:33,代碼來源:UIImageUtility.java

示例2: resize

import org.robovm.apple.coregraphics.CGInterpolationQuality; //導入依賴的package包/類
/**
 * 
 * @param image
 * @param newSize
 * @param quality
 * @return a rescaled copy of the image, taking into account its orientation
 *         The image will be scaled disproportionately if necessary to fit
 *         the bounds specified by the parameter
 */
public static UIImage resize(UIImage image, CGSize newSize, CGInterpolationQuality quality) {
    boolean drawTransposed;

    switch (image.getOrientation()) {
    case Left:
    case LeftMirrored:
    case Right:
    case RightMirrored:
        drawTransposed = true;
        break;
    default:
        drawTransposed = false;
        break;
    }

    return resize(image, newSize, getTransformForOrientation(image, newSize), drawTransposed, quality);
}
 
開發者ID:robovm,項目名稱:robovm-samples,代碼行數:27,代碼來源:UIImageUtility.java

示例3: getRgb

import org.robovm.apple.coregraphics.CGInterpolationQuality; //導入依賴的package包/類
@Override public void getRgb(int startX, int startY, int width, int height,
                             int[] rgbArray, int offset, int scanSize) {
  int bytesPerRow = 4 * width;
  CGBitmapContext context = CGBitmapContext.create(
    width, height, 8, bytesPerRow, CGColorSpace.createDeviceRGB(),
    // PremultipliedFirst for ARGB, same as BufferedImage in Java.
    new CGBitmapInfo(CGImageAlphaInfo.PremultipliedFirst.value()));
  // since we're fishing for authentic RGB data, never allow interpolation.
  context.setInterpolationQuality(CGInterpolationQuality.None);
  draw(context, 0, 0, width, height, startX, startY, width, height);

  // TODO: extract data from context.getData()
  // int x = 0;
  // int y = height - 1; // inverted Y
  // for (int px = 0; px < regionBytes.length; px += 4) {
  //   int a = (int)regionBytes[px    ] & 0xFF;
  //   int r = (int)regionBytes[px + 1] & 0xFF;
  //   int g = (int)regionBytes[px + 2] & 0xFF;
  //   int b = (int)regionBytes[px + 3] & 0xFF;
  //   rgbArray[offset + y * scanSize + x] = a << 24 | r << 16 | g << 8 | b;

  //   x++;
  //   if (x == width) {
  //     x = 0;
  //     y--;
  //   }
  // }
}
 
開發者ID:playn,項目名稱:playn,代碼行數:29,代碼來源:RoboImage.java

示例4: RoboCanvasImage

import org.robovm.apple.coregraphics.CGInterpolationQuality; //導入依賴的package包/類
public RoboCanvasImage (Graphics gfx, Scale scale, int pixelWidth, int pixelHeight,
                        boolean interpolate) {
  super(gfx, scale, pixelWidth, pixelHeight, "<canvas>");
  // create the bitmap context via which we'll render into it
  bctx = RoboGraphics.createCGBitmap(pixelWidth, pixelHeight);
  if (!interpolate) bctx.setInterpolationQuality(CGInterpolationQuality.None);
}
 
開發者ID:playn,項目名稱:playn,代碼行數:8,代碼來源:RoboCanvasImage.java

示例5: drawInContext

import org.robovm.apple.coregraphics.CGInterpolationQuality; //導入依賴的package包/類
public void drawInContext(CGContext context) {
    context.setAllowsAntialiasing(true);
    context.setShouldAntialias(true);
    context.setInterpolationQuality(CGInterpolationQuality.High);

    this.drawable.drawInContext(context);
}
 
開發者ID:liraz,項目名稱:robolayout,代碼行數:8,代碼來源:DrawableLayer.java


注:本文中的org.robovm.apple.coregraphics.CGInterpolationQuality類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。