Jump to content

Is it possible to select random pixels?


Recommended Posts

The title pretty much says it all. Can you select random pixels from an image? The reason I'm asking is because I'm working on a plugin that dissolves one image onto another. I got it working with a lot of help from Simon Brown, but I'm not really satisfied with the effect it gives. So if it is possible, could you please post an example on what I should do. Thanks in advance. :D

Link to comment
Share on other sites

Well, I looked at your code example, but I'm not sure if it is of any use to me. I assume the part of the code your talking about was this:

if (RandomNumber.Next(255) > 128)
        {
           CurrentPixel = Amount1;
        }

Maybe I'm just not looking at it right, but what I'm trying to do is select a certain number of pixels randomly from a pre-existing image based on an amount the user put in.

Link to comment
Share on other sites

Just one second thought:

In EffectPlugin.cs:

Find:

public EffectPlugin()
           : base(EffectPlugin.StaticName, EffectPlugin.StaticIcon, EffectPlugin.StaticSubMenuName,
           EffectFlags.Configurable | EffectFlags.SingleThreaded)
       {
           rand = new Random();
       }

Replace with:

public EffectPlugin()
           : base(EffectPlugin.StaticName, EffectPlugin.StaticIcon, EffectPlugin.StaticSubMenuName,
           EffectFlags.Configurable | EffectFlags.SingleThreaded)
       {

       }

Find:

static Random rand;

Replace with:

static Random rand;

       protected override void OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
       {
           rand = new Random();
       }

KaHuc.png
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.

 Share

×
×
  • Create New...