Glimmr Drawing Commands

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Dimensioned image

    The dimensioned (or scaled) image command draws an image in just the same way as the image-drawing command, but it also allows us to specify the horizontal and vertical dimensions of the displayed image. The image will be scaled to fit in the required shape. Note that any scaling will adversely affect the quality of an image, but it is generally far worse to scale an image larger than its original size than to scale it down. We should avoid scaling images that include very thin lines if we can.

    This commands corresponds to the I6 instruction glk_image_draw_scaled.

        display image <figure name> in <window> at <origin> with dimensions <width> by <height>

    Long forms:

        display Figure of Frolf in the graphics-window at {0, 0} with dimensions 20 by 20.
        display Figure of Frolf in the graphics-window at 0 by 0 with dimensions 20 by 20.

    Short form:

        image Figure of Frolf at {0, 0} size 20 x 20.

    Speed notes:

        It takes slightly longer to display a scaled image than an unscaled one. In most cases, the difference is unimportant. However, we should always try to avoid scaling very large images. The best approach is to keep our images as close to the size we need as possible--don't use a larger image than is necessary.