Jump to content

BoltBait

Administrator
  • Posts

    15,728
  • Joined

  • Last visited

  • Days Won

    405

Everything posted by BoltBait

  1. http://msdn.microsoft.com/vstudio/express/visualcsharp/
  2. Ink Sketch Effect This effect will turn the photograph of my daughter (on the left) into the ink sketch (on the right): The user interface is adjustable: The Idea I thought that it would be easy to automate the steps that I had come up with for turning a picture into an ink sketch. It turned out that it wasn't too hard. Rick Brewster was nice enough to send me the source code to the Pencil Sketch effect from Paint.NET 3.05. From that, I learned how to combine preexisting effects and blending operations. I'm still learning how to create complex effect filters for Paint.NET. I think this is one of my best yet. The Effect DLL NOTE: This effect is now included in Paint.NET. If you have upgraded to Paint.NET 3.10 or greater, you do not need to download this effect... you already have it! Source Code MadJik since you asked how to write composition type effects... I thought I'd post this PM conversation between me and Rick. He gives some good information in there: Well, in its current state, Rick was right. I thought about it for some time and I simplified the steps to the point that it was possible. And, I did it without needing to create additional layers. Here are the simplified steps that my code simulates: Open an image Duplicate the layer Effects > Glow the bottom layer with radius 6 (default) and both other sliders tied together based on my Coloring slider Run the Toon effect on the top layer On the top layer, Adjustments > Black and White Then, Adjustments > Brightness / Contrast... set the contrast to 100% and adjust the brightness based on my Ink Outline slider Change the blending mode of the top layer to Darken And, here is the code (NOTE: This is now a CodeLab script): /* InkSketchEffect.cs Copyright (c) 2007 David Issel Contact info: BoltBait@hotmail.com http://www.BoltBait.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // Name: Ink Sketch // Submenu: Artistic // Author: BoltBait // Title: BoltBait's Ink Sketch Effect v1.0 // Desc: Convert your photo into an ink sketch. // Keywords: Ink|Sketch // URL: http://BoltBait.com/pdn #region UICode IntSliderControl Amount1=50; // [0,100,4] Ink Outline IntSliderControl Amount2=50; // [0,100,3] Coloring #endregion // Setup for using pixel op private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate(); // Setup for using Darken blend op private BinaryPixelOp darkenOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Darken); private byte Clamp2Byte(int iValue) { if (iValue<0) return 0; if (iValue>255) return 255; return (byte)iValue; } unsafe void Render(Surface dst, Surface src, Rectangle rect) { const int size = 5; int[,] conv = new int[size, size] { {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, 30, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -5, -1, -1}, }; int radius = (size-1)/2; RenderArgs dstArgs = new RenderArgs(dst); RenderArgs srcArgs = new RenderArgs(src); // Render colored pencil effect GlowEffect glowEffect = new GlowEffect(); PropertyCollection glowProps = glowEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken glowParameters = new PropertyBasedEffectConfigToken(glowProps); glowParameters.SetPropertyValue(GlowEffect.PropertyNames.Radius, 6); glowParameters.SetPropertyValue(GlowEffect.PropertyNames.Brightness, -(Amount2-50)*2); glowParameters.SetPropertyValue(GlowEffect.PropertyNames.Contrast, -(Amount2-50)*2); glowEffect.SetRenderInfo(glowParameters, dstArgs, srcArgs); glowEffect.Render(new Rectangle[1] {rect},0,1); // Now in the main render loop, the dst canvas has an glowed version of the src canvas for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; int top = y - radius, bottom = y + radius; if (top < 0) top = 0; if (bottom >= dstArgs.Height) bottom = dstArgs.Height - 1; ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y); ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y); for (int x = rect.Left; x < rect.Right; x++) { // Calculate the Ink Outline int left = x - radius, right = x + radius; int c = 0, s = 0, r = 0, g = 0, b = 0; if (left < 0) left = 0; if (right >= dstArgs.Width) right = dstArgs.Width - 1; for (int v = top; v <= bottom; v++) { ColorBgra* pRow = srcArgs.Surface.GetRowAddressUnchecked(v); int j = v - y + radius; for (int u = left; u <= right; u++) { int i1 = u - x + radius; int w = conv[i1, j]; ColorBgra* pRef = pRow + u; r += pRef->R * w; g += pRef->G * w; b += pRef->B * w; s += w; c++; } } ColorBgra TopLayer = ColorBgra.FromBgr(Clamp2Byte(b),Clamp2Byte(g),Clamp2Byte(r)); // Adjust Brightness and Contrast of the Ink Sketch TopLayer = desaturateOp.Apply(TopLayer); if (TopLayer.R > (Amount1 * 255 / 100)) { TopLayer = ColorBgra.White; } else { TopLayer = ColorBgra.Black; } // Mix the Ink Sketch with the Colored Pencil effect *dstPtr = darkenOp.Apply(*dstPtr, TopLayer); srcPtr++; dstPtr++; } } } Now, I can't wait to see what MadJik creates from this...
  3. Unless this loads it manually, it wouldn't have an effect. Rick made PdN so that all calls to PdnLib.dll are rerouted to core.dll automatically.
  4. Heh. You don't know how interesting this thread is to me.
  5. My web page editor of choice is: Notepad++ If that is not available, then Notepad.
  6. If you want to do screen captures, I highly recommend the PrtScn key. PrtScn captures the entire screen Alt-PrtScn captures the current window Once you capture the screen, go to Paint.Net and press Ctrl-Alt-V.
  7. It did this on me today but only for a few moments. I think it was checking the web for updates when I clicked on a control. Everything went white for a few moments then came back. I also had something interesting happen yesterday. I had right-clicked on a picture in explorer and said, open with Paint.NET. The picture never did open because there was a timing issue with paint.net checking for updates. It prompted me to update before the picture showed up. I clicked cancel and the picture never did show. I was left with no canvas open at all. I was running 3.01. I couldn't get that one to reproduce.
  8. You either need to create a bunch of pictures... or use a program that creates a bunch of pictures for you--like a morphing program.
  9. Read this thread: http://paintdotnet.12.forumer.com/viewtopic.php?t=3415
  10. Try using the BACKSPACE key instead of the paint bucket. This is the same as using the paint bucket at 100% tollerance and it fills the selection with the primary color.
  11. CMD did the new layout. I did the old layout. You can see the new layout on the home page: http://www.BoltBait.com You can see what the old layout used to look like by looking at any of the content pages: http://www.BoltBait.com/dominoes I plan (when I find some time) to make all the content pages look like the main page. Then, I will add additional content pages.
  12. That opens up all kinds of possibilities for rendering types of effects. BTW, my post average is only 2/day.
  13. If a crash.log is generated, it is stored on your desktop.
  14. I'm just hoping one of them passes me up for "Biggest Troll" of this forum. 8) On topic: MadJik, nice job (as always)!
  15. A good place to start is here: http://paintdotnet.12.forumer.com/viewtopic.php?t=1096 Be sure to read the entire thread. Then, go to the plugin forum and look at the source code for the plugins that other people have developed. Once you have tried to create your own plugin, post any questions you might have and I'm sure one of the plugin developers on this forum will help you. Finally, when you are ready to move up from codelab, read this: http://paintdotnet.12.forumer.com/viewtopic.php?t=2618
  16. Don't tell me you're having problems too... (He probably means Effects menu.)
  17. Your sig is ginormous! Please make it smaller. Please read rule #13 here: http://paintdotnet.12.forumer.com/viewtopic.php?t=3446
  18. Yes. Obviously, I have a lot of work to do...
  19. This is alread listed in this thread: http://paintdotnet.12.forumer.com/viewtopic.php?t=3455 as a "Smudge Tool".
  20. Oh, don't be too sure. I actually have two thumbs in my collection as well. However, I won't share them with you... I'm rather attached to them.
  21. Thank you. That was my original goal. (That, along with being easy to update.) What was I saying about IE7... Since the main column is iced, save your icons as jpg's with the same gray body color as a background. Nobody will ever know... Seriously, I tried that and no matter what color I picked, you could tell. Besides, it looks fine in FF and IE7 (everyone uses the latest version, right?)
  22. OK, if you want to see it... I updated the main page http://www.BoltBait.com with CMD's layout. Now comes the task of updating all the other pages. (Ugh, lots of work)
×
×
  • Create New...