-
Posts
15,653 -
Joined
-
Last visited
-
Days Won
390
Everything posted by BoltBait
-
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!
-
Code problem - Listing colors in image
BoltBait replied to Felix The Ghost's topic in Plugin Developer's Central
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; } -
Code problem - Listing colors in image
BoltBait replied to Felix The Ghost's topic in Plugin Developer's Central
One of my tutorials has a section on it. http://boltbait.com/pdn/CodeLab/help/tutorial4.php Hope this helps. -
saturation/hue gradients
BoltBait replied to theHeretic's topic in Paint.NET Discussion and Questions
Try this one: http://forums.getpaint.net/index.php?showtopic=1957 It handles HSV gradients. -
One day I'll write a tutorial on how to use my effect and you'll understand why it is perfectly located.
-
Menu Problem with CodeLab Plugins Built with Visual Studio
BoltBait replied to MJW's topic in Plugin Developer's Central
Make sure your namespace is unique.* *I have not looked at your code yet. -
Cannot Finish Paint.NET Installation
BoltBait replied to QuestionableQuestions's topic in Troubleshooting & Bug Reports
What OS are you installing on? Are you using the admin account of that OS? -
Where do you think the translations like this come from:
-
Paint.NET clipboard format interop
BoltBait replied to AshleyScirra's topic in Troubleshooting & Bug Reports
...and there was dancing in the streets! -
Just a quick beginner question
BoltBait replied to mcchuggernaut's topic in Paint.NET Discussion and Questions
After using "copy", go to the destination image and use Edit > Paste into new layer -
Look here: http://forums.getpaint.net/index.php?/topic/2947-color-palettes-go-here/
-
'Scribble', temp surface & prop rules questions
BoltBait replied to Red ochre's topic in Plugin Developer's Central
Here is some code to do that: http://forums.getpaint.net/index.php?/topic/18105-line-drawing/ -
No plugins loading. troubleshooting section no help
BoltBait replied to andywright's topic in Troubleshooting & Bug Reports
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. -
Anyone having issues with this?
BoltBait replied to Deleted's topic in Paint.NET Discussion and Questions
There's your problem right there. ONLY download effects from this web site. -
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.
-
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.
-
Using Paint.NET to create Normal Maps?
BoltBait replied to Xzerizon's topic in Paint.NET Discussion and Questions
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/ -
In the following window, select "Open Paletts Folder": In the Explorer window, go up one level from that.
-
transparent is not transparent...
BoltBait replied to Abats's topic in Paint.NET Discussion and Questions
Paste onto its own layer. That's how Paint.NET works. -
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.