Jump to content

BoltBait

Administrator
  • Posts

    15,653
  • Joined

  • Last visited

  • Days Won

    390

Everything posted by BoltBait

  1. There are two easy ways to do this in 3.0: Menu: Adjustments > Black and White or Menu: Adjustments > Hue Saturation, change the saturation slider to 0
  2. Make sure you select the corner pieces that are outside of the outline and delete them. You should see the checkboard pattern. Then, save your picture in .GIF format.
  3. This forum is for posting tutorials, not requesting them. Moving to general discussion...
  4. That's correct. Primary color is a 3.0 thing. For 2.72, change the line to: ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.ForeColor; Hey! Nice idea for creating stars. I noticed some problems with your code--it doesn't work when you choose a figure with an even number of sides and for some reason, the lines don't come out solid. I'm going to steal that idea and put it on my page. (Well, I won't steal it, per se--I'll credit you.)
  5. I needed to draw a pentagon, but Paint.NET didn't have a tool to do that. I don't have a way to create tools, so I did the next best thing--I wrote a Codelab script. Here are some examples of what you can create with this filter: If you like it, you can download the precompiled effect here: BoltBait's Plugin Pack Visit this site to see step-by-step instructions how to actually use the script: http://boltbait.googlepages.com/shapes Here is the updated Codelab script: (For you script writers... it is one of the weirdest scripts you'll ever see. Why? Because the rendering loop doesn't seem to do anything!): void Render(Surface dst, Surface src, Rectangle rect) { int rpercent = 95; // percent of radius (1-100), default 100, slider int verticies = 5; // number of points (3-10?), default 5, slider int rotation = 15; // degrees to rotate the shape (0-359), default 0, slider int stars = 1; // 1=normal, 2=stars (integer, range 1 to less than verticies/2) PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); // Because I have to reset the destination every time // this is reeeeeaaaaallllly slow for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { dst[x,y] = src[x,y]; } } } // If this was a tool, this is where the starting nub is located long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left); long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top); // calculate actual radius // If this was a tool, you should calculate this from the second nub location double r = (double)(Math.Min(CenterX-selection.Left,CenterY-selection.Top)/100.0*rpercent); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; // for 2.72 use .ForeColor; ColorBgra CurrentPixel; double th = 360.0/verticies; double X1 = 0, Y1 = 0, X2 = 0, Y2 = 0; double angle = 0; for (int P = 0; P<=verticies; P++) { // Find the starting point (X1,Y1) angle = Math.PI * ((th * P) + rotation) / 180.0; X1 = (r * Math.Cos(angle)) + CenterX; Y1 = (r * Math.Sin(angle)) + CenterY; // Find next end point (X2,Y2) angle = Math.PI * ((th * (P+stars)) + rotation) / 180.0; X2 = (r * Math.Cos(angle)) + CenterX; Y2 = (r * Math.Sin(angle)) + CenterY; // Draw line from (X1,Y1) to (X2,Y2) DrawLine((int)X1,(int)Y1,(int)X2,(int)Y2, dst, PrimaryColor, selectionRegion); } } void DrawLine(int x1, int y1, int x2, int y2, Surface dst, ColorBgra LineColor, PdnRegion selectionRegion) { int i,gd,gm; double roundx,roundy,xi,yi,dx,dy,x,y,l; dx=x2-x1; dy=y2-y1; if(Math.Abs(dx)>Math.Abs(dy)) { l=dx; } else { l=dy; } if (l<0) { DrawLine(x2,y2,x1,y1,dst,LineColor,selectionRegion); } else { xi=dx/l; yi=dy/l; x=x1; y=y1; if (selectionRegion.IsVisible((int)x, (int)y)) { dst[(int)x, (int)y] = LineColor; } for(i=1;i<=l;i++) { x=x+xi; y=y+yi; roundx=x+0.5; roundy=y+0.5; if (selectionRegion.IsVisible((int)roundx, (int)roundy)) { dst[(int)roundx, (int)roundy] = LineColor; } } } } Here are some examples of stars you can create: Now I want to see what you can do with it! Source Code Since you asked, here is the VS2005 souce code: PolygonSRC.zip (Ignore the fact that I misspelled the project name. ) This should serve as a good example of how to use GDI+ drawing commands on the canvas. This should also serve as a good example of how to use this template.
  6. Welcome to the boards. Next time, show off in the this thread: http://paintdotnet.12.forumer.com/viewtopic.php?t=1072
  7. What format are you saving the graphics in? If it is .GIF, you are out of luck. If it is .PNG, then the color I gave you above should work pretty well.
  8. Why not use color (1,192,192,192)? It's NEARLY transparent...
  9. Although the source code of final builds is available, this is not an open source project.
  10. The codelab script is trivial if you want to try this out... void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); ColorBgra CurrentPixel; for(int y = rect.Top; y { for (int x = rect.Left; x { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; CurrentPixel.A = (byte)255; dst[x,y] = CurrentPixel; } } } }
  11. True, Bob. However, if a pixel has an alpha of 0 the other bytes are Undefined. You can't just use them by changing the alpha to 255 (well, you can, but the results are unpredictible).
  12. Sure, create a new layer and fill it with white. Move that layer to the bottom. Merge Down the layer with transparency. If you are not using the 3.0 Alpha build of Paint.net, MergeDown will not be available... use Image Flatten instead.
  13. This has come up once or twice in the past... http://paintdotnet.12.forumer.com/viewtopic.php?t=2059
  14. That's one way to do it. But "isBackground" is stored in the file, so now you're asking me to add a bunch of extra logic to the .PDN image read/write code. This is code that works great as it is, mind you! Plus that would break forwards file format compatibility -- files saved in 3.0 would not open in 2.72, whereas they otherwise should. Plus, a layer object by itself has no notion of 'where' it is, so the 'isBackground' logic would have to be moved to other places of the code: anytime a layer is added, moved, deleted, or otherwise positionally altered, there would have to be code to figure out how to cope with the 'isBackground' bit. So your idea, while simple at the surface, actually adds a lot of complexity and introduces risk to simplify something that really isn't in grand need of simplification (IMO of course -- and I'm the dev lead ). In that case, you could probably just modify three sections of code: Move Layer Down, Delete Layer, and Load File. At the end of each of those routines, adjust the isBackground property as necessary. It's only minorly annoying. I'll drop it. YOU KNOW... you could just not display it in italics and no one would be the wiser.
  15. OK, make the bottom most layer always shown in italics. Make it work as before.
  16. I say, make it be filled with transparency, get rid of the italics, and be done with it.
  17. However, you are always free to create effects and publish them yourself in the plugin forum.
  18. I have a layer window bug for you... The background layer is listed in italics--that's fine. However if you move a layer below it, the original background layer is still listed in italics and the new background layer is not. What is the meaning of italics in this case? Is there any point in displaying any layer name in italics?
  19. Select the background area that you want to be transparent (try the magic wand tool--be sure to adjust the tollerance bar) and press the Delete key on your keyboard.
  20. OK, here's a fourth method... Select a layer and create your gradient on it Create a new layer and fill that layer with black Put your text on that layer in white Change the layer blending mode to Multiply. Merge Down.
  21. That's ok. We presented two different approaches.
  22. You could try putting your text on its own layer, then using the magic wand to select the text and finally using the Gradient plugin (or the built-in gradient tool) to color the text. It would probably work best if your text is not "anti-aliased". Then, if necessary, you could use the feather plugin to finish off your text. Gradient plugin: http://paintdotnet.12.forumer.com/viewtopic.php?t=2294 Feather plugin: http://paintdotnet.12.forumer.com/viewtopic.php?t=2498
  23. Perhaps you could create your own grid on its own layer, then delete it when you are done. Grid Maker: http://paintdotnet.12.forumer.com/viewtopic.php?t=2302
×
×
  • Create New...