Revision 8549 trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java

View differences:

MarkerFillSymbol.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.5  2006-11-06 17:08:45  jaume
46
* Revision 1.6  2006-11-07 08:52:30  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.5  2006/11/06 17:08:45  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.4  2006/11/06 16:06:52  jaume
50 53
* *** empty log message ***
51 54
*
......
64 67

  
65 68
import java.awt.Dimension;
66 69
import java.awt.Graphics2D;
70
import java.awt.Paint;
67 71
import java.awt.Rectangle;
72
import java.awt.RenderingHints;
68 73
import java.awt.Shape;
69 74
import java.awt.TexturePaint;
70 75
import java.awt.geom.AffineTransform;
71 76
import java.awt.geom.Point2D;
77
import java.awt.image.BufferedImage;
72 78
import java.util.ArrayList;
73 79

  
74 80
import com.iver.cit.gvsig.fmap.core.FShape;
......
84 90
	private double xSeparation = 20;
85 91
	private double ySeparation = 20;
86 92
	private Dimension markerSize = new Dimension(7,7);
87
	private TexturePaint texture;
88 93

  
89 94
	public boolean isGrid() {
90 95
		return grid;
......
189 194
	}
190 195

  
191 196
	public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) {
192
		Point2D[] points = calculatePoints(r);
197
		/*Point2D[] points = calculatePoints(r);
193 198
		for (int i = 0; i < points.length; i++) {
194 199
			Rectangle myRect = new Rectangle((int) points[i].getX(),
195 200
					 						 (int) points[i].getY(),
196 201
					 						 (int) markerSize.getHeight(),
197 202
					 						 (int) markerSize.getWidth());
198 203
			markerSymbol.drawInsideRectangle(g, scaleInstance, myRect);
199
		}
204
		}*/
205
		int w=7;
206
		int h=7;
207

  
208
		BufferedImage bi = null;
209
		Graphics2D big = null;
210

  
211
		Rectangle rProv = new Rectangle();
212
		rProv.setFrame(0, 0,w,h);
213

  
214
		Paint resulPatternFill = null;
215
		bi= new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
216
		Graphics2D gAux = bi.createGraphics();
217
		markerSymbol.drawInsideRectangle(gAux, new AffineTransform(), rProv);
218
		resulPatternFill = new TexturePaint(bi,rProv);
219

  
220
//		BufferedImage image = new BufferedImage(7, 7, BufferedImage.TYPE_INT_ARGB);
221
//		Graphics2D gAux = image.createGraphics();
222
//		Rectangle rect = new Rectangle(0,0, 7,7);
223
//		markerSymbol.drawInsideRectangle(gAux, scaleInstance, rect);
224
//		gAux.setPaint(new TexturePaint(image, rect));
225
		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
226
			        RenderingHints.VALUE_ANTIALIAS_ON);
227

  
228
		g.setPaint(resulPatternFill);
229
		g.drawRect(0, 0, r.width, r.height);
230

  
200 231
	}
201 232

  
202 233
	private Point2D[] calculatePoints(Rectangle r) {

Also available in: Unified diff