Jump to content

BoltBait

Administrator
  • Posts

    15,653
  • Joined

  • Last visited

  • Days Won

    390

Everything posted by BoltBait

  1. In the middle of this page, there is a poll. Go vote for Paint.NET here: http://lifehacker.com/five-best-photoshop-alternatives-1483312519 Show your support!
  2. While I did use a slightly different HSV to RGB routine, I did use HSV colors for my Pastel plugin. Source code is around here somewhere... EDIT: http://forums.getpaint.net/index.php?/topic/2045-pastelwater-color-plugin-updated-2008-02-18/ Now, let's see if I can find the source code... EDITEDIT: // Title: BoltBait's Pastel Effect v3.5 // Author: BoltBait // Name: Pastel // Submenu: Artistic // URL: http://www.boltbait.com/pdn #region UICode int Amount1 = 3; // [1,8] Pastel Size int Amount2 = 50; // [3,255] Roughness #endregion private OilPaintingEffect oilPaintEffect = new OilPaintingEffect(); private PropertyCollection oilPaintProps; unsafe void Render(Surface dst, Surface src, Rectangle rect) { double H = 0, S = 0, V = 0; double BaseColors = 36; // 1-360, step 1, Default = 72 double Lighter = 1.0; // 1-2, step .1, Default = 1.0 double Darker = 30; // 1-100, step 1, Default = 30 double Q = 360 / BaseColors; // Oil Paint backgound this.oilPaintProps = this.oilPaintEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken oilPaintToken = new PropertyBasedEffectConfigToken(this.oilPaintProps); oilPaintToken.SetPropertyValue(OilPaintingEffect.PropertyNames.BrushSize, Amount1); oilPaintToken.SetPropertyValue(OilPaintingEffect.PropertyNames.Coarseness, Amount2); this.oilPaintEffect.SetRenderInfo(oilPaintToken, new RenderArgs(dst), new RenderArgs(src)); this.oilPaintEffect.Render(new Rectangle[1] { rect }, 0, 1); for(int y = rect.Top; y < rect.Bottom; y++) { ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y); for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = *dstPtr; EvanRGBtoHSV(CurrentPixel.R, CurrentPixel.G, CurrentPixel.B, ref H, ref S, ref V); H = Q * (double)Math.Round(H / Q); S /= Lighter; V *= 100; V = V / (Darker * 10); V += (1.0 - (Darker / 100)) + 0.1; if (V > 1) V = 1; EvanHSVtoRGB(H, S, V, ref CurrentPixel.R, ref CurrentPixel.G, ref CurrentPixel.; *dstPtr = CurrentPixel; dstPtr++; } } } private void EvanHSVtoRGB(double H, double S, double V, ref byte bR, ref byte bG, ref byte bB) { const double HSV_UNDEFINED = -999.0; // Parameters must satisfy the following ranges: // 0.0 <= H < 360.0 // 0.0 <= S <= 1.0 // 0.0 <= V <= 1.0 // Handle special case first if (S == 0.0 || H == HSV_UNDEFINED) { byte x = (byte)(int)(V * 255.0); bR = x; bG = x; bB = x; return; } if (H >= 360.0) { H = AngleConstrain(H); } double R = V, G = V, B = V; double Hi = Math.Floor(H / 60.0); double f = H / 60.0 - Hi; double p = V * (1.0 - S); double q = V * (1.0 - f * S); double t = V * (1.0 - (1.0 - f) * S); if (Hi == 0.0) { R = V; G = t; B = p; } else if (Hi == 1.0) { R = q; G = V; B = p; } else if (Hi == 2.0) { R = p; G = V; B = t; } else if (Hi == 3.0) { R = p; G = q; B = V; } else if (Hi == 4.0) { R = t; G = p; B = V; } else if (Hi == 5.0) { R = V; G = p; B = q; } int iR = (int)(R * 255.0); int iG = (int)(G * 255.0); int iB = (int)(B * 255.0); bR = (byte)iR; bG = (byte)iG; bB = (byte)iB; } private void EvanRGBtoHSV(int R, int G, int B, ref double outH, ref double outS, ref double outV) { const double HSV_UNDEFINED = -999.0; // R, G, and B must range from 0 to 255 // Ouput value ranges: // outH - 0.0 to 360.0 // outS - 0.0 to 1.0 // outV - 0.0 to 1.0 double dR = (double)R / 255.0; double dG = (double)G / 255.0; double dB = (double)B / 255.0; double dmaxRGB = EvanMax3(dR, dG, dB); double dminRGB = EvanMin3(dR, dG, dB); double delta = dmaxRGB - dminRGB; // Set value outV = dmaxRGB; // Handle special case if (dmaxRGB == 0) { outH = HSV_UNDEFINED; outS = 0.0; return; } outS = delta / dmaxRGB; if (dmaxRGB == dminRGB) { outH = HSV_UNDEFINED; return; } // Finally, compute hue if (dR == dmaxRGB) { outH = (dG - dB) / delta * 60.0; } else if (dG == dmaxRGB) { outH = (2.0 + (dB - dR) / delta) * 60.0; } else //if (dB == dmaxRGB) { outH = (4.0 + (dR - dG) / delta) * 60.0; } if (outH < 0) { outH += 360.0; } } private double EvanMax3(double x, double y, double z) { return (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z); } private double EvanMin3(double x, double y, double z) { return (x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z); } private double AngleConstrain(double MyAngle) { // Makes sure that 0.0 <= MyAngle < 360.0 // "Wraps around" the value if it's outside this range if (MyAngle >= 360.0) { MyAngle -= Math.Floor(MyAngle / 360.0) * 360.0; } if (MyAngle < 0.0) { MyAngle += 360.0; } return MyAngle; }
  3. One of my tutorials has a section on it. http://boltbait.com/pdn/CodeLab/help/tutorial4.php Hope this helps.
  4. Try this one: http://forums.getpaint.net/index.php?showtopic=1957 It handles HSV gradients.
  5. One day I'll write a tutorial on how to use my effect and you'll understand why it is perfectly located.
  6. In paint.net 4.0, if you hover over an effect name in the effect menu it gives you info about the effect including auther and DLL file that contains the effect.
  7. RAW support is not built-in, but there are several RAW filetype plugins. Just pick the one that works for your flavor of RAW file.
  8. Make sure your namespace is unique.* *I have not looked at your code yet.
  9. What OS are you installing on? Are you using the admin account of that OS?
  10. Where do you think the translations like this come from:
  11. Upper right corner of this page: http://www.dotpdn.com/downloads/pdn.html
  12. After using "copy", go to the destination image and use Edit > Paste into new layer
  13. Look here: http://forums.getpaint.net/index.php?/topic/2947-color-palettes-go-here/
  14. You are right. The Amount variables are read only. This is a limitation of the Paint.NET plugin Indirect UI.
  15. Here is some code to do that: http://forums.getpaint.net/index.php?/topic/18105-line-drawing/
  16. Maybe Paint.NET is installed in a different place. Try this: Find the Paint.NET icon that you double-click in order to run Paint.NET. Right-Click on it and choose "Properties" from the menu that shows up. Click the "Open file location" button. In the windows explorer window that opens, double-click "Effects" folder. That's where the effect dll files are supposed to be installed.
  17. That's not something a plugin can do. HOWEVER... Have you tried scrolling with your mouse scroll wheel? It works for me.
  18. There's your problem right there. ONLY download effects from this web site.
  19. I'm not exactly sure what you're asking for here. But, if you're asking if you can print out the tutorials on this site, bundle them together in a printed book, and redistribute it for profit... then, no you may not.
  20. Is there more of an error message? If so, list the entire thing here. If not, give us a screenshot of the error that does come up.
  21. Have you tried this plugin: http://forums.getpaint.net/index.php?/topic/24587-normal-map-renderer/ Or this: http://forums.getpaint.net/index.php?/topic/23936-the-normal-tools-v-011/ Or this: http://forums.getpaint.net/index.php?/topic/21224-heightmap-v13/ with http://forums.getpaint.net/index.php?/topic/2534-normal-map/
  22. In the following window, select "Open Paletts Folder": In the Explorer window, go up one level from that.
  23. Paste onto its own layer. That's how Paint.NET works.
  24. There is a setting in the Save As dialog box that controls the PNG transparency mode. Make sure that it is set to "Auto" instead of 24 Bit.
×
×
  • Create New...