java类java.awt.image.AffineTransformOp的实例源码

D3DDrawImage.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (D3DBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
DrawImage.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
public static boolean isSimpleTranslate(SunGraphics2D sg) {
    int ts = sg.transformState;
    if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Integer translates are always "simple"
        return true;
    }
    if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Scales and beyond are always "not simple"
        return false;
    }
    // non-integer translates are only simple when not interpolating
    if (sg.interpolationType == AffineTransformOp.TYPE_NEAREST_NEIGHBOR) {
        return true;
    }
    return false;
}
DrawImage.java 文件源码 项目:OpenJSharp 阅读 29 收藏 0 点赞 0 评论 0
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            img = op.filter(img, null);
        }
    }
    copyImage(sg, img, x, y, null);
}
OGLDrawImage.java 文件源码 项目:OpenJSharp 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (OGLBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
D3DDrawImage.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (D3DBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
Img.java 文件源码 项目:hearthstone 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Rotaciona uma imagem
 *
 * @param image imagem a ser rotacionada
 * @param angle ângulo da rotação
 * @return imagem rotacionada
 */
public static ImageIcon girar(ImageIcon image, double angle) {
    BufferedImage rotateImage = ImageIconToBufferedImage(image);
    angle %= 360;
    if (angle < 0) {
        angle += 360;
    }
    AffineTransform tx = new AffineTransform();
    tx.rotate(Math.toRadians(angle), rotateImage.getWidth() / 2.0, rotateImage.getHeight() / 2.0);

    double ytrans;
    double xtrans;
    if (angle <= 90) {
        xtrans = tx.transform(new Point2D.Double(0, rotateImage.getHeight()), null).getX();
        ytrans = tx.transform(new Point2D.Double(0.0, 0.0), null).getY();
    } else if (angle <= 180) {
        xtrans = tx.transform(new Point2D.Double(rotateImage.getWidth(), rotateImage.getHeight()), null).getX();
        ytrans = tx.transform(new Point2D.Double(0, rotateImage.getHeight()), null).getY();
    } else if (angle <= 270) {
        xtrans = tx.transform(new Point2D.Double(rotateImage.getWidth(), 0), null).getX();
        ytrans = tx.transform(new Point2D.Double(rotateImage.getWidth(), rotateImage.getHeight()), null).getY();
    } else {
        xtrans = tx.transform(new Point2D.Double(0, 0), null).getX();
        ytrans = tx.transform(new Point2D.Double(rotateImage.getWidth(), 0), null).getY();
    }

    AffineTransform translationTransform = new AffineTransform();
    translationTransform.translate(-xtrans, -ytrans);
    tx.preConcatenate(translationTransform);

    return new ImageIcon(new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR).filter(rotateImage, null));
}
FlipShader.java 文件源码 项目:VTerminal 阅读 36 收藏 0 点赞 0 评论 0
@Override
public BufferedImage run(final @NonNull BufferedImage image) {
    if (isFlippedHorizontally || isFlippedVertically) {
        final double scaleX = isFlippedHorizontally ? -1 : 1;
        final double scaleY = isFlippedVertically ? -1 : 1;
        final double translateX = isFlippedHorizontally ? -image.getWidth() : 0;
        final double translateY = isFlippedVertically ? -image.getHeight() : 0;

        final AffineTransform tx = AffineTransform.getScaleInstance(scaleX, scaleY);
        tx.translate(translateX, translateY);

        final BufferedImageOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
        return op.filter(image, null);
    }

    return image;
}
Font.java 文件源码 项目:VTerminal 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Constructs a new Font.
 *
 * @param characterImages
 *        The base character images.
 *
 * @param scale
 *        The amount to scale each character image by.
 *
 * @throws NullPointerException
 *         If the characterImages is null.
 *
 * @throws IOException
 *         If an I/O error occurs.
 */
public Font(final @NonNull HashMap<Character, BufferedImage> characterImages, final int scale) throws IOException {
    this.characterImages = characterImages;

    final int width = characterImages.get('X').getWidth() * scale;
    final int height = characterImages.get('X').getHeight() * scale;
    dimensions = new Dimension(width, height);

    if (scale > 0) {
        final AffineTransform tx = AffineTransform.getScaleInstance(scale, scale);
        final AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);

        for (final Map.Entry<Character, BufferedImage> entry : characterImages.entrySet()) {
            characterImages.put(entry.getKey(), op.filter(entry.getValue(), null));
        }
    }
}
ImagePrinter.java 文件源码 项目:VTerminal 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Flips and scales the image.
 *
 * @return
 *         The flipped and scaled image.
 */
