[plt-scheme] region displayed after dc is scaled

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 21 09:43:27 EDT 2008

At Wed, 21 May 2008 06:03:04 -0700 (PDT), "zen1986 at gmail.com" wrote:
> I am using Mred to build some graphics.
> I encounter this problem:
> after My dc is scaled up, the top left region is always displayed.
> How can I make it show the center region?

It sounds like you have a drawing in some fixed-sized region like this:

  ----------
  |  ****  |
  | **  ** |
  | **  ** |
  |  ****  |
  ----------

and when you prefix the drawing with something like `(send dc set-scale
2 2)', then the drawing looks like

  ----------
  |        |
  |    ****|***
  |  ******|*****
  |  ****  | ****
  ---------- ****
     ****    ****
     ****    ****
     ************
       ********

where the part outside the box is clipped. 

But you want

    ********
  *----------*
  *|**    **|*
  *|**    **|*
  *|**    **|*
  *|**    **|*
  *----------*
    ********

?


In that case, you can adjust the drawing origin, in addition to the
scale, by calling the `set-origin' method of the drawing context,
something like

 `(send dc set-origin -10 -10)'

but the actual numbers will depend on the scale factor and the size of
the drawn image.


Matthew



Posted on the users mailing list.