display corners and edges

Is there a display-resolution independent way to put a visual stimulus (text, picture, movie) in a corner or right at one of the edges of the display? That is, measured from the center, the distance to the edges will vary as a function of the display resolution, so if you put something 350 pixels down from the center in a 1024x768 display, it will be off the screen on a 640x480 display. I need to put a code into the lower-left corner of the screen, but there will be two display sizes I will use for the experiment.

Cheers,
Greg Shenaut

A solution for one specific case

After posting, I figured out a kludge that is “good enough” for the specific project I’m setting up now.

This series of experiments involves subjects looking at stimuli on the screen and also smelling scratch and sniff labels. In order to reduce experimenter errors, I wanted to display the two-digit number printed on the paper that the odor labels are mounted on, in gray digits, all the way in the lower left and right corners of the display (both corners, because the experimenter hands the labels to right-handed subjects from the left and vice versa). SInce these “ticket codes” are presented only during the ITI, nothing else really has to appear on the screen with them.

What I did was to use some pieces of the netpbm package to generate a black 640x480 png file, with the codes superimposed in gray in the lower left and right corners. Superlab is then programmed to expand the image to fill the screen, so the codes are always in the corners.

If anyone is interested, here is a Korn shell function to do this:

Usage: cornerpng XX file.png

XX is a two-digit code

cornerpng(){
ppmmake black 640 480
| ppmlabel -x 0 -y 478 -size 10 -background black -color gray -text $1
| ppmlabel -x 620 -y 478 -size 10 -background black -color gray -text $1
| pnmtopng > $2 2>/dev/null
}

I was going to recommend something like that, since that’s basically the only way.

One thing to note: Antialiasing is used on the Mac (not sure off the top of my head about Windows) if you are drawing to an offscreen buffer. If you are going to displaying at multiple resolutions, it will look better if you render at the higher resolution and let it be antialiased to the lower resolution.