Jump to content

ArgusMagnus

Members
  • Posts

    69
  • Joined

  • Last visited

Posts posted by ArgusMagnus

  1. Thanks for the clarification Rick.

     

    As I said, I have a working solution (without using PdnClipboard ;) )

     

    Regarding the use of "random things you find lying around in Core.dll": I find it hard to tell what is supposed to be used by plugin developers and what not, since nothing is really documented anywhere (I understand that, writing a useful documentation is time consuming), I learned most things from looking at other plugins' code and VS' Intellisense and Object Browser. For instance it is clear, that the ColorBgra structure is supposed to be used, but what about RgbColor, RgbColorF, HsvColor, HsvColorF? Maybe adding something like the following to each class/struct which is supposed to be used may be an option?

    /// <summary>
    /// Public API
    /// </summary>
    public struct ColorBgra { ... }
  2. yeah, the shared dll was also updated and contains new types/methods (e.g. ArgusColor)

     

    You are right, from a user standpoint, two assemblies are not ideal.. However, I hate it (I almost can't stand it) if I have duplicate code.. But I will rethink the design non the less

  3. Mod note:  This Plugin is no longer compatible with newer versions of Paint.net :( 

     

    You can download all my plugins from here: https://1drv.ms/f/s!AoTkGO_MFp9CoOlMDloruoTbePt2Dw

    (If you are worried about downloading *.dll files, download the whole folder and OneDrive will zip the files up for you)

     

    Effects->Colors->Unblend

    Remove a background Color from your selection to make it (semi-)transparent

     

    Effects->Transforms->Fast Fourier Transform

    Effects->Signal Processing->High/Low/Band Pass Filter

     

    Effects->Stylize->Edge Detect+

    Recolor the edges in your selection and make the rest transparent

     

    Effects->Render->Barcode

    Render various barcode formats (e.g. QR-Codes)

     

    FileTypes->App Icon Set

    Saves an image scaled to various resolutions in a structure inside a zip file suitable to be used for app (Android/iOS) development

    • Like 1
    • Upvote 2
  4. Thanks! I knew that MS Office used "PNG" but it didn't occur to me that Paint.net might be as well.
     
    I have put together a helper method which takes care of various possibilites to get an image from the clipboard, these are part of the Utils class in my ArgusPaintNet.Shared.dll:

    public static Image GetImageFromClipboard()
    {
    if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
    return Utils.GetImageFromClipboardCore();
    Image image = null;
    Thread thread = new Thread(() => { image = Utils.GetImageFromClipboardCore(); });
    thread.SetApartmentState(ApartmentState.STA);
    thread.Start();
    thread.Join();
    return image;
    }
    
    static Image GetImageFromClipboardCore()
    {
    using (MemoryStream ms = Clipboard.GetData("PNG") as MemoryStream)
    {
    if (ms != null)
    {
    try { return Image.FromStream(ms); }
    catch { }
    }
    }
    StringCollection paths = Clipboard.GetFileDropList();
    if (paths != null && paths.Count > 0)
    {
    foreach (string file in paths)
    {
    try { return Image.FromFile(file); }
    catch { }
    }
    }
    byte[] data;
    using (MemoryStream ms = Clipboard.GetData(DataFormats.Dib) as MemoryStream)
    {
    if (ms == null)
    {
    return Clipboard.GetImage();
    }
    data = ms.ToArray();
    }
    int width = BitConverter.ToInt32(data, 4);
    int stride = width * 4;
    int height = BitConverter.ToInt32(data, 8);
    int bpp = BitConverter.ToInt16(data, 14);
    if (bpp != 32)
    return Clipboard.GetImage();
    GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
    try
    {
    IntPtr ptr = new IntPtr((long)handle.AddrOfPinnedObject() + 40);
    return new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppArgb, ptr);
    }
    catch
    {
    return Clipboard.GetImage();
    }
    finally
    {
    handle.Free();
    }
    }

     

     

  5. I've read in an old thread (can't remeber which one) that starting with version 4.0 Paint.net will support copying/pasting images which contain transparency.

    1. Is this correct?

    2. Is the facility which achieves this available for plugin authors? If yes, how?

    3. Somewhat related: What is the difference between using the classes PaintDotNet.PdnClipboard and System.Windows.Forms.Clipboard?

     

  6. Small Update: I changed the range of the threshold values and improved cancelling behaviour.

     

    I'm not sure this is the optimum yet. The problem is, that the range which makes sense really depends on the image. For an image with hard edges (black on white), one would want a large range, possibly with a maximum even above 1. For images with softer edges (photographes, realistic drawings, etc.) chosen values will likely be below 0.2 or even 0.1. Of course these values can be chosen even if the range is [0,1] but its less confortable if you have a slider going from 0 to 1 but you are only interested in values between 0 and 0.1.

     

    So if you think, I should allow another range for the sliders, tell me :)

     

     

    @racerx: The assemblies are not zipped up, because... well... essentially because it's easier for me (I would need to have multiple zip files of which most would contain the ArgusPaintNet.Shared.dll file, so I would need to update every zip if I updated the shared dll and wanted all zips to contain the newest version). But if you select multiple files or download the whole folder, OneDrive will zip it up for you ;)

  7. Effect->Stylize->Edge Detect+

    Download: https://forums.getpaint.net/topic/32337-argusmagnus-plugin-pack-20181019/

    (Copy the file ArgusPDN.EdgeDetect.dll to the paint.net/Effects folder)

     

    This effect uses an edge detection algorithm. It draws edges with given colors and sets the other pixels to transparent.

     

    I haven't had any good idea for the name, so I called it Edge Detection for now, the (Argus) is simply to make it better distinguishable from the built in Edge Detect effect. If anyone has an idea for a better name, feel free to share it ?

     

    UI Explanation (See example below):

    Lower Threshold: All pixels with values (Structur Tensor Eigenvalues) below this threshold are fully transparent: Higher Threshold --> Less Edges detected

    Upper Threshold: All pixels with values above this threshold are fully opaque. The range of "good" values really depends on the image. For hard edges (extreme case: black line on white), "good" values may go up to 1, for softer edges (as typically found in photographes), "good" values will usually be below 0.2

    Color/Color2/Angle/Hue Direction: Edges with a normal angle the same as the chosen Angle are drawn in the color set in Color, edges with a normal angle perpendicular to Angle are drawn in the color set in Color2, in between the color is interpolated between Color and Color2. Hue Direction determines how the Hue value is interpolated.

    Difference Filter: The Kernel used to get the image derivates in x and y direction. I have yet to encounter a situation where I needed to change this value. If you change this value, a lot of calculations have to be redone. Some time may pass before you see something happening.

    Smoothing Radius: As expected, smoothes the output.

     

    Performance:

    Calculating initial values (Structur Tensors) may take some time, therefore, depending on the selection size, it may take some time after the effect dialog pops up before you can see something happening. If you change the value "Difference Filter" these calculations have to be redone.

    Smoothing is also somewhat expensive, which you can see if you change the smoothing radius.

    Intermediate values (Structur Tensors, eigenvalues of smoothed Tensors) are held in memory so re-rendering the output for different Threshold/Color/Angle values is fast. The cost for that is memory usage: Roughly 24 bytes per Pixel are used (excluding the memory used for the source and destination surface).

     

    EdgeDetectionBuilding_zpshxclspuu.png

     

    EdgeDetectionFowers_zps9uvmmzzh.png

    • Like 1
    • Upvote 8
  8. I'm guessing the answer is no, since this seems to be closed source, but I'll aks anyway:

    If you provided me with the source (indirect question), would I be allowed to make the changes myself and publish the modified version?

    I don't now when, but I will be needing the mentioned functionality sometimes in the future as part of another plugin Im planning

  9. @Ego: When did you upgrade? Some things (e.g. Sound or Network Drivers) worked fine at first and then suddenly stopped working after a week or so (maybe Windows Update "updated" the drivers), this has happend to a good part of the people I know which have upgraded yet

     

     

    Don't get me wrong, I'm a Windows fan, I've used and liked their products for years and I'm not planning to turn my back on them, but this Upgrade feels premature.

  10. Download: https://onedrive.live.com/redir?resid=429F16CCEF18E484!339757&authkey=!AJ0aYSIXTh_4Jhs&ithint=folder%2Ctxt

    (Copy the files "ArgusPaintNet.Convolution.dll" and "ArgusPaintNetShared.dll". to the "paint.net/Effects" folder)

     

    Effect->Advanced->Convolution

     

    Applies a Convolution Kernel (https://en.wikipedia.org/wiki/Kernel_(image_processing)) to the image.

     

     

    I don't know if Advanced is the right sub-menu. Depending on the kernel this effect would belong to the Blur or Stylize or possible other sub-menus.

     

    Convolution1_zps9xkwlkej.png

     

    v1.1

    - Current Settings can be added to Presets

    - Presets are saved and loaded to a file and survive restart

    - Presets can be saved to and loaded from user-defined files

    - Added reference to ArgusPaintNet.Shared.dll

    - Fixed Bug: Previously unclamped values were converted to bytes -> strange color patterns

     

    v1.0

    - Initial Release

    • Upvote 2
  11. After some initial trouble (I had to reinstall a lot of drivers) Windows 10 works. But in my opinion in its current state it is clearly inferior to Windows 8 (which I liked and worked for me, once I accustomed to the new look).

     

    The only thing better in Windows 10 than in 8 that I can think of right now is that the OneDrive app finally allows to sync shared folders.

     

    In contrast, they removed features which I liked and miss now for example syncing of settings (e.g. Start Screen, Favorites in Edge, Mail Settings, etc.) was almost completely removed which is a shame and a pain when using multiple devices.

    I'm not using too many apps, but the ones I use (Mail, sometimes Edge) seem unfinished, beta at best and lack essential features like Drag'n'Drop support. The Edge browser is one big disappointment. It could have been great but it isn't. As mentioned before, it doesn't sync favorites, doesn't support Drag'n'Drop and no one knows when the promised Extension Support will arrive. Password-saving and auto-fill works sometimes, sometimes not.

  12. I was planning on writing a very similar if not identical plugin, luckily I've discovered in time that this has existed for years before I started with my own implementation.

     

    I'm wondering, is this still actively maintained and would you be open for one or two suggestions? I admint, I haven't read through all 14 pages, to see if they were already posted, in that case, I apologize.

     

    1. I think it would be great I we had the option to set a default file/folder to which the scripts could be saved with a simple click without opening a SaveFileDialog and a third column in the UI where the scripts from the default folder would be displayed and could be loaded with a simple double click or something without the need for a OpenFileDialog. Of course, a button/menu entry to export/save to and load from to save and load to/from a location supplied by a file dialog (as it is now) should still be present.

     

    2. When adding/modifying an effect, a preview would be great.

     

    (3. This would require some work I think and I'm not sure if the usefulness would be worth the cost (development time): The Option to save a script to the effects menu (via dynamic assembly generation). And as the saved script would only show up in the menus after restarting paint.net, this could be irritating to users. (And adding it to the menu right away is not allowed))

     

    edit: I actually forgot my most important suggestion: An option make a property value of numeric types relative to image properties such as width or height. Example of what I mean:

    If I add an effect to a script while an image with the dimension 1000x1000 was open and choose the value for some integer property to be 10 and also select the proposed option to make this property to be relative to the image with, then this integer properties actual value would be set to 20 if the script is run on a different image of size 2000x2000.

  13. Sorry for the off-topic, but I have to warn you:

    Check first if windows 10 doesn't cause troubles for your model before upgrading. Anyone I know who upgraded had to re-install a good part of the drivers, on one PC windows 10 caused a blue screen every 10-20 seconds and we had to downgrade to windows 8 to make it useable again. It is probably better to wait for the first service pack before upgrading.

    Often the behaviour is strange and the problems (sound or networking no longer working, bluescreens) only start a few days after the upgrade and not straight away.

×
×
  • Create New...