/** * Tests Oz_Deepzoom_Descriptor->getDimension() */ public function testInvalidDimension() { try { $this->_descriptor->getDimension(-1); } catch (Oz_Deepzoom_Exception $e) { $this->assertTrue('Invalid pyramid level (dimension)' === $e->getMessage()); return; } $this->fail(); return; }
/** * Returns the bitmap image at the given level * * @param int $level * * @return Gr_Image */ public function getImage($level) { if (0 <= $level and $level < $this->_descriptor->numLevels()) { list($width, $height) = $this->_descriptor->getDimension($level); // don't transform to what we already have if ($this->_descriptor->width == $width and $this->_descriptor->height == $height) { return $this->_image; } else { $image = clone $this->_image; $image->resize($width, $height); return $image; } } else { new Oz_Deepzoom_Exception('Invalid pyramid level'); } }