jsonchiu Posted August 21, 2007 Share Posted August 21, 2007 (edited) Meh the bevel effect available in most image editing programs (except pdn)This effect will be under the menu Effects->RendersPrimary color = highlightSecondary color = shadowExample: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->RendersUpdate4: fully fixed transparency "color" Bevel_v1.4.0.0.zip Edited February 9, 2013 by Ego Eram Reputo Attached zipped dll. Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
Ash Posted August 21, 2007 Share Posted August 21, 2007 Post some screen shots to show what the plugin can do. 1 Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
jsonchiu Posted August 21, 2007 Author Share Posted August 21, 2007 Post some screen shots to show what the plugin can do. Fine. I thought everybody knows what it is... it's very common in image manipulation programs. EDIT: screenshots added Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
barkbark00 Posted August 21, 2007 Share Posted August 21, 2007 This plugin doesn't work on a selection or on any objects that are in an otherwise transparent canvas. Other than that it looks great! Quote Take responsibility for your own intelligence. -Rick Brewster Link to comment Share on other sites More sharing options...
moc426 Posted August 21, 2007 Share Posted August 21, 2007 very nice but like BB00 said, doesn't work on selection. Perhaps you can put this under render submenu as well. Quote Link to comment Share on other sites More sharing options...
Fisherman's Friend Posted August 21, 2007 Share Posted August 21, 2007 Jsonchiu, I really appreciate that you publish the source code side by side with your plugins. This is a great help for people learning to code. Thank you very much. And congrats for your new plugin. Quote Link to comment Share on other sites More sharing options...
The_Lionhearted Posted August 21, 2007 Share Posted August 21, 2007 Thanks man! Quote My Gallery Link to comment Share on other sites More sharing options...
Deborah Posted August 22, 2007 Share Posted August 22, 2007 Oh, that's lovely. If you could just get it to work on an object in a transparent canvas (instead of the whole canvas), it would be perfect. Quote Link to comment Share on other sites More sharing options...
Myrddin Posted August 22, 2007 Share Posted August 22, 2007 Cool, this is most definitely going to be handy, thanks! Menu icon? I have a few suggestions if you wish, but I'm very happy with anything. Quote How to Save Your Images under Different File Types My dA Gallery Link to comment Share on other sites More sharing options...
jsonchiu Posted August 22, 2007 Author Share Posted August 22, 2007 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. Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
david.atwell Posted August 22, 2007 Share Posted August 22, 2007 You should zip it. Some people can't direct download .DLLs because of proxy blockers or Browser Settings. Nevertheless, I like this a lot. Good work! Quote The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.Amy: But how did it end up in there?The Doctor: You know fairy tales. A good wizard tricked it.River Song: I hate good wizards in fairy tales; they always turn out to be him. Link to comment Share on other sites More sharing options...
moc426 Posted August 22, 2007 Share Posted August 22, 2007 Looking good, thanks for this! 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. Quote Link to comment Share on other sites More sharing options...
jsonchiu Posted August 22, 2007 Author Share Posted August 22, 2007 Update: fixed transparency bug. Also, improved the render a little bit (it should be smoother now), and added a menu icon. Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
davidtayhs Posted August 22, 2007 Share Posted August 22, 2007 Lovely plugin. A request: Could you allow for a negative range as well? That would really be super for some purposes! Quote Link to comment Share on other sites More sharing options...
jsonchiu Posted August 22, 2007 Author Share Posted August 22, 2007 Lovely plugin. A request: Could you allow for a negative range as well? That would really be super for some purposes! You can just reverse the primary color and the secondary color. Btw, thanks for the great responses! Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
Ash Posted August 22, 2007 Share Posted August 22, 2007 Would be even better if you can put the plugin in "render" Thanks! Quote All creations Ash + Paint.NET [ Googlepage | deviantArt | Club PDN | PDN Fan ] Link to comment Share on other sites More sharing options...
jsonchiu Posted August 22, 2007 Author Share Posted August 22, 2007 Would be even better if you can put the plugin in "render" Thanks! Lolz almost forgot about it... *done* Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
lestat2000_vamp Posted August 22, 2007 Share Posted August 22, 2007 thanks boss. Quote Link to comment Share on other sites More sharing options...
Myrddin Posted August 22, 2007 Share Posted August 22, 2007 Thankyou very much, another useful plugin off the line. Can we expect more or should we wait and see? Quote How to Save Your Images under Different File Types My dA Gallery Link to comment Share on other sites More sharing options...
zisworg Posted August 22, 2007 Share Posted August 22, 2007 Thanks jsonchiu! Great plugin. Quote Link to comment Share on other sites More sharing options...
jsonchiu Posted August 22, 2007 Author Share Posted August 22, 2007 Fixed a few minor bugs. Quote Some links: | Personal Website | Alien Attack | Try out my plugins: | Antialias | Diagonal Lines | Link to comment Share on other sites More sharing options...
Bob Posted August 22, 2007 Share Posted August 22, 2007 Lovely plugin. A request: Could you allow for a negative range as well? You can just reverse the primary color and the secondary color. Could you add a "Invert" button or checkbox, like in the I&BB Gradient plugin? Btw, thanks for the great responses! Deserved. Quote No. Way. I've just seen Bob. And... *poof!*—just like that—he disappears into the mist again. ~Helio Link to comment Share on other sites More sharing options...
spongey437 Posted August 22, 2007 Share Posted August 22, 2007 Well, in reply to jsonchiu's request to post something that can be done with it (Great plugin BTW - I had posted a tutorial on how to do this manually earlier) here is a cool looking frame I came up with using just the bevel effect here. Request - any way that you can get it to support odd shapes? Right now it only creates square box bevels. So if you select a round shape, it doesnt work quite right on it. Anyway, here's the pic Quote Link to comment Share on other sites More sharing options...
sa729 Posted August 22, 2007 Share Posted August 22, 2007 SWEET MAN!!! IVE BEEN LOOKING FOR ONE OF THESE FOR AGES NOW!!! sorry, im excited Quote Hey hey hey, what can I say? Link to comment Share on other sites More sharing options...
Deborah Posted August 22, 2007 Share Posted August 22, 2007 Thanks for the updates, now it's even better. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.