All pastes #1224192 Raw Edit

Unnamed

public text v1 · immutable
#1224192 ·published 2008-10-10 00:29 UTC
rendered paste body
;GFX2CPP 2.1 - By Foshizzle
;syntax: /IMG2CPP NAME_OF_ARRAY OUTPUT_FILE(SAVED TO mIRC DIR) IMAGE(ANY DIR)
alias TransCol var %d (100 / $$7) | return $iif($calc(($1 / %d) + ($4 / %d)) <= 255, $ceil($v1), 255) $+ , $+ $iif($calc(($2 / %d) + ($5 / %d)) <= 255, $ceil($v1), 255) $+ , $+ $iif($calc(($3 / %d) + ($6 / %d)) <= 255, $ceil($v1), 255)
alias gfx2cpp {
  if (!$exists($3-)) { noop $input(No such file: $3-, hod, Error) | halt }
  var %iW = $pic($3-).width, %iH = $pic($3-).height
  window -phfB @GFX -1 -1 %iW %iH
  window -kdCfB @GFX2CPP -1 -1 320 240 $mircexe 44
  titlebar @GFX2CPP - WRITING
  aline -p @GFX2CPP Opening $qt($3-) - $bytes($pic($3-).size, b) bytes.
  drawpic @GFX 0 0 $3-
  aline @GFX2CPP Writing header data...
  write -c $2
  write $2 $chr(47) $+ * GFX2CPP - raw image data array * $+ $chr(47)
  write $2 #define $1 $+ _WIDTH %iW
  write $2 #define $1 $+ _HEIGHT %iH
  write $2 const int $1 $+ $chr(91) $+ $chr(93) = $chr(123)
  aline @GFX2CPP Writing array...
  if ($exists(WhileFix.dll)) aline 5 @GFX2CPP Press CTRL + Break to halt
  var %iX = 0, %iY = 0
  while (%iY < %iH) {
    if ($exists(WhileFix.dll)) dll WhileFix.dll WhileFix .
    %iX = 0
    while (%iX < %iW) {
      titlebar @GFX2CPP - WRITING $calc(((%iY * %iW) + %iX) + 1) of  $calc(%iW * %iH)
      write $2 $str($chr(32),2) $+ $calc($getdot(@GFX, %iX, %iY) % 16777216) $+ $chr(44)
      inc %iX
    }
    inc %iY
  }
  write $2 $chr(125) $+ ;
  aline @GFX2CPP Finished writing $calc(%iW * %iH) pixels to $2 $+ .
  titlebar @GFX2CPP - FINISHED
  window -c @GFX
  run notepad.exe $2
}