toe_head2001 Posted February 25, 2015 Share Posted February 25, 2015 (edited) Screen Pixel This is an update to @Bleek II's ScreenPixel plugin. See changelog below. Effects -> Distort -> Screen Pixel Features Takes a image and breaks it into RGB components. Control the opacity of the RGB Automatically apply correct (3x) pixelation cell size. (e.g. if your RBG size is 2, a pixelation amount of 6 will be applied) Changelog v1.1 by toe_head2001 (Feb 24, 2015) New: added the ability to reduce the opacity from 255; defaults at 100. New: Pixelation is now built in, and can be toggled. Pixelation size automatically increases with RBG size. New: Metadata was added for the 'Plugin Browser' v1.0 by Bleek II (March 28, 2008) Initial release Download ScreenPixel.zip Source Code https://github.com/toehead2001/pdn-screen-pixel Spoiler <--- Icon // Name: Screen Pixel // Submenu: Distort // Author: Bleek II & toe_head2001 // Title: // Version: 1.1 // Desc: Breaks images into their RGB components // Keywords: subpixel|rgb|screen // URL: https://forums.getpaint.net/index.php?showtopic=31570 // Help: #region UICode IntSliderControl Amount1 = 1; // [1,33] Size IntSliderControl Amount2 = 100; // [0,255] Opacity CheckboxControl Amount3 = true; // [0,1] Use Pixelation #endregion readonly BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal); readonly PixelateEffect pixelateEffect = new PixelateEffect(); PropertyCollection pixelateProps; void PreRender(Surface dst, Surface src) { if (Amount3) { int cellAmount = Amount1 * 3; pixelateProps = pixelateEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps); pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellAmount); pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src)); } } void Render(Surface dst, Surface src, Rectangle rect) { if (Amount3) { pixelateEffect.Render(new Rectangle[1] { rect }, 0, 1); } int size = Amount1 * 3; int cy, cx, y1, x1; ColorBgra OriginalImage; ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y = y + size) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x = x + size) { OriginalImage = (Amount3) ? dst[x, y] : src[x, y]; CurrentPixel = (Amount3) ? dst[x, y] : src[x, y]; CurrentPixel.A = (byte)Amount2; CurrentPixel.G = 0; CurrentPixel.B = 0; for (cy = 0; cy < size; cy++) { for (cx = 0; cx < (size / 3); cx++) { x1 = x + cx; y1 = y + cy; if (x1 < rect.Right) { if (y1 < rect.Bottom) { dst[x1, y1] = normalOp.Apply(OriginalImage, CurrentPixel); } } } } CurrentPixel.G = (byte)src[x, y]; CurrentPixel.R = 0; for (cy = 0; cy < size; cy++) { for (cx = (size / 3); cx < (2 * (size / 3)); cx++) { x1 = x + cx; y1 = y + cy; if (x1 < rect.Right) { if (y1 < rect.Bottom) { dst[x1, y1] = normalOp.Apply(OriginalImage, CurrentPixel); } } } } CurrentPixel.B = (byte)src[x, y]; CurrentPixel.G = 0; for (cy = 0; cy < size; cy++) { for (cx = (2 * (size / 3)); cx < size; cx++) { x1 = x + cx; y1 = y + cy; if (x1 < rect.Right) { if (y1 < rect.Bottom) { dst[x1, y1] = normalOp.Apply(OriginalImage, CurrentPixel); } } } } } } } Edited January 14, 2018 by toe_head2001 2 Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Seerose Posted February 25, 2015 Share Posted February 25, 2015 @toe_head2001! Thank you very much. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi Link to comment Share on other sites More sharing options...
Maximilian Posted October 23, 2015 Share Posted October 23, 2015 Took the liberty to make a small change in order to compile in CodeLab 1.8 From this: private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal); to this: private UserBlendOp normalOp = new UserBlendOps.NormalBlendOp(); Thanks for the source code, it's a very nice-looking effect. Screen Pixel v1.1 for PdN 3.5.11.zip 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.