Jump to content

jsonchiu

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by jsonchiu

  1. @Ash Hmm... dark line? It doesn't work with semi-transparent objects IMO. In order for it to work as intended, you need all the pixels on the edge to be opaque. Also, it will place a very tiny line (barely visible) around it if it has a very light color. ------- The feather plugin in the "grow" mode still use Gaussian Blur, and therefore produce blurred results on the edges, instead of clearcut anti-alias. You can see the difference in these pictures (left: feather 1px, grow, right: anti-alias, amount: 5)
  2. @david.atwell Yes, progressive transparency. Here's how the code works: 1. take a pixel, and determine whether it's a solid or transparent one. 2. if it's a transparent one, change the color to the nearest solid pixel, and the alpha value to the average of the surrounding pixels (with a little bit of tweaking to make it not so blurred). @Ash I intended it to be the Photoshop-quality feather, but then I couldn't make it to feather at different amount of pixels.
  3. Ok, so as you know, Boltbait's feather plugin uses Gaussian Blur to soften the edges. I have always found it doesn't quite work the way I wanted. So, I wrote another plugin for smoothing edges, but still keep it clear, not blurred. With this plugin, the result will be clear and smooth, just like any other anti-aliased shapes. Amount: pretty self explanatory. Slide it around to see different effects. Strength: opaqueness of the "feathering" Default 980 for anti-aliasing. Turn it down for feathering. Soft outline/None: Default is on. If turned on, it would darken the edge a little bit to make it clearer. If the image has light colors, turn it off, or else there would be an ugly dark outline. Example: let's feather a cat... (cut from Bob's siggie). Before: the edge is too hard, and jagged After: the edge is smoothed out (anti-aliased)! This plugin can also blur the edges with a medium-high amount and low strength Download Source: Enjoy! Update1: added "strength" slide bar and expand "Amount" to 30 Update2: FULLY fixed transparency bug! Update3: added "soft outline" slider to adjust edge enhancement Update4: fixed "no anti-alias on low alpha" bug. The plugin should now antialias equally for any alpha value. Also, added a menu icon!
  4. Png can be optimized. I use Irfanview to save it with highest compression.
  5. Dunno... but Windows has serious memory leak... beware of that. Usually restarting the computer will solve problems like that.
  6. I think Irfan View should do the job. It's a good image viewer too.
  7. You can just reverse the primary color and the secondary color. Btw, thanks for the great responses!
  8. Update: fixed transparency bug. Also, improved the render a little bit (it should be smoother now), and added a menu icon.
  9. Fixed selection bug. It should now be able to apply effect to selected areas. I'm trying to solve the transparency bug... It should be done pretty soon.
  10. Fine. I thought everybody knows what it is... it's very common in image manipulation programs. EDIT: screenshots added
  11. Meh the bevel effect available in most image editing programs (except pdn) This effect will be under the menu Effects->Renders Primary color = highlight Secondary color = shadow Example: Ash's tiger: -> A few buttons on Ash's siggie: This link appears to be broken (09 Feb 2013 - EER) >> dll: http://jason.jjtchiu.com/downloads/Bevel_v1.4.0.0.dll Download the DLL from the attachment at the bottom of this post. source: int Amount1=7; //[0,200]Depth int Amount2=20; //[0,100]Strength void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); // Delete any of these lines you don't need Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left); long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top); int left = (int)selection.Left; int top = (int)selection.Top; int right = (int)selection.Right; int bottom = (int)selection.Bottom; ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor; int BrushWidth = (int)EnvironmentParameters.BrushWidth; ColorBgra CurrentPixel; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x,y]; //top if ((x-left) >= (y-top) && (y-top) <= Amount1 && x+(y-top) < right) { CurrentPixel = transformPixel(y-top, CurrentPixel, PrimaryColor); } //left else if ((y-top) >= (x-left) && (x-left) <= Amount1 && (x-left)+y < bottom) { CurrentPixel = transformPixel(x-left, CurrentPixel, PrimaryColor); } //bottom else if ((x-left) >= (bottom-y) && (bottom-y) <= Amount1 && x+(bottom-y) <= right) { CurrentPixel = transformPixel(bottom-y, CurrentPixel, SecondaryColor); } //right else if ((y-top) >= (right-x) && (right-x) <= Amount1 && (right-x)+y < bottom) { CurrentPixel = transformPixel(right-x, CurrentPixel, SecondaryColor); } dst[x,y] = CurrentPixel; } } } } ColorBgra transformPixel(float px_from_edge, ColorBgra CurrentPixel, ColorBgra NewColor) { //set amount of background interference 0~1 (ie how much it blends to the background) float diff = (float)(0.05 + px_from_edge/Amount1); float strength = (float)((float)(100 - Amount2) / 100 + (float)0.35); diff = diff * strength; if (diff > 1) { diff = 1; } else if (diff < 0) { diff = 0; } //some vars just for convenience, more readable float div = diff + 1; float invrt_diff = 1 - diff; //we set the RGB to primary color if it is completely transparent (black is the default) //That should solve if (CurrentPixel.A == 0) { CurrentPixel.R = NewColor.R; CurrentPixel.G = NewColor.G; CurrentPixel.B = NewColor.B; } //and we are ready to color the pixels //ex: if 70% background interference //we have 70% of original color's R plus 30% of the new color's R CurrentPixel.R = (byte)((invrt_diff * (float)NewColor.R) + (diff * (float)CurrentPixel.R)); CurrentPixel.G = (byte)((invrt_diff * (float)NewColor.G) + (diff * (float)CurrentPixel.G)); CurrentPixel.B = (byte)((invrt_diff * (float)NewColor. + (diff * (float)CurrentPixel.); //transparency values need special manipulation to prevent bad-looking renders float temp = CurrentPixel.A + NewColor.A; if (temp > 255) { temp = 255; } temp = ((int)CurrentPixel.A + temp) / 2; if (CurrentPixel.A < 255) { temp = temp * (1 + (float)invrt_diff); } if (temp > 255) { temp = 255; } CurrentPixel.A = (byte)temp; //and we are done return CurrentPixel; } Enjoy! Update1: fixed selection bug. The plugin should now be able to apply filter to selected areas. Update2: fixed transparency bug. It should now render correctly. Update3: moved to Effects->Renders Update4: fully fixed transparency "color" Bevel_v1.4.0.0.zip
  12. In the layer with the circle, change the transparency to 128.
  13. Anyways, when did this become 2 pages? :shock: My eyes are bad these days...
  14. Can somebody compile a package that works in Visual Studio .Net 2003? I haven't got around to upgrade my 4-year-old program yet. Right now I can only use codelab...
  15. Done Nope, I wrote the code from scratch. ------------------------------------------------------------------------------- Update: fixed transparency bug. You can now apply the plugin using a semi-transparent brush color and it will multiply the color to the background just like what it does when you use the line/curve tool.
  16. Uh... you can't add a byte to a int.
  17. Wow, thanks so much for the tut!
  18. Yeah, but this plugin take options like brush width and exact amount of pixels between lines. :wink:
  19. I've been searching for a plugin that makes diagonal lines for a long time... Since I couldn't, I decided that maybe I should make one myself! It turned out to be a lot easier than I thought, and here it is! The plugin will be placed under Effects -> Render Download Source: Enjoy! Update1: added brushwidth slide bar. Update2: added antialias level & menu icon. Update3: fixed transparency bug. Update4: added angle slide bar. Update5: added colorwheel, alpha slide bar, fixed more transparency issues
×
×
  • Create New...