GFX2CPP

By foshizzle on Sep 16, 2008

this is a simple alias that converts an image(that mirc can load) and outputs it as a C++ header file(not compressed)
syntax: /IMG2CPP NAME_OF_ARRAY OUTPUT_FILE(SAVED TO mIRC DIR) IMAGE(ANY DIR)

Because of mircs power, It will run extremely slow and takes up lots of memory

Features:
Image of any size
if you have WhileFix DLL in your mIRC folder it auto uses it allowing for ctrl+break to cancel
opens file in notepad.exe (change to any you want, last line b4 } )
informative status

;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-) -2 $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 writing3 $calc(%iW * %iH) pixels to $2 $+ .
  titlebar @GFX2CPP - FINISHED
  window -c @GFX
  run notepad.exe $2
} 

Comments

Sign in to comment.
^Neptune   -  Oct 30, 2008

Holy cow, those are some big calculations.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.