Example usage for java.awt RenderingHints KEY_RENDERING

List of usage examples for java.awt RenderingHints KEY_RENDERING

Introduction

In this page you can find the example usage for java.awt RenderingHints KEY_RENDERING.

Prototype

Key KEY_RENDERING

To view the source code for java.awt RenderingHints KEY_RENDERING.

Click Source Link

Document

Rendering hint key.

Usage

From source file:Starry.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.white);//from  w w w.  j ava  2 s  .  c  o m
    w = getSize().width;
    h = getSize().height;
    Graphics2D g2;
    g2 = (Graphics2D) g;

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

    FontRenderContext frc = g2.getFontRenderContext();
    Font f = new Font("Helvetica", 1, w / 10);
    String s = new String("The Starry Night");
    TextLayout textTl = new TextLayout(s, f, frc);
    AffineTransform transform = new AffineTransform();
    Shape outline = textTl.getOutline(null);
    Rectangle r = outline.getBounds();
    transform = g2.getTransform();
    transform.translate(w / 2 - (r.width / 2), h / 2 + (r.height / 2));
    g2.transform(transform);
    g2.setColor(Color.blue);
    g2.draw(outline);
    g2.setClip(outline);
    g2.drawImage(img, r.x, r.y, r.width, r.height, this);

}

From source file:game.com.HandleUploadGameThumbServlet.java

public static BufferedImage resizeImage(final Image image, int width, int height) {
    final BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    final Graphics2D graphics2D = bufferedImage.createGraphics();
    graphics2D.setComposite(AlphaComposite.Src);
    //below three lines are for RenderingHints for better image quality at cost of higher processing time
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    graphics2D.drawImage(image, 0, 0, width, height, null);
    graphics2D.dispose();//w  w  w . j  av a  2s.c om
    return bufferedImage;
}

From source file:edu.emory.library.tast.images.ThumbnailServlet.java

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // location of images
    String baseUrl = AppConfig.getConfiguration().getString(AppConfig.IMAGES_URL);
    baseUrl = StringUtils.trimEnd(baseUrl, '/');

    // image name and size
    String imageFileName = request.getParameter("i");
    int thumbnailWidth = Integer.parseInt(request.getParameter("w"));
    int thumbnailHeight = Integer.parseInt(request.getParameter("h"));

    // image dir//from  w  ww  .j  a v  a  2 s  .  c  o m
    String imagesDir = AppConfig.getConfiguration().getString(AppConfig.IMAGES_DIRECTORY);

    // create the thumbnail name
    String thumbnailFileName = FilenameUtils.getBaseName(imageFileName) + "-" + thumbnailWidth + "x"
            + thumbnailHeight + ".png";

    // does it exist?
    File thumbnailFile = new File(imagesDir, thumbnailFileName);
    if (thumbnailFile.exists()) {
        response.sendRedirect(baseUrl + "/" + thumbnailFileName);
        return;
    }

    // read the image
    File imageFile = new File(imagesDir, imageFileName);
    BufferedImage image = ImageIO.read(imageFile);
    int imageWidth = image.getWidth();
    int imageHeight = image.getHeight();
    BufferedImage imageCopy = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
    imageCopy.getGraphics().drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, imageWidth, imageHeight,
            null);

    // height is calculated automatically
    if (thumbnailHeight == 0)
        thumbnailHeight = (int) ((double) thumbnailWidth / (double) imageWidth * (double) imageHeight);

    // width is calculated automatically
    if (thumbnailWidth == 0)
        thumbnailWidth = (int) ((double) thumbnailHeight / (double) imageHeight * (double) imageWidth);

    // create an empty thumbnail
    BufferedImage thumbnail = new BufferedImage(thumbnailWidth, thumbnailHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D gr = thumbnail.createGraphics();
    gr.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    gr.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

    // determine the piece of the image which we want to clip
    int clipX1, clipX2, clipY1, clipY2;
    if (imageWidth * thumbnailHeight > thumbnailWidth * imageHeight) {

        int clipWidth = (int) Math
                .round(((double) thumbnailWidth / (double) thumbnailHeight) * (double) imageHeight);
        int imgCenterX = imageWidth / 2;
        clipX1 = imgCenterX - clipWidth / 2;
        clipX2 = imgCenterX + clipWidth / 2;
        clipY1 = 0;
        clipY2 = imageHeight;
    } else {
        int clipHeight = (int) Math
                .round(((double) thumbnailHeight / (double) thumbnailWidth) * (double) imageWidth);
        int imgCenterY = imageHeight / 2;
        clipX1 = 0;
        clipX2 = imageWidth;
        clipY1 = imgCenterY - clipHeight / 2;
        clipY2 = imgCenterY + clipHeight / 2;
    }

    // we filter the image first to get better results when shrinking
    if (2 * thumbnailWidth < clipX2 - clipX1 || 2 * thumbnailHeight < clipY2 - clipY1) {

        int kernelDimX = (clipX2 - clipX1) / (thumbnailWidth);
        int kernelDimY = (clipY2 - clipY1) / (thumbnailHeight);

        if (kernelDimX % 2 == 0)
            kernelDimX++;
        if (kernelDimY % 2 == 0)
            kernelDimY++;

        if (kernelDimX < kernelDimY)
            kernelDimX = kernelDimY;
        if (kernelDimY < kernelDimX)
            kernelDimY = kernelDimX;

        float[] blurKernel = new float[kernelDimX * kernelDimY];
        for (int i = 0; i < kernelDimX; i++)
            for (int j = 0; j < kernelDimY; j++)
                blurKernel[i * kernelDimX + j] = 1.0f / (float) (kernelDimX * kernelDimY);

        BufferedImageOp op = new ConvolveOp(new Kernel(kernelDimX, kernelDimY, blurKernel));
        imageCopy = op.filter(imageCopy, null);

    }

    // draw the thumbnail
    gr.drawImage(imageCopy, 0, 0, thumbnailWidth, thumbnailHeight, clipX1, clipY1, clipX2, clipY2, null);

    // and we are done
    gr.dispose();
    ImageIO.write(thumbnail, "png", thumbnailFile);

    // redirect to it
    response.sendRedirect(baseUrl + "/" + thumbnailFileName);

}

