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

2014/3/13

Mistake at drawing?

1
2
danpost danpost

2014/3/14

#
Just increase the size of the image created using the following for line 3:
1
GreenfootImage image = new GreenfootImage(radius+1, radius+1);
I believe that should fix it.
Pointifix Pointifix

2014/3/14

#
i got another halfpipe some days before but i cant get the same again, i dont know why, but that one was much better then the one you showed me
danpost danpost

2014/3/14

#
I do not believe that the drawing/filling methods adjust the alpha values back toward zero. So, once a pixel is opaque (alpha value of 255), it stays opaque until it is individually set with 'setColorAt' to something less opaque or the image is cleared.
danpost danpost

2014/3/14

#
Pointifix wrote...
i got another halfpipe some days before but i cant get the same again, i dont know why, but that one was much better then the one you showed me
Actually, these are quarter-pipes. Anyway, how was the one from days before better?
Pointifix Pointifix

2014/3/14

#
it looked like YYYYYYYYYYYT YYYYYYYYYYYT YYYYYYYYYYXX YYYYYYYYYXXX YYYYYYYXXXXX YYYYXXXXXXX TTXXXXXXXXX it looked like that and the the endings, symboled with T are missing
Pointifix Pointifix

2014/3/14

#
i always call them halfpipes, sry for that^^
danpost danpost

2014/3/14

#
danpost wrote...
Just increase the size of the image created using the following for line 3:
1
GreenfootImage image = new GreenfootImage(radius+1, radius+1);
I believe that should fix it.
Did you do this?
Pointifix Pointifix

2014/3/14

#
ah overread the radius + 1 sry, jeah with that it works, mhhmmm
danpost danpost

2014/3/14

#
I tested and confirmed the following methods:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// pixel setting
public GreenfootImage getClearQuarterCircle(int radius, java.awt.Color exteriorColor)
{
    GreenfootImage image = new GreenfootImage(radius+1, radius+1);
    for (int y=0; y<radius+1; y++)
        for (int x=radius; x>= 0; x--)
            if (Math.hypot(x, y) > radius) image.setColorAt(x, y, exteriorColor); else break;
    return image;
}
// line drawing
public GreenfootImage getClearQuarterCircle(int radius, java.awt.Color exteriorColor)
{
    GreenfootImage image = new GreenfootImage(radius+1, radius+1);
    image.setColor(exteriorColor);
    for (int y=0; y<=radius+1; y++) image.drawLine((int)Math.sqrt(radius*radius-y*y)+1, y, radius, y);
    return image;
}
Pointifix Pointifix

2014/3/14

#
ok solved, thanks a lot again ;)
You need to login to post a reply.
1
2