private BufferedImage applyTransformations() {
    final AffineTransform tx;

    if (flipHorizontally && flipVertically) {
        tx = AffineTransform.getScaleInstance(-scaleX, -scaleY);
        tx.translate(-image.getWidth(), -image.getHeight());
    } else if (flipHorizontally) {
        tx = AffineTransform.getScaleInstance(-scaleX, scaleY);
        tx.translate(-image.getWidth(), 0);
    } else if(flipVertically) {
        tx = AffineTransform.getScaleInstance(scaleX, -scaleY);
        tx.translate(0, -image.getHeight());
    } else {
        tx = AffineTransform.getScaleInstance(scaleX, scaleY);
    }

    final AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    return op.filter(image, null);
}
DrawImage.java 文件源码 项目:jdk8u-jdk 阅读 35 收藏 0 点赞 0 评论 0
public static boolean isSimpleTranslate(SunGraphics2D sg) {
    int ts = sg.transformState;
    if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Integer translates are always "simple"
        return true;
    }
    if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Scales and beyond are always "not simple"
        return false;
    }
    // non-integer translates are only simple when not interpolating
    if (sg.interpolationType == AffineTransformOp.TYPE_NEAREST_NEIGHBOR) {
        return true;
    }
    return false;
}
DrawImage.java 文件源码 项目:jdk8u-jdk 阅读 27 收藏 0 点赞 0 评论 0
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            img = op.filter(img, null);
        }
    }
    copyImage(sg, img, x, y, null);
}
OGLDrawImage.java 文件源码 项目:jdk8u-jdk 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (OGLBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
D3DDrawImage.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (D3DBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
DrawImage.java 文件源码 项目:openjdk-jdk10 阅读 29 收藏 0 点赞 0 评论 0
public static boolean isSimpleTranslate(SunGraphics2D sg) {
    int ts = sg.transformState;
    if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Integer translates are always "simple"
        return true;
    }
    if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        // Scales and beyond are always "not simple"
        return false;
    }
    // non-integer translates are only simple when not interpolating
    if (sg.interpolationType == AffineTransformOp.TYPE_NEAREST_NEIGHBOR) {
        return true;
    }
    return false;
}
OGLDrawImage.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void transformImage(SunGraphics2D sg, BufferedImage img,
                           BufferedImageOp op, int x, int y)
{
    if (op != null) {
        if (op instanceof AffineTransformOp) {
            AffineTransformOp atop = (AffineTransformOp) op;
            transformImage(sg, img, x, y,
                           atop.getTransform(),
                           atop.getInterpolationType());
            return;
        } else {
            if (OGLBufImgOps.renderImageWithOp(sg, img, op, x, y)) {
                return;
            }
        }
        img = op.filter(img, null);
    }
    copyImage(sg, img, x, y, null);
}
ImageProcessing.java 文件源码 项目:litiengine 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Adds a shadow effect by executing the following steps: 1. Transform visible
 * pixels to a semi-transparent black 2. Flip the image vertically 3. Scale it
 * down 4. Render original image and shadow on a buffered image
 *
 * @param image
 *          the image
 * @param xOffset
 *          the x offset
 * @param yOffset
 *          the y offset
 * @return the buffered image
 */