From source file:org.kuali.mobility.people.service.PeopleServiceImpl.java

@Override
public BufferedImage generateObfuscatedImage(String text) {
    int width = 250;
    int height = 25;

    BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

    Graphics2D g2d = bufferedImage.createGraphics();
    Font font = new Font("Arial", Font.PLAIN, 14);
    g2d.setFont(font);/* www .ja  v a 2 s.c  o  m*/

    RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

    g2d.setRenderingHints(rh);

    Paint bg = new Color(255, 255, 255);
    g2d.setPaint(bg);
    g2d.fillRect(0, 0, width, height);

    int x = 0;
    int y = height - 7;

    Paint textPaint = new Color(0, 0, 0);
    g2d.setPaint(textPaint);
    g2d.drawString(text, x, y);

    g2d.dispose();
    return bufferedImage;
}

From source file:com.t3.image.ImageUtil.java

/**
 * Create a copy of the image that is compatible with the current graphics context
 * and scaled to the supplied size//from w  w  w  .  j ava  2 s.  c  om
 */
public static BufferedImage createCompatibleImage(Image img, int width, int height, Map<String, Object> hints) {

    width = Math.max(width, 1);
    height = Math.max(height, 1);

    int transparency;
    if (hints != null && hints.containsKey(HINT_TRANSPARENCY)) {
        transparency = (Integer) hints.get(HINT_TRANSPARENCY);
    } else {
        transparency = pickBestTransparency(img);
    }
    BufferedImage compImg = new BufferedImage(width, height, transparency);

    Graphics2D g = null;
    try {
        g = compImg.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

        g.drawImage(img, 0, 0, width, height, null);
    } finally {
        if (g != null) {
            g.dispose();
        }
    }

    return compImg;
}

From source file:com.alibaba.simpleimage.ScaleTest.java

public PlanarImage doProgressiveBicubic(PlanarImage op) throws Exception {
    int dstWidth = 220;
    int w = op.getWidth();

    while (w > dstWidth) {
        scale = 0.6f;//from ww  w  . ja  v a2s .  co  m

        ParameterBlock pb = new ParameterBlock();
        pb.addSource(op);
        pb.add(scale);
        pb.add(scale);
        pb.add(0.0F);
        pb.add(0.0F);
        pb.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC));
        RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_RENDERING,
                RenderingHints.VALUE_RENDER_QUALITY);
        op = JAI.create("scale", pb, qualityHints);

        w = (int) (scale * w);
    }

    return op;
}

