Jump to content
How to Install Plugins ×

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: 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 by toe_head2001
  • Upvote 2

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 7 months later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...