public static BufferedImage addShadow(final BufferedImage image, final int xOffset, final int yOffset) {
  if (image == null) {
    return image;
  }

  // Transform visible pixels to a semi-transparent black
  final BufferedImage shadowImage = flashVisiblePixels(image, new Color(0, 0, 0, 30));
  if (shadowImage == null) {
    return image;
  }

  final AffineTransform tx = new AffineTransform();

  // Flip the image vertically
  tx.concatenate(AffineTransform.getScaleInstance(1, -0.15));
  tx.concatenate(AffineTransform.getTranslateInstance(0, -shadowImage.getHeight()));
  final AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
  final BufferedImage rotatedImage = op.filter(shadowImage, null);

  final BufferedImage shadow = getCompatibleImage(image.getWidth(), image.getHeight() + rotatedImage.getHeight());
  final Graphics2D g2D = shadow.createGraphics();
  g2D.drawImage(rotatedImage, xOffset, yOffset, null);
  g2D.drawImage(image, 0, 0, null);

  g2D.dispose();

  return shadow;
}
D3DBlitLoops.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    D3DBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, true);
}
SheetProcessor.java 文件源码 项目:omr-dataset-tools 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Build a scaled version of an image.
 *
 * @param img   image to scale
 * @param ratio scaling ratio
 * @return the scaled image
 */
public static BufferedImage scale (BufferedImage img,
                                   double ratio)
{
    AffineTransform at = AffineTransform.getScaleInstance(ratio, ratio);
    AffineTransformOp atop = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
    BufferedImage scaledImg = new BufferedImage(
            (int) Math.ceil(img.getWidth() * ratio),
            (int) Math.ceil(img.getHeight() * ratio),
            img.getType());

    return atop.filter(img, scaledImg);
}
Transform.java 文件源码 项目:jmonet 阅读 26 收藏 0 点赞 0 评论 0
public static BufferedImage slant(BufferedImage image, FlexQuadrilateral quadrilateral, int xTranslation) {
    Point p = new Point(quadrilateral.getBottomLeft().x, quadrilateral.getTopLeft().y);
    double theta = Geometry.theta(quadrilateral.getBottomLeft(), p, quadrilateral.getTopLeft());

    AffineTransform transform = AffineTransform.getTranslateInstance(xTranslation, 0);
    transform.shear(Math.tan(theta), 0);

    transform.translate(xTranslation, 0);
    AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);
    return op.filter(image, null);
}
EasyImage.java 文件源码 项目:FileUpload2Spring 阅读 21 收藏 0 点赞 0 评论 0
public void affineTransform (double fShxFactor, double fShyFactor) {

        try {
          AffineTransform shearer =
            AffineTransform.getShearInstance (fShxFactor, fShyFactor);
          AffineTransformOp shear_op =
            new AffineTransformOp (shearer, null);
          bufferedImage = shear_op.filter (bufferedImage, null);
        }
        catch (Exception e) {
          System.out.println("Shearing exception = " + e);
        }
      }
