VoidWhisperer Posted December 27, 2009 Share Posted December 27, 2009 #region UICode int Amount1=0; //[0,100]Slider 1 Description int Amount2=0; //[0,100]Slider 2 Description int Amount3=0; //[0,100]Slider 3 Description int runs=255; int num = 5; #endregion void Render(Surface dst, Surface src, Rectangle rect) { // 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); 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++) { CurrentPixel = src[x,y]; // TODO: Add pixel processing code here // Access RGBA values this way, for example: // CurrentPixel.R = (byte)PrimaryColor.R; // CurrentPixel.G = (byte)PrimaryColor.G; if(CurrentPixel.R != 255 && CurrentPixel.G != 255 && CurrentPixel.B != 255 || CurrentPixel.A > 0){ CurrentPixel.A = (byte)x; runs= runs - 1; dst[x,y] = CurrentPixel; } } } } I'm trying to write something to make the picture go slowly transparent, and i'm kinda of new to PDN Plugins So, could someone help me fix this? A picture is below: That, is what is happening ._. Quote Link to comment Share on other sites More sharing options...
VoidWhisperer Posted December 27, 2009 Author Share Posted December 27, 2009 Oops -_-' I guess i need to learn to put images on the right way, anyways: this is an image of what's happening: Quote Link to comment Share on other sites More sharing options...
Boude Posted December 27, 2009 Share Posted December 27, 2009 You mean like fading? You can't, PDN only allows you to have 1 image which only changes once. Quote History repeats itself, because nobody was paying attention the first time. Link to comment Share on other sites More sharing options...
pyrochild Posted December 27, 2009 Share Posted December 27, 2009 PDN only allows you to have 1 image which only changes once. ...what are you talking about? Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Boude Posted December 27, 2009 Share Posted December 27, 2009 One image which the plug-in can only change once. Quote History repeats itself, because nobody was paying attention the first time. Link to comment Share on other sites More sharing options...
pyrochild Posted December 27, 2009 Share Posted December 27, 2009 OP isn't asking for animation, he's asking for a transparent gradient. I think. Maybe. Very ambiguous, really. What do you mean, VoidWhisperer? Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Boude Posted December 28, 2009 Share Posted December 28, 2009 Oh, you're right. I think he means a transparency gradient, by the look of his images. Quote History repeats itself, because nobody was paying attention the first time. Link to comment Share on other sites More sharing options...
VoidWhisperer Posted December 28, 2009 Author Share Posted December 28, 2009 That is pretty much what I am trying to do. Quote Link to comment Share on other sites More sharing options...
zarathoustra Posted December 28, 2009 Share Posted December 28, 2009 void Render(Surface dst, Surface src, Rectangle rect) { double increment = 255.0 / (double) src.Width; for (int x = rect.Left; x < rect.Right; x++) { byte alpha = (byte) Math.Round(x * increment); for (int y = rect.Top; y < rect.Bottom; y++) { ColorBgra CurrentPixel = src[x,y]; CurrentPixel.A = alpha; dst[x,y] = CurrentPixel; } } } Edit: in codelab, rather than in pseudocode. 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.