title: In Lua with Canvas Draw, how do you use an origin from the top left?
body: <p>This is what is basically one of the Lua Canvas Draw demo gutted. It draws a 100x100 rectangle from the bottom left - the only problem is, if I resize the canvas to a smaller size vertically, it begins to cut off the bottom of the rectangle instead of drawing from a new origin, but only after a certain point. Is there a way to draw from the top left corner?</p>
  <pre><code>require &quot;cdlua&quot;
  require &quot;iuplua&quot;
  require &quot;iupluacd&quot;
  
  function newWindow(w,h)
      w = w or 300
      h = h or 200
      canvas = iup.canvas{rastersize=w..&quot;x&quot;..h,border=&quot;no&quot;}
      dialog = iup.dialog{canvas; title=&quot;canvas&quot;}
      
      function canvas:map_cb()
          self.canvas = cd.CreateCanvas(cd.IUP, self)
      end
      
      function canvas:action()
          self.canvas:Activate()
          self.canvas:Clear()
          if self.Draw then
              self:Draw(self.canvas)
          end
      end
  
      function dialog:close_cb()
          self[1].canvas:Kill()
          self:destroy()
          return iup.IGNORE
      end
      return dialog
  end
  
  
  local dialog = newWindow(w, h)
  local canvas = dialog[1]
  
  function canvas:Draw()
      canvas = self.canvas
      canvas:Rect(0,100,0,100)
  end
  
  
  dialog:show()
  iup.MainLoop()
  </code></pre>
  <p>This picture depicts two screenshots of the current effects in the right column and two pictures of the desired effect in the left column.</p>
  <p><img src="https://i.stack.imgur.com/okf5d.png" alt="enter image description here" /></p>