APShredder Posted November 3, 2009 Share Posted November 3, 2009 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. BlendMode Plus Source Quote BlendModes Plus | Dissolve | Extract Color Link to comment Share on other sites More sharing options...
Simon Brown Posted November 3, 2009 Share Posted November 3, 2009 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? Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted November 3, 2009 Share Posted November 3, 2009 My suggestion is to create a separate control for the image being used (containing a picturebox) and have buttons to copy either the clipboard or a file into it. Hope this helps. Quote Link to comment Share on other sites More sharing options...
APShredder Posted November 3, 2009 Author Share Posted November 3, 2009 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? Quote BlendModes Plus | Dissolve | Extract Color Link to comment Share on other sites More sharing options...
Simon Brown Posted November 3, 2009 Share Posted November 3, 2009 To fix the "unassigned" build error (or at least some of them), give variables that you only assign in parenthesis a default value. Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted November 3, 2009 Share Posted November 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
APShredder Posted November 3, 2009 Author Share Posted November 3, 2009 Do you mean curly brackets, because I'm pretty sure I don't have any variables assign in parenthesis. EDIT: Oh, and thanks for explaining about the clipboard thing. I get what you're saying now. Quote BlendModes Plus | Dissolve | Extract Color Link to comment Share on other sites More sharing options...
Simon Brown Posted November 3, 2009 Share Posted November 3, 2009 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). Quote Link to comment Share on other sites More sharing options...
APShredder Posted November 3, 2009 Author Share Posted November 3, 2009 Thanks Simon, that got rid of all the errors. Now all I have to do is take care of the clipboard thing, which i think I can take care of myself. Once again, thanks for your help. Quote BlendModes Plus | Dissolve | Extract Color Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.