Jump to content

Unassigned Local Variable Error


Recommended Posts

I am trying to add a feature to my BlendModes Plus plugin that would allow the user to copy a picture overfrom the clipboard. The only problem is when try to build the plugin I get errors the say "Use of unassigned local variable" and Use of possibly unassigned field". I can't get rid of them and I'm going crazy trying. Help would be greatly appreciated, and the source is attached below. Thanks in advance. :D

BlendMode Plus Source

Link to comment
Share on other sites

What line number is it giving you?

Also, are you sure a RadioButton is the best choice? If the user checks it and the clipboard contents change, it appears as if BMP is using the clipboard when it is no longer dependent on it.

Edit: ...or IMO shouldn't be.

Why are you reading the clipboard in a method that is called constantly by Paint.NET?

KaHuc.png
Link to comment
Share on other sites

I'm getting errors at lines: 38, 114, 120, 121, 122, 123, 148, 149, 150, 368, 419, and 421.

And about the radio button, I see what you're saying and I'm kind of balancing the pros and cons of changing it right now, so I'll see what I'll do about it in a little bit. Oh, and thanks for your help. :)

EDIT: I'm not sure what you mean about constantly calling the clipboard method. Could you explain? Is there a better way to do it?

Link to comment
Share on other sites

EDIT: I'm not sure what you mean about constantly calling the clipboard method. Could you explain? Is there a better way to do it?

A tradeoff would be to copy the contents into a global variable in OnSetRenderInfo(), although I urge you to avoid being dependent on the clipboard, such as by having the clipboard as just one way of importing the image into the token (from the dialog) without dependencies.

KaHuc.png
Link to comment
Share on other sites

                       if (token.FromClipboard == true && token.SwapLayers == false)

                       {

                           CP = srcArgs.Surface[x, y];

                           LCP = Surface.CopyFromBitmap(ClipboardImage)[x,y];

                           CPHSV = HsvColor.FromColor(Color.FromArgb(CP.A, CP.R, CP.G, CP.);

                           LCPHSV = HsvColor.FromColor(Color.FromArgb(LCP.A, LCP.R, LCP.G, LCP.);

                       }

...but there's no value set outside of the brackets (in case the contents aren't run - one set will be but the compiler doesn't know that).

KaHuc.png
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...