forums

TNT Basic Forums > Bugs!
Pen transparency bug
< Last Thread     Next Thread >
Author
Thread        Post A Reply

06-10-2004 21:16

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

quote:
graphics mode 800,600
repeat
if mouse button
set pen color white
set pen transparency 1
else
set pen color black
set pen transparency 0
end if
line mouse x, mouse y to mouse x-100, mouse Y+10
draw frame
until space


Run the above bit of code, and click the mouse a few times without moving the mouse. When the mouse is down, it draws a line with a little transparency, and when the mouse it up the program draws a solid black line in the same spot. But if the transparency is set to 1 when drawing the white and 0 when drawing the black, certain spots are untouched.

So what is that?

06-10-2004 22:46

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

I dunno if it is the problem but your script probably draws the line when the mouse is down, so if you keep the mouse down for a while ( in programming terms 0.01 second is a while, remember ;) the computer continusly draws the line and eventually it looses its transparency. After drawing the line, you may add

while mouse buton
wend

that will cause the program to stop until the mouse is realeased

06-10-2004 22:47

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Obviously my answer had absolutely nothing to do with your problem, right?

06-11-2004 00:18

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

Right. ;P

Thanks anyway.

06-11-2004 03:05

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

it doesn't do it with 90 degree or 45 degree angles.

06-11-2004 03:07

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

i think it might have somthing to do with anti-aliasing, or the lack there of that is.

06-11-2004 05:55

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

So the transparency turns anti aliasing on and no transparency turns it off?

06-11-2004 23:49

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

i don't know about that, but i find it odd that it doesn't happen with virtical, horizontal, or 45 degree angles.

06-12-2004 07:48

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

Perhaps those lines' angle means that they require no antialiasing by their very nature.

06-12-2004 15:21

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

that's right.

11-21-2005 20:40

Posted by:
Jason Anderson

Location:
Doylestown, PA

Click Here to Email Jason Anderson   Find more posts by Jason Anderson

Your problem is with the 0 and 1. 0 means solid color. 1 means 99% color. What you probably wanted to do is draw invisible line which would be set pen transparency 100 instead of 1. But here's some better code. If you're just trying to draw when the mouse is pressed, try this:

quote:
window mode 800,600
repeat
if mouse button
set pen color white
set pen transparency 1
line mouse x, mouse y to mouse x-100, mouse Y+10
end if
draw frame
until space


Because your older code was drawing a black line over the white one. A solid almost non-transparent black line. That's what the set pen color black / set pen transparency 1 does.

quote:
The pen transparency is the transparency
in which all drawing operations (e.g. Line)
are drawn in.
percent is the new transparency level of
the pen. It can be any value between 0
(opaque) and 100(invisible).

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.