mIRC Home    About    Download    Register    News    Help

Print Thread
drawdot issue with size #267979 25/10/20 10:16 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
I always thought /drawdot wasn't meant to draw perfect circle, kind of, because i guess I only ever used small size, but there is a bug when size is below 7:

Code
//window -pdf @test -1 -1 1000 500 | var %x 15,%y 15,%n 1 | while (%n <= 50) { drawdot -r @test 255 %n %x %y | inc %n | inc %x 60 }
below 7, circles are not draw correctly.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: drawdot issue with size [Re: Wims] #267980 26/10/20 08:49 AM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
Correction: only size 5 and 6 are buggy, others can be said to be intended


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: drawdot issue with size [Re: Wims] #267982 26/10/20 10:06 AM
Joined: Dec 2002
Posts: 4,841
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,841
Considering this has been around for about twenty years, well spotted :-) It's due to the Ellipse() API, which struggles with tiny circles with even bounding dimensions at those two very specific sizes. One way to fix it is to change to odd bounding dimensions. This will mean that all dots will be slightly larger than they have been - so all existing scripts will be drawing slightly larger dots at all dot sizes. However, even though this would fix those two dots, Ellipse() then fails to draw the second smallest dot at all. I suppose I could add a kludge that caters for that specific dot. So, a bit of a conundrum not to mention backward compatibility hiccup. I could switch to writing my own ellipse/filling function but at this point, after twenty years, I'm happy to let those two little dots stay quirky.

Re: drawdot issue with size [Re: Khaled] #267983 26/10/20 01:33 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
Well, like I said, I knew about this since I started using drawdot 15 years ago, I always thought drawdot with a size bigger than 1 wasn't really meant to draw perfect circle like drawrect -e was, I figured it was an issue after a discussion with Talon and how he did expect perfect circles from it, but he was using greater size than 6.

I don't mind preserving backward compatibility on this, but during the discussion, it has been said that the dot being drawn by drawdot aren't the best.

I think a new switch to get better circle from drawdot using a custom ellipse function would be great, I'll make a suggestion probably, but here is an algo from Talon which does a good job if you want to do it right away:

Code
alias xdrawdot {
  ; @window color size x y
  var %x = 0 , %y = $3 , %d = $calc(3 - 2 * $3)
  while (%y >= %x) {
    drawline $1-2 1 $calc($4 + %x) $calc($5 + %y) $calc($4 - %x) $calc($5 + %y)
    drawline $1-2 1 $calc($4 + %x) $calc($5 - %y) $calc($4 - %x) $calc($5 - %y)
    drawline $1-2 1 $calc($4 + %y) $calc($5 + %x) $calc($4 - %y) $calc($5 + %x)
    drawline $1-2 1 $calc($4 + %y) $calc($5 - %x) $calc($4 - %y) $calc($5 - %x)
    if (%d > 0) { var %y = %y - 1 , %d = $calc(%d + 4 * (%x - %y) + 10) }
    else { var %d = $calc(%d + 4 * %x + 6) }
    inc %x
  }
}
It doesn't even use /drawfill!


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net