From source file:net.rptools.lib.image.ImageUtil.java

/**
 * Create a copy of the image that is compatible with the current graphics context and scaled to the supplied size
 *//*w  w  w  .  j  a  v a2s  .com*/
public static BufferedImage createCompatibleImage(Image img, int width, int height, Map<String, Object> hints) {
    width = Math.max(width, 1);
    height = Math.max(height, 1);

    int transparency;
    if (hints != null && hints.containsKey(HINT_TRANSPARENCY)) {
        transparency = (Integer) hints.get(HINT_TRANSPARENCY);
    } else {
        transparency = pickBestTransparency(img);
    }
    BufferedImage compImg = new BufferedImage(width, height, transparency);

    Graphics2D g = null;
    try {
        g = compImg.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

        g.drawImage(img, 0, 0, width, height, null);
    } finally {
        if (g != null) {
            g.dispose();
        }
    }
    return compImg;
}

From source file:juicebox.mapcolorui.HeatmapRenderer.java

public boolean render(int originX, int originY, int width, int height, final MatrixZoomData zd,
        final MatrixZoomData controlZD, final MatrixType displayOption,
        final NormalizationType normalizationType, final ExpectedValueFunction df, Graphics2D g) {

    g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
    g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);

    int chr1 = zd.getChr1Idx();
    int chr2 = zd.getChr2Idx();
    int x = originX;
    int y = originY;

    boolean isWholeGenome = chr1 == 0 && chr2 == 0;
    boolean sameChr = (chr1 == chr2);

    if (sameChr) {
        // Data is transposable, transpose if necessary.  Convention is to use lower diagonal
        if (x > y) {
            //noinspection SuspiciousNameCombination
            x = originY;//  w w w. jav  a  2 s  .c o  m
            y = originX;
            int tmp = width;
            width = height;
            height = tmp;
        }
    }

    int maxX = x + width - 1;
    int maxY = y + height - 1;

    if (displayOption == MatrixType.PEARSON) {

        BasicMatrix bm = zd.getPearsons(df);

        ((HiCColorScale) pearsonColorScale).setMin(bm.getLowerValue());
        ((HiCColorScale) pearsonColorScale).setMax(bm.getUpperValue());
        renderMatrix(bm, originX, originY, width, height, pearsonColorScale, g);

    } else {
        // Iterate through blocks overlapping visible region

        List<Block> blocks = zd.getNormalizedBlocksOverlapping(x, y, maxX, maxY, normalizationType);
        if (blocks == null) {
            return false;
        }

        boolean hasControl = controlZD != null
                && (displayOption == MatrixType.CONTROL || displayOption == MatrixType.RATIO);
        Map<Integer, Block> controlBlocks = new HashMap<Integer, Block>();
        if (hasControl) {
            List<Block> ctrls = controlZD.getNormalizedBlocksOverlapping(x, y, maxX, maxY, normalizationType);
            for (Block b : ctrls) {
                controlBlocks.put(b.getNumber(), b);
            }
        }

        String key = zd.getKey() + displayOption;
        ColorScale cs = getColorScale(key, displayOption, isWholeGenome, blocks);

        double averageCount = zd.getAverageCount(); // Will get overwritten for intra-chr
        double ctrlAverageCount = controlZD == null ? 1 : controlZD.getAverageCount();
        for (Block b : blocks) {

            Collection<ContactRecord> recs = b.getContactRecords();
            if (recs != null) {

                Map<String, ContactRecord> controlRecords = new HashMap<String, ContactRecord>();
                if (hasControl) {
                    Block cb = controlBlocks.get(b.getNumber());
                    if (cb != null) {
                        for (ContactRecord ctrlRec : cb.getContactRecords()) {
                            controlRecords.put(ctrlRec.getKey(), ctrlRec);
                        }
                    }
                }

                for (ContactRecord rec : recs) {
                    double score = Double.NaN;
                    if (displayOption == MatrixType.OE || displayOption == MatrixType.EXPECTED) {
                        double expected = 0;
                        if (chr1 == chr2) {
                            if (df != null) {
                                int binX = rec.getBinX();
                                int binY = rec.getBinY();
                                int dist = Math.abs(binX - binY);
                                expected = df.getExpectedValue(chr1, dist);
                            }
                        } else {
                            expected = (averageCount > 0 ? averageCount : 1);
                        }

                        if (displayOption == MatrixType.OE) {
                            score = rec.getCounts() / expected;
                        } else {
                            score = expected;
                        }
                    } else if (displayOption == MatrixType.CONTROL && hasControl) {
                        ContactRecord ctrlRecord = controlRecords.get(rec.getKey());
                        if (ctrlRecord != null)
                            score = ctrlRecord.getCounts();
                    } else if (displayOption == MatrixType.RATIO && hasControl) {
                        ContactRecord ctrlRecord = controlRecords.get(rec.getKey());
                        if (ctrlRecord != null && ctrlRecord.getCounts() > 0) {
                            double num = rec.getCounts() / averageCount;
                            double den = ctrlRecord.getCounts() / ctrlAverageCount;
                            score = num / den;
                        }
                    } else {
                        score = rec.getCounts();
                    }
                    if (Double.isNaN(score))
                        continue;

                    Color color = cs.getColor((float) score);
                    g.setColor(color);

                    int px = rec.getBinX() - originX;
                    int py = rec.getBinY() - originY;
                    if (px > -1 && py > -1 && px <= width && py <= height) {
                        g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH);
                    }

                    if (sameChr && (rec.getBinX() != rec.getBinY())) {
                        px = (rec.getBinY() - originX);
                        py = (rec.getBinX() - originY);
                        if (px > -1 && py > -1 && px <= width && py <= height) {
                            g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH);
                        }
                    }
                }
            }
        }
    }
    return true;
}

