graphics - Java Cross Hatching Texture -


How to know how to re-create cross-hashing textures in Java? The C # code belows shows how to complete this NAT framework. The Java snippet is close, but I am unable to rotate the lines correctly from 45 degrees.

C #

  Hatchbrush Crosshatch = new hatchbrush (hatchstyle. Cros, some color, some color);  

Java

  BufferedImage bufferedImage = new BufferedImage (5, 5, BufferedImage.TYPE_INT_ARGB); Graphics 2DG2 = Buffered Image. Credit Graphics (); G2.setColor (Color.BLUE); G2.fillRect (0, 0, 5, 5); G2.setColor (pinColor); G2.fill oval (0, 0, 5, 5); // Paint Rectangle 2D Rect = New Rectangle 2D with Texting Brush Double (0, 5, 5); G2d.setPaint (new texture patch (buffed, rect)); G2d.fill (size); thank you in advanced.  

This is the one which crosses the cross-5-pixel interval:

 < Code> BufferedImage bufferedImage = new BufferedImage (5, 5, BufferedImage.TYPE_INT_ARGB); Graphics 2DG2 = Buffered Image. Credit Graphics (); G2.setColor (backcolor); G2.fillRect (0, 0, 5, 5); G2.setColor (stripeColor); G2.drawline (0, 0, 5, 5); // \ g2.drawLine (0, 5, 5, 0); // // // Color Rectangle2D rect = new Rectangle2D.Double (0, 0, 5, 5) with colored brush; G2d.setPaint (new texture patch (buffed, rect)); G2d.fill (size);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -