public function createBackground($width, $height, $red, $green, $blue)
 {
     $bg = WideImage::createPaletteImage($width, $height);
     $bgColor = $bg->allocateColor($red, $green, $blue);
     $bg->fill(0, 0, $bgColor);
     return $bg;
 }
 public function testFactories()
 {
     $this->assertTrue(WideImage::createTrueColorImage(100, 100) instanceof TrueColorImage);
     $this->assertTrue(WideImage::createPaletteImage(100, 100) instanceof PaletteImage);
 }
 public function testScaleUp()
 {
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(100, 50, 'fill', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 60, 'fill', 'up'), 120, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 40, 'fill', 'up'), 120, 40);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 60, 'fill', 'up'), 90, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 30, 'fill', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(100, 50, 'inside', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 60, 'inside', 'up'), 120, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 40, 'inside', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 60, 'inside', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 30, 'inside', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(100, 50, 'outside', 'up'), 100, 50);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 60, 'outside', 'up'), 120, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(120, 40, 'outside', 'up'), 120, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 60, 'outside', 'up'), 120, 60);
     $this->assertDimensions(WideImage::createPaletteImage(100, 50)->resize(90, 30, 'outside', 'up'), 100, 50);
 }