@@ -0,0 +1,2118 @@
+/* Copyright (C) 2006-2016 Patrick G. Durand%0A *%0A *  This program is free software: you can redistribute it and/or modify%0A *  it under the terms of the GNU Affero General Public License as published by%0A *  the Free Software Foundation, either version 3 of the License, or%0A *  (at your option) any later version.%0A *%0A *  You may obtain a copy of the License at%0A *%0A *     https://www.gnu.org/licenses/agpl-3.0.txt%0A *%0A *  This program is distributed in the hope that it will be useful,%0A *  but WITHOUT ANY WARRANTY; without even the implied warranty of%0A *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A *  GNU Affero General Public License for more details.%0A */%0Apackage bzh.plealog.bioinfo.ui.carto.painter;%0A%0Aimport java.awt.Graphics2D;%0Aimport java.awt.Rectangle;%0Aimport java.net.URL;%0A%0Aimport javax.swing.ImageIcon;%0A%0Aimport com.plealog.genericapp.api.log.EZLogger;%0A%0Aimport bzh.plealog.bioinfo.ui.carto.data.FGraphics;%0A%0A/**%0A * This painter draws an image. Please note that this painter does not%0A * resize provided image. So, provide image of appropriate size for your%0A * view.%0A * %0A * @author Patrick G. Durand%0A */%0Apublic class ImagePainter extends FeaturePainterBase %7B%0A  private ImageIcon _image;%0A  private int       _halfW;%0A  %0A  /**%0A   * Constructor.%0A   * %0A   * @param image an image%0A   */%0A  public ImagePainter(ImageIcon image)%7B%0A    _image = image;%0A    _halfW = _image.getIconWidth()/2;%0A  %7D%0A  /**%0A   * Constructor.%0A   * %0A   * @param resourcePath an absolute path to an image resource. When using%0A   * package based path, use slash as package sub names separator, e.g.%0A   * /foo/bar/image.png.%0A   */%0A  public ImagePainter(String resourcePath)%7B%0A    URL url = this.getClass().getResource(resourcePath);%0A    if (url==null)%7B%0A      EZLogger.warn(%22Resource not found: %22+resourcePath);%0A      return;%0A    %7D%0A    _image = new ImageIcon(url);%0A    _halfW = _image.getIconWidth()/2;%0A  %7D%0A%0A  public void paintFeature(Graphics2D g, Rectangle box, FGraphics fg, int strand) %7B%0A    if (_image==null)%0A      return;%0A    _image.paintIcon(null, g, box.x-_halfW, box.y);%0A  %7D%0A%0A  public String getName()%7B%0A    return %22image%22;%0A  %7D%0A%0A%7D%0A

add Image painter