• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedImage ( hello, anyone home??? )  RSS feed

 
Douglas Braxton
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all
i am attempting to draw a polygon (in this case a pentagon) and have succeeded in getting it drawn and displayed on JPanel.
trouble starts when i try to texture it so that the pentagon stands out from the rectangle it is painted on.
please help. SEE "// TROUBLE STARTS HERE" comment
compiler errors so far are
MyPoly7A.java [47:1] cannot resolve symbol
symbol : constructor BufferedImage (int[],int[],int,int)
location: class java.awt.image.BufferedImage
BufferedImage buffImage = new BufferedImage ( xy [ 0 ], xy [ 1 ], 5, BufferedImage.TYPE_INT_RGB );
^
MyPoly7A.java [49:1] cannot resolve symbol
symbol : constructor TexturePaint (java.awt.image.BufferedImage,java.awt.Polygon)
location: class java.awt.TexturePaint
TexturePaint tp = new TexturePaint ( buffImage, new Polygon( xy [ 0 ], xy [ 1 ], 5 ) );
^
MyPoly7A.java [51:1] cannot resolve symbol
symbol : method fillPoly (int,int,int,int)
location: class java.awt.Graphics2D
gg.fillPoly(10,10,200,300);
^
3 errors
Errors compiling MyPoly7A.


[ April 22, 2004: Message edited by: Douglas Braxton ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


compiler errors so far are
MyPoly7A.java [47:1] cannot resolve symbol
symbol : constructor BufferedImage (int[],int[],int,int)
location: class java.awt.image.BufferedImage
BufferedImage buffImage = new BufferedImage ( xy [ 0 ], xy [ 1 ], 5, BufferedImage.TYPE_INT_RGB );

Let's look at the compilerwarning (cannot resolv symbol: constructor).
There is a constructor:

but the compiler looks for:
constructor BufferedImage (int[],int[],int,int)
For the first parameter, you use:

which is defined like this:

The first element xy[0]of a two-dimensional array xy[][] is the first array.
for instance:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!