This site requires JavaScript, please enable it in your browser!
Greenfoot back
erdelf
erdelf wrote ...

2012/10/5

drawLine(), bigger?

erdelf erdelf

2012/10/5

#
Is there a way to make the line drawn with the method drawLine() bigger?
danpost danpost

2012/10/5

#
See my Barrier and Bars scenario. Sorry, I realize that that scenario will not work because the lines are actors there. To create a thicker line, you can draw multiple lines next to each other or create an image with dimensions of the thickness and length of the line, fill it with a color, rotate it as required and use 'drawImage'.
actinium actinium

2012/10/6

#
you could always use fillRect with the requires thickness, if parallel or verticle that is.
SPower SPower

2012/10/7

#
@actinium That would only work for vertical and horizontal lines.
Gevater_Tod4711 Gevater_Tod4711

2012/10/7

#
May you could use fillPolygon. It would be a little difficult to get the right coordinates but it could work.
erdelf erdelf

2012/10/7

#
well, I only need vertical and horizontal lines. thx for your help
Upupzealot Upupzealot

2012/10/7

#
use getAwtImage(), than you can operate that BufferedImage by creating a Graphics2D on it
danpost danpost

2012/10/7

#
@Upupzealot, erdelf said he 'only need vertical and horizontal lines'. The method 'fillRect' of the GreenfootImage class is sufficient, as actinium said.
Upupzealot Upupzealot

2012/10/7

#
@danpost Yes, you are right
tylers tylers

2012/10/7

#
i used this:
for(int j=0;j<thickness;j++){

                img.drawLine(0+j,100+j,100+j,200+j);
}
SPower SPower

2012/10/7

#
Tylers, that would be slower than fillRect, which would be perfect in his case:
erdelf wrote...
well, I only need vertical and horizontal lines.
You need to login to post a reply.