Jump to content

toe_head2001

Administrator
  • Posts

    5,029
  • Joined

  • Last visited

  • Days Won

    155

Posts posted by toe_head2001

  1. 12 minutes ago, NealEhardt said:

    Those users will get owned.

    Could get owned. Murphy's Law is not really a natural law.

     

    20 minutes ago, NealEhardt said:

    This is regarding dotpdn.com.

    It's not just the dotpdn.com domain. When paint.net (the program) checks for updates, it's communicating with the getpaint.net domain. If there is an update, it will then download it from dotpdn.com.

     

     

    At least for forum has encryption now (as of a few days ago).

     

  2. 19 minutes ago, NomBot said:

    1. user enters settings in UI.

    2. this is saved to a file.

    3. plugin reads the file.

    4. plugin alters UI based on the file.(persistent save of UI option)

     

    I have no idea why you'd do that, it can be done in WinForms for sure.

     

    If you need an example of the XmlSerializer in action, you can take a look at my Tartan plugin. Here's the two commits that added the XmlSerializer import/export functionality.

     

    26 minutes ago, NomBot said:

    also looked at optionbased, but can it get around the problem? and is there any doc for this other than play it by ear? :/

    I'm not sure it could be done with OptionBasedEffects. Maybe it can. There really isn't any documentation for it.

    I used it for my Graph Paper plugin, and I just figured out what I needed to as I went along.

  3. 1 hour ago, NomBot said:

    ... then alter the UI based on that.

    What all are you wanting to change? Just setting the values (or other properties) of different controls?

     

    The XmlSerializer in .NET makes this very easy. It automatically generates a properly structured XML file based on your code, making the importing and exporting of plugin settings (values) nearly effortless. Or it could be used for loading presets into a plugin.

     

    Is that what you're looking for?

     

    1 hour ago, NomBot said:

    Any tips on doing this while avoiding indirect UI?

    If want to avoid using WinForms, you could try OptionBasedEffects. It gives you a good balance of the customization of WinForms and the abstraction of IndirectUI.

  4. There you go... an option to make the cells opaque. Alpha values above the Tolerance level will become fully opaque, and values below the Tolerance level will become fully transparent.

    Checkbox must be enabled/true.

     

    Spoiler
    
    // Name: Cell Board
    // Submenu: Stylize
    // Author: toe_head2001
    // Title:
    // Version: 0.2
    // Desc:
    // Keywords:
    // URL:
    // Help:
    #region UICode
    IntSliderControl Amount1 = 10; // [0,100] Cell Size
    IntSliderControl Amount2 = 1; // [0,100] Cell Spacing
    CheckboxControl Amount3 = false; // [0,1] Make cells opaque
    IntSliderControl Amount4 = 127; // [1,255] Cell Opacity Tolerance
    #endregion
    
    void Render(Surface dst, Surface src, Rectangle rect)
    {
        int cellSize = Amount1 + Amount2;
        PixelateEffect pixelateEffect = new PixelateEffect();
        PropertyCollection pixelateProps = pixelateEffect.CreatePropertyCollection();
        PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps);
        pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellSize);
        pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src));
        pixelateEffect.Render(new Rectangle[1] { rect }, 0, 1);
    
        ColorBgra CurrentPixel;
        for (int y = rect.Top; y < rect.Bottom; y++)
        {
            if (IsCancelRequested) return;
            for (int x = rect.Left; x < rect.Right; x++)
            {
                CurrentPixel = dst[x, y];
    
                if (Amount3)
                {
                    if (CurrentPixel.A >= Amount4)
                        CurrentPixel.A = 255;
                    else
                        CurrentPixel.A = 0;
                }
    
                if (x % cellSize < Amount2 || y % cellSize < Amount2)
                    CurrentPixel.A = 0;
    
                dst[x, y] = CurrentPixel;
            }
        }
    }

     

     

    • Upvote 1
  5. You need to update your copy of CodeLab to the latest.  v2.17 was the Bee's Knees, and v2.18 had some nice speed improvements.

     

     

    If you want to eliminate the translucent edges on the shapes, I can easily add a slider for opacity tolerance. For example, cells above 127 will become 255, and cell 127 & below will become 0.

    • Upvote 1
  6. Eli, that's a sad story :| ... but also funny at the same time :lol:

     

    @hamwizard, here's a script. Copy and paste it into CodeLab. If it's to your liking, I can publish it here on the forum as a plugin. If not, let me know what to change.

     

    Spoiler
    
    // Name: Cell Board
    // Submenu: Stylize
    // Author: toe_head2001
    // Title:
    // Version: 0.1
    // Desc:
    // Keywords:
    // URL:
    // Help:
    #region UICode
    IntSliderControl Amount1 = 20; // [0,100] Cell Size
    IntSliderControl Amount2 = 1; // [0,100] Cell Spacing
    #endregion
    
    void Render(Surface dst, Surface src, Rectangle rect)
    {
        int cellSize = Amount1 + Amount2;
        PixelateEffect pixelateEffect = new PixelateEffect();
        PropertyCollection pixelateProps = pixelateEffect.CreatePropertyCollection();
        PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps);
        pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellSize);
        pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src));
        pixelateEffect.Render(new Rectangle[1] { rect }, 0, 1);
        
        ColorBgra CurrentPixel;
        for (int y = rect.Top; y < rect.Bottom; y++)
        {
            if (IsCancelRequested) return;
            for (int x = rect.Left; x < rect.Right; x++)
            {
                CurrentPixel = dst[x, y];
                if (x % cellSize < Amount2 || y % cellSize < Amount2)
                    CurrentPixel.A = 0;
    
                dst[x, y] = CurrentPixel;
            }
        }
    }

     

     

×
×
  • Create New...