Package org.geoforge.java.awt.texturepaint

Source Code of org.geoforge.java.awt.texturepaint.GfrFactoryTexturePaint

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.geoforge.java.awt.texturepaint;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.image.BufferedImage;

/**
*
* @author bill
*/
public class GfrFactoryTexturePaint extends Object
{

   static public TexturePaint s_get(
         Image img,
         Color colBg,
         int intSizeSquareIcon)
   {
      BufferedImage bie = new BufferedImage(
            intSizeSquareIcon,
            intSizeSquareIcon,
            BufferedImage.TYPE_INT_ARGB // ATTN !TYPE_INT_RGB
            );

      Graphics2D g2d = bie.createGraphics();

      g2d.drawImage(img, 0, 0, colBg, null);
     
      Rectangle rec = new Rectangle(0, 0, intSizeSquareIcon, intSizeSquareIcon);
      TexturePaint tpt = new TexturePaint(bie, rec);
     
      g2d.dispose();
      return tpt;
   }

   private GfrFactoryTexturePaint()
   {
      super();
   }
}
TOP

Related Classes of org.geoforge.java.awt.texturepaint.GfrFactoryTexturePaint

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.