OGLBlitLoops.java 文件源码 项目:openjdk-jdk10 阅读 84 收藏 0 点赞 0 评论 0
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    OGLBlitLoops.Blit(src, dst,
                      comp, clip, null,
                      AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                      sx, sy, sx+w, sy+h,
                      dx, dy, dx+w, dy+h,
                      typeval, true);
}
DigitManipulator.java 文件源码 项目:DigitRecognizer 阅读 42 收藏 0 点赞 0 评论 0
private static BufferedImage scaleSmooth(BufferedImage im, double newWidth, double newHeigth)
{
    int w = im.getWidth();
    int h = im.getHeight();
    BufferedImage result = new BufferedImage((int)newWidth, (int)newHeigth, BufferedImage.TYPE_INT_ARGB);
    AffineTransform at = new AffineTransform();
    at.scale(newWidth / w, newHeigth / h);
    AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
    result = scaleOp.filter(im, result);
    return result;
}
ImageCreatorSlave.java 文件源码 项目:jaer 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void run() {
    BufferedImage img = new BufferedImage(display.getWidth(), display.getHeight(), BufferedImage.TYPE_INT_RGB);
    for (int y = 0; y < display.getHeight(); y++) {
        for (int x = 0; x < display.getWidth(); x++) {
            int idx = getIndex(x, y);
            int nIdx = 3 * idx;
            int r = ((int) (rgbValues[nIdx++] * 255)); // red component 0...255
            int g = ((int) (rgbValues[nIdx++] * 255)); // green component 0...255
            int b = ((int) (rgbValues[nIdx] * 255)); // blue component 0...255
            int col = (r << 16) | (g << 8) | b;
            img.setRGB(x, y, col);
        }
    }
    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
    tx.translate(0, -img.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    img = op.filter(img, null);
    SimpleDateFormat sdfDate = new SimpleDateFormat("_yyyy_MM_dd_HH_mm_ss");//dd/MM/yyyy
    Date now = new Date();
    String strDate = sdfDate.format(now);
    try {
        ImageIO.write(img, "png", new File(String.format("%s/ImageCreator%s.png", path, strDate)));
    } catch (IOException ex) {
        log.warning("can not save Image, Error: " + ex.toString());
    }
}
ImageCreator.java 文件源码 项目:jaer 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void run() {
    BufferedImage img = new BufferedImage(display.getWidth(), display.getHeight(), BufferedImage.TYPE_INT_RGB);
    for (int y = 0; y < display.getHeight(); y++) {
        for (int x = 0; x < display.getWidth(); x++) {
            int idx = getIndex(x, y);
            int nIdx = 3 * idx;
            int r = ((int) (rgbValues[nIdx++] * 255)); // red component 0...255
            int g = ((int) (rgbValues[nIdx++] * 255)); // green component 0...255
            int b = ((int) (rgbValues[nIdx] * 255)); // blue component 0...255
            int col = (r << 16) | (g << 8) | b;
            img.setRGB(x, y, col);
        }
    }
    AffineTransform tx = AffineTransform.getScaleInstance(1, -1);  //alligns the image correctly
    tx.translate(0, -img.getHeight(null));
    AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
    img = op.filter(img, null);
    SimpleDateFormat sdfDate = new SimpleDateFormat("_yyyy_MM_dd_HH_mm_ss");//dd/MM/yyyy
    Date now = new Date();
    String strDate = sdfDate.format(now);
    try {
        ImageIO.write(img, "png", new File(String.format("%s/ImageCreator%s.png", path, strDate)));
    } catch (IOException ex) {
        log.warning("can not save Image, Error: " + ex.toString());
    }
}
ImageUtil.java 文件源码 项目:Elune 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 缩放图片
 *
 * @param imgPath 源图片绝对路径
 * @param disPath 目标图片绝对路径
 * @param height 目标高度
 * @param width 目标宽度
 * @param whiteFill 是否补白
 */
public final static void scale(String imgPath, String disPath, int height, int width, boolean whiteFill) {
    try {
        double ratio = 0.0;
        File file = new File(imgPath);
        BufferedImage bufferedImage = ImageIO.read(file);
        Image tempImg = bufferedImage.getScaledInstance(width, height, BufferedImage.SCALE_SMOOTH);
        // 计算比例
        if ((bufferedImage.getHeight() > height) || (bufferedImage.getWidth() > width)) {
            double ratioV = (new Integer(height).doubleValue() / bufferedImage.getHeight());
            double ratioH = (new Integer(width).doubleValue() / bufferedImage.getWidth());
            ratio = Math.max(ratioV, ratioH);
            AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(ratio, ratio), null);
            tempImg = op.filter(bufferedImage, null);
        }
        if (whiteFill) {
            BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            Graphics2D g = img.createGraphics();
            g.setColor(Color.WHITE);
            g.fillRect(0, 0, width, height);
            if (width == tempImg.getWidth(null)) {
                g.drawImage(tempImg, 0, (height - tempImg.getHeight(null)) / 2, tempImg.getWidth(null), tempImg.getHeight(null), Color.WHITE, null);
            } else {
                g.drawImage(tempImg, (width - tempImg.getWidth(null)) / 2, 0, tempImg.getWidth(null), tempImg.getHeight(null), Color.WHITE, null);
            }
            g.dispose();
            tempImg = img;
        }
        ImageIO.write((BufferedImage)tempImg, "JPEG", new File(disPath));
    } catch (IOException e) {
        //
        e.printStackTrace();
    }
}
OGLBlitLoops.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    OGLBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx1, sy1, sx2, sy2,
                         dx1, dy1, dx2, dy2,
                         true);
}
SunGraphics2D.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
public SunGraphics2D(SurfaceData sd, Color fg, Color bg, Font f) {
    surfaceData = sd;
    foregroundColor = fg;
    backgroundColor = bg;

    transform = new AffineTransform();
    stroke = defaultStroke;
    composite = defaultComposite;
    paint = foregroundColor;

    imageComp = CompositeType.SrcOverNoEa;

    renderHint = SunHints.INTVAL_RENDER_DEFAULT;
    antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
    textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT;
    fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF;
    lcdTextContrast = lcdTextContrastDefaultValue;
    interpolationHint = -1;
    strokeHint = SunHints.INTVAL_STROKE_DEFAULT;
    resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT;

    interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;

    validateColor();

    devScale = sd.getDefaultScale();
    if (devScale != 1) {
        transform.setToScale(devScale, devScale);
        invalidateTransform();
    }

    font = f;
    if (font == null) {
        font = defaultFont;
    }

    setDevClip(sd.getBounds());
    invalidatePipe();
}
SunGraphics2D.java 文件源码 项目:OpenJSharp 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Sets the preferences for the rendering algorithms.
 * Hint categories include controls for rendering quality and
 * overall time/quality trade-off in the rendering process.
 * @param hints The rendering hints to be set
 * @see RenderingHints
 */