From source file:net.sf.maltcms.common.charts.api.XYChartBuilder.java

/**
 *
 *//*from  w ww .  j ava 2 s .  co  m*/
public XYChartBuilder() {
    plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);
    chart = new JFreeChart(plot);
    renderingHints = new RenderingHints(null);
    renderingHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    renderingHints.put(RenderingHints.KEY_TEXT_LCD_CONTRAST, 100);
    renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    renderingHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
    renderingHints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    renderingHints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    renderingHints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    renderingHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
    renderingHints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
            RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
}

From source file:net.sf.firemox.clickable.target.card.VirtualCard.java

@SuppressWarnings("null")
@Override//from   w  w w  .jav a  2 s .  co  m
public void paintComponent(Graphics g) {
    final Graphics2D g2D = (Graphics2D) g;

    // Renderer
    g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    // Optimization card painting
    final MZone container = card.getContainer();
    final boolean shortPaint = container == null || !container.isMustBePainted(card);

    // tap/reverse operation : PI/2, PI, -PI/2 rotation
    if (!shortPaint) {
        if (container.isMustBePaintedReversed(card)) {
            if (card.tapped) {
                g2D.translate(rotateTransformY, CardFactory.cardWidth + rotateTransformX);
                g2D.rotate(angle - Math.PI / 2);
            } else {
                g2D.translate(CardFactory.cardWidth + rotateTransformX,
                        CardFactory.cardHeight + rotateTransformY);
                g2D.rotate(Math.PI - angle);
            }
        } else {
            if (card.tapped) {
                g2D.translate(CardFactory.cardHeight + rotateTransformY, rotateTransformX);
                g2D.rotate(Math.PI / 2 + angle);
            } else {
                g2D.translate(rotateTransformX, rotateTransformY);
                g2D.rotate(angle);
            }
        }
    }

    if (container != null) {
        if (container.isVisibleForOpponent() && !card.isVisibleForOpponent() && card.isVisibleForYou()) {
            /*
             * This card is visible for you but not for opponent in despite of the
             * fact the container is public.
             */
            g2D.drawImage(card.scaledImage(), null, null);
            g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
            g2D.drawImage(DatabaseFactory.scaledBackImage, null, null);
        } else if (!card.isVisibleForYou()) {
            g2D.drawImage(DatabaseFactory.scaledBackImage, null, null);
        } else {
            g2D.drawImage(card.scaledImage(), null, null);
        }
    }

    if (shortPaint)
        return;

    /*
     * The card picture is displayed as a rounded rectangle with 0,90,180 or
     * 270
     */
    if (card.isHighLighted && (card.isVisibleForYou() || StackManager.idHandedPlayer == 0)) {
        // Draw the rounded colored rectangle
        g2D.setColor(card.highLightColor);
        g2D.draw3DRect(0, 0, CardFactory.cardWidth - 2, CardFactory.cardHeight - 2, false);
    }

    // Draw the eventual progress bar
    card.database.updatePaintNotification(card, g);

    // Cursor for our pretty pictures
    int px = 3;
    int py = 3;
    int maxX = CardFactory.cardWidth - 2;

    // for in-play, visible cards
    if (card.isVisibleForYou() || (container != null && container.isVisibleForYou())) {

        // draw registers above the card's picture
        if (refreshToolTipFilter().powerANDtoughness) {
            // power / toughness
            final String powerANDtoughness = String.valueOf(card.getValue(IdTokens.POWER)) + "/"
                    + card.getValue(IdTokens.TOUGHNESS);
            g2D.setFont(g2D.getFont().deriveFont(Font.BOLD, 13));
            final Rectangle2D stringDim = g2D.getFontMetrics().getStringBounds(powerANDtoughness, g2D);
            g2D.setColor(CardFactory.powerToughnessColor);
            g2D.drawString(powerANDtoughness, (int) (CardFactory.cardWidth - stringDim.getWidth() - 3),
                    CardFactory.cardHeight - 5);
            g2D.setColor(Color.BLUE);
            g2D.drawString(powerANDtoughness, (int) (CardFactory.cardWidth - stringDim.getWidth() - 3),
                    CardFactory.cardHeight - 6);
        }

        /*
         * START drawing additional pictures
         */

        // draw state pictures
        for (StatePicture statePicture : CardFactory.statePictures) {
            if (px + 13 > maxX) {
                px = 3;
                py += 13;
            }
            if (statePicture.paint(card, g2D, px, py)) {
                px += 13;
            }
        }

        // draw properties
        if (card.cachedProperties != null) {
            for (Integer property : card.cachedProperties) {
                if (Configuration.getBoolean("card.property.picture", true)
                        && CardFactory.propertyPictures.get(property) != null) {
                    // There is an associated picture to this property
                    if (px + 13 > maxX) {
                        px = 3;
                        py += 13;
                    }
                    g2D.drawImage(CardFactory.propertyPictures.get(property), px, py, 12, 12, null);
                    px += 13;
                }
            }
        }
    }

    // draw attached objects
    int startX = 3;
    int startY = CardFactory.cardHeight - 18;
    if (card.registerModifiers != null) {
        for (int i = card.registerModifiers.length; i-- > 0;) {
            if (card.registerModifiers[i] != null) {
                startX = card.registerModifiers[i].paintObject(g, startX, startY);
            }
        }
    }
    if (card.propertyModifier != null) {
        startX = card.propertyModifier.paintObject(g, startX, startY);
    }
    if (card.idCardModifier != null) {
        card.idCardModifier.paintObject(g, startX, startY);
        /*
         * END drawing additional pictures
         */
    }

    // Draw the target Id if helper said it
    final String id = TargetHelper.getInstance().getMyId(card);
    if (id != null) {
        if (px + 13 > maxX) {
            px = 3;
            py += 13;
        }
        if (id == TargetHelper.STR_CONTEXT1) {
            // TODO I am in the context 1, draw a picture
            g2D.setColor(Color.BLUE);
            g2D.setFont(g2D.getFont().deriveFont(Font.BOLD, 60 / id.length()));
            g2D.drawString(id, 5, CardFactory.cardHeight - 15);
        } else if (id == TargetHelper.STR_CONTEXT2) {
            // TODO I am in the context 2, draw a picture
            g2D.setColor(Color.BLUE);
            g2D.setFont(g2D.getFont().deriveFont(Font.BOLD, 60 / id.length()));
            g2D.drawString(id, 5, CardFactory.cardHeight - 15);
        } else if (id != TargetHelper.STR_SOURCE) {
            // } else if (id == TargetHelper.STR_SOURCE) {
            // TODO I am the source, draw a picture
            // } else {
            // I am a target
            g2D.drawImage(TargetHelper.getInstance().getTargetPictureSml(), px, py, null);
            py += 12;
        }
    }

    g2D.dispose();
}