public void match(ViewportState vs)
    {
	// Defend against self-copying
	if (vs == this) {
	    return;
	}


	// Match the scale factors according to auto scale options
	boolean toWidth = isAutoScaleProportionalToWidth();
	boolean toHeight = isAutoScaleProportionalToHeight();
	if (toWidth && toHeight) {
	    // Copy the one of the normalized X and Y factors that leads to
	    // smaller scale factors 
	    if (vs.getScaleX() / getScaleX() < vs.getScaleY() / getScaleY()) {
		_setScaleX(vs.getScaleX());
	    }
	    else {
		_setScaleY(vs.getScaleY());
	    }
	}
	else if (toWidth) {
	    // Copy the normalized X factor while maintaining the original
	    // pixel aspect ratio
	    _setScaleX(vs.getScaleX());
	}
	else if (toHeight) {
	    // Copy the normalized Y factor while maintaining the original
	    // pixel aspect ratio
	    _setScaleY(vs.getScaleY());
	}
	else {
	    // Copy *actual* scale factors as is
	    setActualScale(vs.getActualScaleX(), vs.getActualScaleY());
	}

	// Defend against null LUT and LUT w/ different # of bands
	if (vs._lut != null &&
	    (_lut == null ||
	     _lut.getNumComponents() == vs._lut.getNumComponents())) {
	    // Copy the LUT
	    _lut = (LookUpTable)vs._lut.clone();
	}

	// Copy the rest of the states
	setPan(vs._panX, vs._panY);
	_numberOfRotations = vs._numberOfRotations;
	_isVerticallyFlipped = vs._isVerticallyFlipped;
    }