mIRC Paint

By Gex on Mar 08, 2006

load the code to ur remotes and choose mirc paint from the menubar or write /paint

-description:-
-----------------
this snippet will add to your mirc a paint program to draw/edit/save picture with lots of options. it has a lot of functions..
-----------------------------------------------------------------
-installation: load this code into ur remote (alt + r) then choose mIRC paint from the menubar.
-------------------------------------------------------------------
-controls help:-
--------------------
* Brush:this options will let u draw in the paint window freely..same as the pen will do but the pen for the black and small font.
* Fill:this option lets u fill the chosen area with the specified color.
* spider:this is a new option in fact its not in the MS paint program and it lets u draw many lines all joined by one point(choose the spider then click on the window to specifiy the point and click anywhere in the window to c it working.
* polygon:this will let u draw a polygon(joined lines)
* Add text:this will let u add the specified text to the painting window.(click the add text and set the textoptions(fontsize,fontcolor) then click in the place u want the text to be added to in the painting window.
* Replace color:this will let u replace color x with color y in the painting picture. 
------------------------------------------------------------------
i think the rest of options are too easy and they are well known by all the users. for any help Pm me.
---------------------------
the code starts here:
-----------------------------
dialog toolbox {
  title "Toolbar"
  size 2 171 87 192
  option dbu
  text "Color", 2, 7 12 16 8
  combo 1, 35 8 47 50, size drop
  text "Brush size", 3, 6 24 25 8
  edit "", 4, 35 22 35 10, limit 2 center
  radio "Fill", 8, 6 69 75 10, push
  radio "Brush", 9, 6 47 76 10, push
  box "Color,Size", 5, 2 0 84 35
  box "Painting options", 6, 2 37 84 104
  radio "Spider", 7, 6 80 76 10, push
  radio "Pen", 10, 6 58 76 10, push
  button "Open", 11, 1 178 42 12
  button "Save As", 12, 44 178 41 12
  box "Rotate", 13, 2 141 83 36
  button "Rotate 90o", 14, 6 149 37 12
  button "Rotate 270o", 15, 25 162 37 12
  button "Rotate 180o", 16, 44 149 37 12
  radio "Draw Line", 18, 6 103 75 10, push
  radio "Polygon", 19, 6 92 76 10, push
  radio "Add Text", 17, 7 115 74 10, push
  radio "Replace Color", 20, 7 127 74 10, push
}
dialog repl {
  title "Replace Color"
  size -1 -1 94 38
  option dbu
  button "Replace", 1, 25 26 37 12
  combo 2, 35 2 60 50, size drop
  combo 3, 35 13 60 50, size drop
  text "Replace", 4, 4 3 25 8
  text "With", 5, 6 15 25 8
}
dialog textopt {
  title "Text options"
  size 1 568 84 51
  option dbu
  edit "", 1, 30 2 51 10, autohs
  text "Text", 2, 2 3 23 8
  text "Font Name", 4, 1 14 29 8
  combo 3, 30 14 51 50, size drop
  text "Font Size", 5, 2 27 25 8
  edit "", 6, 30 26 51 10
  combo 7, 30 38 51 50, size drop
  text "Font Color", 8, 2 40 25 8
}
on *:dialog:textopt:close:* {
  did -c toolbox 9
}
on *:dialog:toolbox:close:* {
  if ($window(@paint)) { window -c @paint }
  if ($dialog(textopt)) { dialog -x textopt textopt }
  .timercheck off 
}
on *:dialog:repl:init:* {
  did -ac repl 2,3 Black(1)
  did -a repl 2,3 Dark blue(2)
  did -a repl 2,3 Green(3)
  did -a repl 2,3 Red(4)
  did -a repl 2,3 Maroon(5)
  did -a repl 2,3 Purple(6)
  did -a repl 2,3 Orange(7)
  did -a repl 2,3 Yellow(8)
  did -a repl 2,3 Light green(9)
  did -a repl 2,3 Cyan(10)
  did -a repl 2,3 Light blue(11)
  did -a repl 2,3 Blue(12)
  did -a repl 2,3 Pink(13)
  did -a repl 2,3 Grey(14)
  did -a repl 2,3 light grey(15)
  did -a repl 2,3 12
}
on *:dialog:Repl:sclick:1 {
  drawreplace @paint $iif($numcheck($right($did(repl,2).seltext,3)),$+($right($did(repl,2).seltext,3),$right($did(repl,2).seltext,2)),$right($did(repl,2).seltext,2)) $iif($numcheck($right($did(repl,3).seltext,3)),$+($right($did(repl,3).seltext,3),$right($did(repl,3).seltext,2)),$right($did(repl,3).seltext,2))
}
on *:dialog:textopt:init:* {
  did -ac textopt 3 Verdana
  did -a textopt 3 Tahoma
  did -a textopt 3 FixedSys
  did -a textopt 3 Courier
  did -a textopt 3 Impact
  did -a textopt 3 Comic Sans MS
  did -ac textopt 7 Black(1)
  did -a textopt 7 Dark blue(2)
  did -a textopt 7 Green(3)
  did -a textopt 7 Red(4)
  did -a textopt 7 Maroon(5)
  did -a textopt 7 Purple(6)
  did -a textopt 7 Orange(7)
  did -a textopt 7 Yellow(8)
  did -a textopt 7 Light green(9)
  did -a textopt 7 Cyan(10)
  did -a textopt 7 Light blue(11)
  did -a textopt 7 Blue(12)
  did -a textopt 7 Pink(13)
  did -a textopt 7 Grey(14)
  did -a textopt 7 light grey(15)
  did -a textopt 6 12
}
on *:dialog:toolbox:init:* {
  did -ac toolbox 1 Black(1)
  did -a toolbox 1 Dark blue(2)
  did -a toolbox 1 Green(3)
  did -a toolbox 1 Red(4)
  did -a toolbox 1 Maroon(5)
  did -a toolbox 1 Purple(6)
  did -a toolbox 1 Orange(7)
  did -a toolbox 1 Yellow(8)
  did -a toolbox 1 Light green(9)
  did -a toolbox 1 Cyan(10)
  did -a toolbox 1 Light blue(11)
  did -a toolbox 1 Blue(12)
  did -a toolbox 1 Pink(13)
  did -a toolbox 1 Grey(14)
  did -a toolbox 1 light grey(15)
  did -a toolbox 4 5
  did -c toolbox 9
}
on *:dialog:toolbox:sclick:11 {
  var %x " $+ $$sfile(*.jpg,Select a Picture,open) $+ "
  if (%x) { 
    var %w $pic(%x).width,%h $pic(%x).height
    window -c @paint
    window -kadop +l @paint  184 239 %w %h 
    drawpic @paint 0 0  %x
  }
}
on *:dialog:toolbox:sclick:20 {
  echo  $$dialog(repl,repl,@paint)
}
on *:dialog:toolbox:sclick:12 {
  var %x " $+ $$sfile(*.bmp,Select a Location,Save) $+ .jpg"
  var %quality $$input(Enter a quality level between 1 and 100 (70 recommended),esaq,@paint,Jpg quality,70)
  drawsave -q $+ %quality @paint %x 
}

on *:dialog:toolbox:sclick:17 {
  if (!$dialog(textopt)) { dialog -m textopt textopt }
}
on *:dialog:Toolbox:Sclick:14 {
  drawrot -f @paint 90
}
on *:dialog:toolbox:Sclick:15 {
  drawrot -f @paint 270
}
on *:dialog:Toolbox:sclick:16 {
  drawrot -f @paint 180
}
on *:dialog:toolbox:sclick:* {
  if ($devent != 7)  { unset %m1 | unset %x1 | unset %y1 }
  if ($devent != 18) { unset %m2 | unset %x2 | unset %y2 }
  if ($devent != 19) { unset %m3 | unset %y3 | unset %x3 }
}

alias numcheck {
  if ($int($1)) { return $true }
  else { return $false }
}
alias paint {
  window -kdop +l @paint  184 239 800 600
  dialog -m toolbox toolbox
  .timercheck 0 0 check.1
}
alias check.1 {
  if (!$window(@paint)) {
    if ($dialog(toolbox)) { dialog -x toolbox toolbox }
    if ($dialog(textopt)) { dialog -x textopt textopt }
    .timercheck off
  }
}
menu @paint {
  sclick { 
    if ($did(toolbox,9).state) { set %xy  1 }
    elseif ($did(toolbox,10).state) { set %xypen 1 }
    elseif ($did(toolbox,8).state) { drawfill @paint $iif($numcheck($right($did(toolbox,1).seltext,3)),$+($right($did(toolbox,1).seltext,3),$right($did(toolbox,1).seltext,2)),$right($did(toolbox,1).seltext,2)) 1 300 245 }
    elseif ($did(toolbox,7).state) { 
      if (%m1 == 1) {  set %x1 $mouse.x $mouse.y | drawline @paint $iif($numcheck($right($did(toolbox,1).seltext,3)),$+($right($did(toolbox,1).seltext,3),$right($did(toolbox,1).seltext,2)),$right($did(toolbox,1).seltext,2)) $did(toolbox,4) %y1 %x1 }
      else  { set %y1  $mouse.x $mouse.y  | set %m1 1 }
    }
    elseif ($did(toolbox,18).state) {
      if (%m2 == 1) {  set %x2 $mouse.x $mouse.y | drawline @paint $iif($numcheck($right($did(toolbox,1).seltext,3)),$+($right($did(toolbox,1).seltext,3),$right($did(toolbox,1).seltext,2)),$right($did(toolbox,1).seltext,2)) $did(toolbox,4) %y2 %x2 | unset %x2 | unset %y2 | unset %m2  }
      else  { set %y2  $mouse.x $mouse.y  | set %m2 1 }
    }
    elseif ($did(toolbox,19).state) {
      if (%m3 == 1) {  set %x3 $mouse.x $mouse.y | drawline @paint $iif($numcheck($right($did(toolbox,1).seltext,3)),$+($right($did(toolbox,1).seltext,3),$right($did(toolbox,1).seltext,2)),$right($did(toolbox,1).seltext,2)) $did(toolbox,4) %y3 %x3 | set %x3 %y3 | set %y3 $mouse.x $mouse.y   }
      else  { set %y3  $mouse.x $mouse.y  | set %m3 1 }
    }
    elseif ($did(toolbox,17).state) { 
      drawtext @paint $iif($numcheck($right($did(textopt,7).seltext,3)),$+($right($did(textopt,7).seltext,3),$right($did(textopt,7).seltext,2)),$right($did(textopt,7).seltext,2)) $did(textopt,3) $did(textopt,6) $mouse.x $mouse.y $did(textopt,1)
    }
  }
  mouse {
    if (%xy) {
      drawdot @paint $iif($numcheck($right($did(toolbox,1).seltext,3)),$+($right($did(toolbox,1).seltext,3),$right($did(toolbox,1).seltext,2)),$right($did(toolbox,1).seltext,2)) $did(toolbox,4) $mouse.x $mouse.y
    } 
    elseif (%xypen) { 
      drawdot @paint 1 2 $mouse.x $mouse.y
    }
    else { unset %xy* }
  }
  drop { unset %xy* }
}
menu menubar {
  mIRC Paint:/paint
}

Comments

Sign in to comment.
sean   -  Apr 16, 2006

you can always select the color and draw over, pretty close to erasing

 Respond  
LIQUID_NiTrO   -  Apr 15, 2006

Great work Gex.

 Respond  
ch1zra   -  Mar 20, 2006

maybe a Undo option ?
btw, I apsolutely like this..
respect :]

 Respond  
globus   -  Mar 17, 2006

cool :)))

 Respond  
sean   -  Mar 15, 2006

absolutly sick :)
nice work

 Respond  
Ace99   -  Mar 09, 2006

Good job, Gex. :D

 Respond  
Gex   -  Mar 08, 2006

thanks for the bug discovery ;) and working on the erase :)

 Respond  
xDaeMoN   -  Mar 08, 2006

Nice. Some suggestions & bugs:

  1. when you rotate a few times, the picture becomes pixelated.
  2. Add an erase feature
 Respond  
Gex   -  Mar 08, 2006

yes but it wont be so nice since u cant choose your rect/elipse size visually thats y ive excluded /drawrect .

 Respond  
QuickStep   -  Mar 08, 2006

you spend quite some work on this, but its quite easy to also implement drawing squares (drawrect) and elipses (drawrect -e)

 Respond  
Gex   -  Mar 08, 2006

Thanks ;)

 Respond  
Jared   -  Mar 08, 2006

With caps: COOL!

 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.