Jump to content

BoltBait

Administrator
  • Posts

    15,730
  • Joined

  • Last visited

  • Days Won

    405

Everything posted by BoltBait

  1. On the File > New (Templates) screen, you can now choose a looping style of "None". This will generate a script like this: // Name: GDI+ Example // Author: BoltBait #region UICode #endregion // Working surface Surface wrk = null; // Setup for using Normal blend op private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal); protected override void OnDispose(bool disposing) { // Release any surfaces or effects you've created. if (wrk != null) wrk.Dispose(); wrk = null; base.OnDispose(disposing); } void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } wrk.Clear(ColorBgra.Transparent); } // Here is the main render loop function void Render(Surface dst, Surface src, Rectangle rect) { using (Graphics g = new RenderArgs(wrk).Graphics) using (Region gClipRegion = new Region(rect)) using (Pen pen = new Pen(ColorBgra.Black, 1)) using (GraphicsPath path = new GraphicsPath()) using (SolidBrush brush = new SolidBrush(ColorBgra.Black)) using (Font font = new Font("Arial", 12)) { g.Clip = gClipRegion; g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.AntiAlias; pen.LineJoin = LineJoin.Round; // add additional GDI+ commands here } normalOp.Apply(dst, src, wrk, rect); } Notice that there are no loops in the Render method. In the Render method, CodeLab generates several "using" blocks. Just delete the ones you won't be using yourself. You'll probably want to modify the remaining "using" statements with user controls to make the various colors and sizes adjustable in your plugin. Finally, you can add additional GDI+ commands to render text, lines, and shapes to the wrk canvas which will then be combined with the source canvas to create your result.
  2. Here is a CodeLab script for using the new FilenameControl: // Name: Fill from file // Author: BoltBait #region UICode FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp #endregion Surface wrk = null; protected override void OnDispose(bool disposing) { if (wrk != null) wrk.Dispose(); wrk = null; base.OnDispose(disposing); } void PreRender(Surface dst, Surface src) { if (wrk == null) { wrk = new Surface(src.Size); } try { // Use your FilenameControl to load an image for use wrk = Surface.CopyFromBitmap((Bitmap)Bitmap.FromFile(Amount1)); } catch { wrk.Clear(ColorBgra.Transparent); } } void Render(Surface dst, Surface src, Rectangle rect) { for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = wrk.GetBilinearSampleWrapped(x,y); dst[x,y] = CurrentPixel; } } } Notice in the definition of the control, in the comment we have the title of the control followed by the file types allowed: FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp So, in this example, the prompt will be "Open Image" and the allowed file types will be .jpg, .png, .gif, and .bmp. For tinkering inside of CodeLab, between the quotes you can place a path to a file. (Notice that the @ sign before the first quote allows you to use the backslash character "\" without escaping it (doubling them).
  3. This will be officially released when Rick releases Paint.NET v4.1. CodeLab v4.0 Beta*: <snip> Beta 3 build Requires: Paint.NET v4.1+ New Features: Editor has tabs (toe_head2001) Colorwheel control now has Alpha style option (BoltBait) Filename control (BoltBait) Generate VS Project function on Build screen (toe_head2001) File > New templates have a new "Non Looping" style for all of your GDI+ work (BoltBait) Separate Save and Save As functions (toe_head2001) The autocomplete function now does matching initials (as described below) (toe_head2001) Minor bug fixes (toe_head2001 and BoltBait) New Features in the Second Beta: Indicator Map (Ctrl+M) now integrated with scroll bar (toe_head2001) Colorwheel control reset button can now be hidden (BoltBait) Building to DLL now saves to Desktop in a ZIP file all ready for posting to the forum (BoltBait) Install.BAT files now work for both the Classic install and the Store version of Paint.NET (BoltBait) Generate VS Solution function now has an updated Post Build Event script (BoltBait) New Features in the Third Beta: Fixed bug in smallest colorwheel (found by @xod) (BoltBait) Now, before anyone says anything... when running CodeLab it may prompt you to download v3.5. This is normal! Just ignore it. That error message won't be there once the official release happens. Check out this new UI feature, tabs: How to access the new Colorwheel with Alpha: How to generate a script for using GDI+ commands: *This download has been deleted as the official version has been released.
  4. This is probably what happened: You opened your PDN drawing. You hit File > Save As... You changed the name into a JPG file and hit the OK button. Now you have a problem. The problem here is that you didn't change the "Save as type" to match the filename. So, basically, you have a filename ending in .JPG that has a file in it in the PDN format.
  5. Paint.NET contacts getpaint.net to see if there is a new version available. It doesn't do this every time... just once a week (or 2 weeks, I forget). Anyway, getpaint.net is probably on the same server as the blog you circled. I'm really not sure why you'd get a report about that blog as it has nothing to do with paint.net.
  6. Right, because she is showing you how to use a plugin. https://forums.getpaint.net/topic/112400-kill-color-keeper-v-12/ You can download the plugin here:
  7. When saving as png, make sure to choose a "bit depth" of "auto detect".
  8. We generally don't delete posts here. If someone else has your same question, they might find it instead of asking the same question again. Just ignore them. I'm sure you could poke around and find some really embarrassing posts from me when I started. I just pretend they don't exist. Now, if there is a real problem, just report the post and a mod will take care of it.
  9. This is a problem with Windows Store. You should contact their customer support.
  10. File > Save As... Select PNG in the "save as type" box.
  11. I followed this tutorial and had good results. It is an interesting method. @KidBrine, clean this up with proper screenshots.
  12. Paint.NET is a pixel editor, not a word processor. Once you finalize text, it becomes pixels.
  13. Read this: https://www.getpaint.net/doc/latest/InstallPlugins.html (second yellow box)
  14. I heard a rumor that the next release of Paint.NET will include this functionality.
  15. If you have discord, you need to get rid of it.
  16. Please follow step 8: https://forums.getpaint.net/topic/110411-common-install-uninstall-crash-problems-and-solutions/
  17. No! Don't do that! I don't mind you guys building on what I post. Just be warned, when I put this into my plugin pack, it will be the version I posted.
  18. Man, pretty soon the UI will need a scroll bar... You all know how I feel about long UI's... (But, I can't control what you do with the source code I post.)
  19. There's your problem right there. Stop that! Paint.NET is designed only to run from the folder where you install it.
×
×
  • Create New...