When using /drawrot, the image seems to be rotated around an ambiguous center point related to window size.

For instance, if the window's display area is large enough to house the entire image it works fine; but if the window is NOT large enough, the drawrot fails:

Code:
;; compare
;;     /drawrotbug 100
;;
;; to an input that, when doubled, is larger than your display area; example:
;;     /drawrotbut 1000
alias DrawRotBug {
  close -@ @DrawRotBug

  var %CellSize = $iif($1, $1, 1000)
  var %File = $qt($scriptdirDrawRotBug $+ $ticks $+ .bmp)

  ;; Create the picwin
  window -pBfz @DrawRotBug -1 -1 $calc(%CellSize *2) $calc(%CellSize * 2)

  ;; Draw a 'filling' rectangle to:
  ;;     1. set the background color for the image
  ;;     2. extend the internal bitmap to the correct size
  drawrect -fr @DrawRotBug 16777215 1 0 0 $calc(%CellSize *2) $calc(%CellSize * 2)

  ;; Draw something to have a visual representation
  drawrect -fr @DrawRotBug 0 1 0 0 %CellSize 20
  drawrect -fr @DrawRotBug 0 1 0 0 20 %CellSize
  drawrect -fr @DrawRotBug 255 1 0 $calc(%CellSize - 20) 20 20
  drawrect -fr @DrawRotBug 65280 1 $calc(%CellSize - 20) 0 20 20 

  ;; Copy & paste the top-left cell to the top-right
  drawcopy @DrawRotBug 0 0 %CellSize %CellSize @DrawRotBug %CellSize 0

  ;; rotate top-left 90 degrees
  drawrot @DrawRotBug 90 %CellSize 0 %CellSize %CellSize

  ;; copy & paste top-half to bottom-half
  drawcopy @DrawRotBug 0 0 $calc(%CellSize *2) %CellSize @DrawRotBug 0 %CellSize

  ;; rotate bottom-half 180 degrees
  drawrot @DrawRotBug 180 0 %CellSize $calc(%CellSize *2) %CellSize

  /*
  ;; uncomment if you want to see the result with external picture editor
  drawsave @DrawRotBug %file
  run %file
  */
}


I am SReject
My Stuff