• Content Count

  • Joined

  • Last visited

Community Reputation


Profile Information

  • Gender
  • Location
    Sammamish, WA
  • Interests
    Arduino and NeoPixels
  1. It is best to leave the correction on by default. The reason is that a simple color gradiant from black to a color on the NeoPixels will not look linear at all. NeoPixels are "hot" in the lower portion of brightness values. When I document the use of this plugin in my NeoPixelBus project I will include when "not" to use it. There are many write-ups on this topic of the gamma curve, and the equation is... corrected unit value = Math.Pow(unitValue, 1.0 / 0.45) The feature of my NeoPixelBus that uses this output isn't checked in yet, working on samples before I make the next release there. At some point I expect the actual chip on the pixels will apply this in the hardware; but until then I wanted to expose it here and in my library.
  2. const uint16_t myImageWidth = 16; const uint16_t myImageHeight = 20; const uint8_t PROGMEM myImage[] = { // (16 x 20) GRB in Hexadecimal 0x00, 0xff, 0x00, 0x00, 0x00, Overview: This will allow an image file to be exported into a .h file that can be included into a Arduino Sketch. The image is exported as a PROGMEM data structure for use with the NeoPixelBus Arduino library located at \GitHub\Makuna\NeoPixelBus. Installation: Download the attached zip and copy the contained DLL into your Paint.Net\FileTypes directory. Restart Paint.Net How to use: When you select "Save As", a new file type "Arduino Source File Snippet" will show up in the "save as" dialog. Selecting this will open the following properties dialog. Select the color order that your NeoPixel use, this is important as the data structure will contain native image bits for the specific color feature of your pixels. If your pixels contain a White LED also, make sure to select the correct one ending in W. The layer blend operation allows you to use the layers for specific needs. Flatten for RGB is the most common. It will flatten all the layers temporarily as it exports the data. The W channel will always be off. Background only for RGB will only look at the "Background" layer when it exports. The W channel will always be off. ​Background and White for RGBW will use the "Background" layer for the RGB parts of the data and the "White" layer will be used to create the W channel if present. By default, Gamma correction is on. This will help match the image to the Gamma Cure of NeoPixel LEDs. Turning it off will create data that will have the dim colors come out more bright.
  3. Yes, but my point is I am not truely saving, I am exporting. If I don't support loading (and I don't), there is no need to have the file in the recent list either, as you can't load it. So it seems there is no true Export path? So that would be request for a new feature?
  4. So I have my write only FileType plugin working, but it has this side effect like all the others that the source image gets named to the file you saved to. While this seems normal for plugins that read and write, for plugins that are really Export and only save, this is confusing to have your image name changed (and added to recent files list). I noticed other similar plugins have the same issue (CSV plugin). Is there something I am missing that would fix my plugin?
  5. THANKS! The IsReflexive override was the needed part to allow it to finish.
  6. I am new to developing plugins for Paint.Net, so it I suspect I am missing something simple. Below is the fledgling plugin that seems to correctly provide properties for save dialog ("save Configuration"). But after the hitting OK on it I get another popuup "Save Configuration" dialog with a cycling dialog bar and the word "finishing" above the progress control. The problem is it never goes away. Pretty much requires I terminate Paint.Net. Attached debugger and didn't see any exceptions being fired. My OnSaveT is empty. I am using the latest version 4.0.9. using System; using System.IO; using System.Collections.Generic; using PaintDotNet; using PaintDotNet.IndirectUI; using PaintDotNet.PropertySystem; using System.Drawing; namespace ArduinoProgmemNeoPixel { internal class ArduinoProgmemNeoPixelFileType : PropertyBasedFileType { // Names of the properties private enum PropertyNames { VariableName, ColorOrder, ColorValueBase } private enum ColorOrder { RGB, GRB, BRG, RBG, RGBW, GRBW, BRGW, RBGW } private enum ColorValueBase { Decimal, Hexadecimal, Octal, Binary } // Defaults const String defaultVariableNameFormat = "Bitmap{0:x}"; // ---------------------------------------------------------------------- /// <summary> /// Constructs a ArduinoProgmemNeoPixelFileType instance /// </summary> internal ArduinoProgmemNeoPixelFileType() : base( "Arduino Source File", //FileTypeFlags.SupportsLayers | //FileTypeFlags.SavesWithProgress | FileTypeFlags.SupportsSaving, new[] { ".cpp", ".c", ".h" }) { } // ---------------------------------------------------------------------- /// <summary> /// Add properties to the dialog /// </summary> public override PropertyCollection OnCreateSavePropertyCollection() { List<Property> props = new List<Property>(); string defaultVariableName = string.Format(defaultVariableNameFormat, this.GetHashCode()); props.Add(new StringProperty(PropertyNames.VariableName, defaultVariableName, 60)); props.Add(StaticListChoiceProperty.CreateForEnum<ColorOrder>(PropertyNames.ColorOrder, 0, false)); props.Add(StaticListChoiceProperty.CreateForEnum<ColorValueBase>(PropertyNames.ColorValueBase, 0, false)); List<PropertyCollectionRule> propRules = new List<PropertyCollectionRule>(); return new PropertyCollection(props, propRules); } // ---------------------------------------------------------------------- /// <summary> /// Adapt properties in the dialog (DisplayName, ...) /// </summary> public override ControlInfo OnCreateSaveConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultSaveConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.VariableName, ControlInfoPropertyNames.DisplayName, "Variable Name"); configUI.SetPropertyControlValue(PropertyNames.VariableName, ControlInfoPropertyNames.Description, "The name of the variable in the created file. You can always edit the name latter."); configUI.SetPropertyControlValue(PropertyNames.ColorOrder, ControlInfoPropertyNames.DisplayName, "Color element order"); configUI.SetPropertyControlValue(PropertyNames.ColorOrder, ControlInfoPropertyNames.Description, "Select the native color element order of your NeoPixels."); configUI.SetPropertyControlValue(PropertyNames.ColorValueBase, ControlInfoPropertyNames.DisplayName, "Color value base"); configUI.SetPropertyControlValue(PropertyNames.ColorValueBase, ControlInfoPropertyNames.Description, "What numerical base do you want the values to be written out as."); return configUI; } // ---------------------------------------------------------------------- /// <summary> /// Saves a document to a stream respecting the properties /// </summary> protected override void OnSaveT(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) { // input.Flatten(scratchSurface); //using (StreamWriter writer = new StreamWriter(output)) { } } // ---------------------------------------------------------------------- /// <summary> /// Creates a document from a stream /// </summary> protected override Document OnLoad(Stream input) { // add some code here ... return null; } } }
  7. Any possibility to include all orders of color components, like GRB and others? Also, include an x component; RGBx; where x is zero? X is the average color on another layer? I guess I could just select RGBA and make sure alpha is set to the level I need before saving. Why you may ask? NeoPixel buffers for Arduino projects so the image is stored in code. NeoPixels (or similar one wire bus protocol smart LEDs) come in many different color element patterns, and being able to store a native format is faster to copy to the output buffer. Further, the newer ones include a W channel that is for a forth White color element on the pixel.
  8. Doesn't work with 4.0; any chance it can be updated?