mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2006
Posts: 8
S
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Aug 2006
Posts: 8
/drawline is not drawing the last pixel in a line.

Code:
alias drawtest {
  window -fp +b @DT 0 0 8 8
  drawline @DT 2 1 0 2 7 2
  drawline @DT 3 1 5 0 5 7
  drawline @DT 4 1 7 5 0 5
  drawline @DT 8 1 2 7 2 0
} 


Box A is the result, B is how it should be.


The red line is drawn left to right, green is top to bottom, red is right to left, and yellow is bottom to top. Each line is missing the last pixel. It seems to have been this way since v5.3.

This alias makes it work the way I expect:
Code:
alias drawline !drawline $1- | drawdot $deltok($1-,$+($iif(-* iswm $1,5,4),-,$calc($0 - 2)),32)

Joined: Apr 2004
Posts: 217
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 217
mIRC windows doe appear to be starting from x-1 and y-1. They have an internal border which it uses the 0,0 columns for it. Apparently (from /help) there isn't an options to remove this border. So maybe the /drawline command automatically +/- 1 more onto the starting x, to start the drawing outside the internal border. This could explain why the lines are shifted 1 pixel?

I never noticed this. I guess the simple way to "solve" this problem would to just add one onto your values.

Last edited by PhantasyX; 22/08/06 11:44 PM.
Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
-B removes the internal border and +d the external border.

/help /window

Joined: Apr 2004
Posts: 217
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 217
Aww.
Tricky, I was looking at the second set of switches. =x

Joined: Dec 2002
Posts: 3,840
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 3,840
Yes it has behaved that way ever since it was added, as such I'd rather not change it since it would affect all existing scripts. The reason for the behaviour is that the Windows API LineTo command behaves this way and no one noticed until some versions later if I remember rightly.


Link Copied to Clipboard