Jump to content

i want to create a negative filter of any image..

- - - - -

  • Please log in to reply
No replies to this topic

#1
maifs

maifs

    Newbie

  • Members
  • Pip
  • 6 posts
i want to create a negative filter of any image..

i am trying this...


public void Negative()

{

Bitmap copy=new Bitmap(m.Width,m.Height);

ImageAttributes ia = new ImageAttributes();


ColorMatrix cm = new ColorMatrix();

cm.Matrix00 = cm.Matrix11 = cm.Matrix22 = 0.99f;

cm.Matrix33 = cm.Matrix44 = 1;

cm.Matrix40 = cm.Matrix41 = cm.Matrix42 = .04f;

ia.SetColorMatrix(cm);

Graphics g=Graphics.FromImage(copy);

g.DrawImage(m,new Rectangle(0, 0,m.Width, m.Height), 0, 0, m.Width, m.Height, GraphicsUnit.Pixel, ia);

g.Dispose();

m.Dispose();


}
but here is some error occur in this.......

error is:
Error 2 Argument '2': cannot convert from 'I_M_Editor.Rectangle' to 'System.Drawing.Rectangle' D:\dot.net.programs.using.c#\0eh066\I'M Editor\I'M Editor\frmEditable.cs 688 15 I'M Editor

and
Error 1 The best overloaded method match for 'System.Drawing.Graphics.DrawImage(System.Drawing.Image, System.Drawing.Rectangle, float, float, float, float, System.Drawing.GraphicsUnit, System.Drawing.Imaging.ImageAttributes)' has some invalid arguments D:\dot.net.programs.using.c#\0eh066\I'M Editor\I'M Editor\frmEditable.cs 688 1 I'M Editor

Edited by WingedPanther, 30 September 2008 - 07:47 AM.
add code tags





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users