toe_head2001

Screen Pixel v1.1 (Feb 24, 2015)

Recommended Posts

Screen Pixel

This is an update to @Bleek II's ScreenPixel plugin. See changelog below.

 

Effects -> Distort -> Screen Pixel

 

ui.png

before.jpg

after.jpg

 

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

:RightArrowBlue:  ScreenPixel.zip

 

Source Code

https://github.com/toehead2001/pdn-screen-pixel

 

Spoiler

ScreenPixel.png<--- 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: http://www.getpaint.net/redirect/plugins.html
// Help:
#region UICode
int Amount1 = 1; // [1,33] Size
int Amount2 = 100; // [0,255] Opacity
bool Amount3 = true; // [0,1] Use Pixelation
#endregion

private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal);

void Render(Surface dst, Surface src, Rectangle rect)
{
    if (Amount3)
    {
        int cellAmount = Amount1 * 3;
        PixelateEffect pixelateEffect = new PixelateEffect();
        PropertyCollection pixelateProps = pixelateEffect.CreatePropertyCollection();
        PropertyBasedEffectConfigToken pixelateParameters = new PropertyBasedEffectConfigToken(pixelateProps);
        pixelateParameters.SetPropertyValue(PixelateEffect.PropertyNames.CellSize, cellAmount);
        pixelateEffect.SetRenderInfo(pixelateParameters, new RenderArgs(dst), new RenderArgs(src));
        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 by toe_head2001
  • Upvote 2

Share this post


Link to post
Share on other sites

Screen%20Pixel%20test_zpshbkiojgv.jpg

 

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now