AhmedElyamani
-
Posts
201 -
Joined
-
Last visited
-
Days Won
2
Posts posted by AhmedElyamani
-
-
Thanks for the great feedback , everyone!
@toe_head2001 I've applied all of your suggestions , except for disabling the UI items , as I have no idea how to do it.
@TechnoRobbo I've now included the option to draw polygons (which turned out a bit trickier than expected )
@medora & seerose I think it should be resolved now
Updated version is now included in the original post. You can make more fancy shapes like these:
Also here is the source code:
#region UICode int Amount1 = 8; // [1,10] Angles int Amount2 = 6; // [2,11] Vertices , 11 = Circle bool Amount3 = true; // [0,1] Fill ColorBgra Amount4 = ColorBgra.FromBgr(200,120,0); // Fill Color bool Amount5 = true; // [0,1] Outline int Amount6 = 1; // [1,100] Brush Size ColorBgra Amount7 = ColorBgra.FromBgr(120,0,0); // Outline Color int Amount8 = 100; // [0,200] Zoom bool Amount9 = true; // [0,1] rotation bool Amount10 = false; // [0,1] anti-aliasing #endregion // //DrawShapes (Graphics g ,Brush b, Pen p, double x , double y , double r , ColorBgra c , ColorBgra cF ,bool fill,bool outline , int verts ,int rotVal) int lengthdirX(int length, double dir) { return (int)(Math.Cos(dir/180 * Math.PI)*length); } int lengthdirY(int length, double dir) { return (int)(Math.Sin(dir/180 * Math.PI)*length); } void DrawShape(Graphics g ,Brush b,Pen p, int x , int y ,int r , bool fill, bool outline , int verts , int rot) { if (verts>10) { Rectangle rect1 = new Rectangle(x - r , y - r , r*2 , r*2); if(fill)g.FillPie( b , rect1 , 0.0f , 360.0f); if(outline) g.DrawArc( p , rect1 , 0.0f , 360.0f ); } else { if(fill) { System.Drawing.PointF[] shapePoints = new System.Drawing.PointF[verts]; int length = (int)(2*r*Math.Sin(Math.PI/verts)), originalAngle= (180 - (verts-2) * 180 /verts)/2 , angle = rot+originalAngle; shapePoints[0] = new System.Drawing.PointF((float)(x-lengthdirX(r,270-rot)),(float)(y+lengthdirY(r,270-rot))); for(int i=1; i<verts; i++) { float xx=shapePoints[i-1].X + lengthdirX(length , angle), yy = shapePoints[i-1].Y + lengthdirY(length , angle); shapePoints[i] = new System.Drawing.PointF((float)xx,(float)yy); angle = (angle +originalAngle * 2)%360 ; } System.Drawing.Drawing2D.FillMode newFillMode = System.Drawing.Drawing2D.FillMode.Winding; g.FillPolygon(b,shapePoints,newFillMode); } if(outline) { System.Drawing.Point[] shapePoints = new System.Drawing.Point[verts]; int length = (int)(2*r*Math.Sin(Math.PI/verts)), originalAngle= (180 - (verts-2) * 180 /verts)/2 , angle = rot+originalAngle; shapePoints[0] = new System.Drawing.Point(x-lengthdirX(r,270-rot),y+lengthdirY(r,270-rot)); for(int i=1; i<verts; i++) { int xx=shapePoints[i-1].X + lengthdirX(length , angle), yy = shapePoints[i-1].Y + lengthdirY(length , angle); shapePoints[i] = new System.Drawing.Point(xx,yy); angle = (angle +originalAngle * 2)%360 ; } g.DrawPolygon(p, shapePoints); } } } void DrawShapes (Graphics g ,Brush b, Pen p, double x , double y , double r , ColorBgra c , ColorBgra cF ,bool fill,bool outline , int verts ,int rotVal) { if(r<=1) return; DrawShape(g, b,p, (int)x , (int)y,(int)r , fill , outline , verts ,rotVal); Pen newPen = new Pen(c); SolidBrush newBrush = new SolidBrush(cF); newPen.Width=Amount6; for(double Ang=360; Ang>=0; Ang-=Math.Ceiling((double)(360.00/(Amount1)))) { DrawShapes(g,newBrush, newPen, x + (2 * r) * Math.Cos( Ang / 180 * Math.PI) , y + (2* r) * Math.Sin( Ang / 180 * Math.PI) , r/3 ,c ,cF,fill,outline ,verts , (Amount9?(int)Ang:0)); } } void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); dst.CopySurface(src,rect.Location,rect); int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left; int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top; ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; Graphics canvas = new RenderArgs(dst).Graphics; canvas.SmoothingMode = Amount10? System.Drawing.Drawing2D.SmoothingMode.AntiAlias:System.Drawing.Drawing2D.SmoothingMode.None; int BrushWidth = (int)EnvironmentParameters.BrushWidth; Pen myPen = new Pen(Amount7); SolidBrush myBrush = new SolidBrush(Amount4); myPen.Width=Amount6; double r = ((double)Amount8/100.00) * Math.Min(selection.Right - selection.Left , selection.Bottom - selection.Top)/6; DrawShapes(canvas, myBrush, myPen ,CenterX, CenterY , r , Amount7 , Amount4,Amount3,Amount5 ,Amount2 ,0); ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; dst[x,y] = CurrentPixel; } } }
- 1
-
- Popular Post
- Popular Post
Circle Fractal
(updated)
I was experimenting with c# and it occurred to me to write this simple Paint.NET plugin. With it , you can do shapes like these:
Let me know what you think.
- 10
-
For the first one , you can get Inksketch+ from my plugins (use the attachments) , and maybe use the built-in Median effect for more rounded edges.
For the second one, i believe there was a plugin called "Black and alpha" , search for it. it'd help .
-
That's really awesome .
i never expected such an awesome tool!
now i can't wait for PDN 4 ...
-
This is surly the best plugin for PDN ever , it's soo awesome .
I think this is the turn of PDN from normal to professional !
great job ,pyro !
-
Yeah, if I can get my color-averaging script to work...
CurrentPixel.R=(oldPixel.R+CurrentPixel.R)/2 CurrentPixel.G=(oldPixel.G+CurrentPixel.G)/2 CurrentPixel.B=(oldPixel.B+CurrentPixel.B)/2
?
edit that to fit your needs.
-
would someone please tell me what a grunge is ?
-
Yeah, there's an idea. Until I do that, you could do: 1. Duplicate layer 2. Apply Tint-Splitter 3. Adjust transparency of top layer
i know and you can do that directly in code lap btw
-
it's very useful , i liked it a lot !
it'd be much more awesome if you add an ' Effect mix slider ' , it'll help me to use it to clarify some images
thanks for your effort.
Ahmed.
-
if i were you , i'd start with a big size and use the Pen tool to draw everything as in reality .
after that you can go ahead and do some resizing , coloring , and antialiasing .
Ahmed.
-
i thought he was asking for Paint.NET resizing
-
just to clarify something:
Paint.NET has four ways of Resampling images when resizing .
I assume that you've used the 'Nearest neighbor' option , that option does no smoothing at all , it's used to have the image with all the pixels almost in their places.
if you want the result to be similar to the original , with the most smoothing , 'Best Quality' is your cup of tea :
Here is how the result would look if you use the 'Best Quality' option:
Hope that was helpful..
ps: i prefer your new one xD
Ahmed
-
Thankyou !
o'll sure give it a try later .
-
Unfortunately that has absolutely nothing in common with the multisampling algorithm which is configured via the "Quality" slider. (Fortunately that doesn't imply your idea is worthless or anything, that's not what I mean) What you describe is essentially a smoothing effect accomplished with post-processing, which reminds me a bit of FXAA or Quincunx. Multisampling works by gathering samples within the same pixel. Without it you get all the shimmering artifacts typically associated with Nearest Neighbor resampling when you shrink an image (and, in fact, they are the exact same thing).
wait , you meant smoothing works on each pixel ?
can you link me to a wikipedia topic, please ?
-
i was thinking of a close effect and wrote some pseudo code a while previously.
i'm happy to hear that pyrochild is working on this though ! .
-
if you need some simple smoothness effect you can simple pick the color of the surrounding pixels of each pixel and use the average as your pixel color .
this actually simulates Paint.NET's built-in Median effect , and it gives a nice smooth for your effects .
this might be coded like so:
ColorBgra CurrentPixel,pxl1,pxl2,pxl3,pxl4,pxl5,pxl6,pxl7,pxl8; CurrentPixel = src[x,y]; pxl1= src[Math.Min(x+1,rect.Right-1),y]; pxl2= src[Math.Max(x-1,rect.Left),y]; pxl3= src[x,Math.Min(y+1,rect.Bottom-1)]; pxl4= src[x,Math.Max(y-1,rect.Top)]; pxl5= src[Math.Min(x+1,rect.Right-1),Math.Min(y+1,rect.Bottom-1)]; pxl6= src[Math.Min(x+1,rect.Right-1),Math.Max(y-1,rect.Top)]; pxl7= src[Math.Max(x-1,rect.Left),Math.Min(y+1,rect.Bottom-1)]; pxl8= src[Math.Max(x-1,rect.Left),Math.Max(y-1,rect.Top)]; CurrentPixel.R=(byte)((CurrentPixel.R+pxl1.R+pxl2.R+pxl3.R+pxl4.R+pxl5.R+pxl6.R+pxl7.R+pxl8.R)/9); CurrentPixel.G=(byte)((CurrentPixel.G+pxl1.G+pxl2.G+pxl3.G+pxl4.G+pxl5.G+pxl6.G+pxl7.G+pxl8.G)/9); CurrentPixel.B=(byte)((CurrentPixel.B+pxl1.B+pxl2.B+pxl3.B+pxl4.B+pxl5.B+pxl6.B+pxl7.B+pxl8.B)/9);
Hope you find this helpful .
Ahmed.
-
I like the output .
-
i don't know if i commented here before , but anyways , your graphics are all awesome!
-
-
.Ahmed's Plugins.
Hello again !
This topic shall Contain all my PDN plugins or other additions .
Plugins:
You can download the .zip file that has them all :
(all the plugins are put in alphabetical order.)
Apply Color.dll: Effects----->Color------>Apply Color
a simple plugin that allows you to (Apply) a color to your image.
Example:
Cartoonize.dll: Effects----->Artistic------>Cartoonize
a plugin that turns realistic photos into cartoony style (with some simple dithering ).
Example:
Clarifaction+.dll: Effects----->Photo------>Clarifaction+
a plugin to clarify your image.
Example:
InkSketch+.dll: Effects----->Artistic------>InkSketch+
an artistic effect that redraws your image as if drawn with ink.
Example:
Posterize+.dll: Adjustment----->Posterize+
a very useful, customizable effect , it allows you to limit the output of any channel , including HSV , RGB !
Example:
Quick Gravity.dll: Effects----->Distort------>Quick Gravity
a quick effect that will drag your image down while stretching it , giving it a gravity effect .
Example:
Vibration.dll: Effects----->Distort------>Vibration.
an effect that well blur and then thick the insides of your image , gives a nice vibration effect.
Example:
------------------------------------------------------------------------------------------------------------------------------------------------------------ -- --------
If you need the source of any of my plugins , please PM me !
if you have a plugin suggestion , please write it down here .
please report any errors in this topic.
Thanks for passing by!
Ahmed.
- 1
- 3
-
it's nice but it's only dithering the top 26 pixels
-
here is mine (quick made)
[Original Image]
[Clone]
[Motion Effect] (Put this as final image, please)
Ahmed.
-
i've seen the images in your link.
i can't tell that all these are just basic 2D art.
it's possibly first built in a 3D rendering program such as Blender , or some images of actual buildings has been added .
-
i don't think you do have a reason for that do you ?
but anyways , if you really need it , you may save as jpg or dds .
yet again i'm confuzed on why you would need that
Ahmed.
'ZIP Archive' FileType Plugin (.ZIP) [Latest v1.4 2021-11-04]
in FileType Plugins
Posted
This plugin is very useful! Thank you, I appreciate your effort.