public void setRenderingHints(Map<?,?> hints) {
    this.hints = null;
    renderHint = SunHints.INTVAL_RENDER_DEFAULT;
    antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
    textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT;
    fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF;
    lcdTextContrast = lcdTextContrastDefaultValue;
    interpolationHint = -1;
    interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
    boolean customHintPresent = false;
    Iterator<?> iter = hints.keySet().iterator();
    while (iter.hasNext()) {
        Object key = iter.next();
        if (key == SunHints.KEY_RENDERING ||
            key == SunHints.KEY_ANTIALIASING ||
            key == SunHints.KEY_TEXT_ANTIALIASING ||
            key == SunHints.KEY_FRACTIONALMETRICS ||
            key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST ||
            key == SunHints.KEY_STROKE_CONTROL ||
            key == SunHints.KEY_INTERPOLATION)
        {
            setRenderingHint((Key) key, hints.get(key));
        } else {
            customHintPresent = true;
        }
    }
    if (customHintPresent) {
        this.hints = makeHints(hints);
    }
    invalidatePipe();
}
OGLBlitLoops.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy, int dx, int dy, int w, int h)
{
    OGLBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx, sy, sx+w, sy+h,
                         dx, dy, dx+w, dy+h,
                         false);
}
OGLBlitLoops.java 文件源码 项目:OpenJSharp 阅读 34 收藏 0 点赞 0 评论 0
public void Scale(SurfaceData src, SurfaceData dst,
                  Composite comp, Region clip,
                  int sx1, int sy1,
                  int sx2, int sy2,
                  double dx1, double dy1,
                  double dx2, double dy2)
{
    OGLBlitLoops.IsoBlit(src, dst,
                         null, null,
                         comp, clip, null,
                         AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
                         sx1, sy1, sx2, sy2,
                         dx1, dy1, dx2, dy2,
                         false);
}


问题


面经


文章

微信
公众号

扫码关注公众号