Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

PoSH Challenge Part 13

Again a level involving a bitmap, so if you follow this series code below should look kind a familiar by now See also : More fun with Bitmaps in Powershell ( PoSH Challenge part 10 )

# Level 14

[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

$bm = [System.Drawing.Bitmap]::FromFile( 'C:\_spons\wire.png' )
$new = New-Object System.Drawing.Bitmap(100 , 100)

$c = 200;$x=-1;$y=$i=0
trap{continue};while ($true) {
  foreach ($d in (1,0),(0,1),(-1,0),(0,-1)){
    1..[math]::Truncate($c /2) |% {
      $x += $d[0];$y += $d[1] 
      $new.SetPixel($x,$y,$bm.GetPixel($i,0))
      $i++  
    }
    $c--
  } 
}
$new.Save('c:\_spons\wire2.png')
ii c:\_spons\wire2.png

Enjoy,

Greetings /\/\o\/\/

 

Published Tuesday, February 05, 2008 5:45 AM by MoW

Comments

No Comments
Anonymous comments are disabled