Jump to content

Clipboard flood fill plugin?


Recommended Posts

I'm new here so sorry if I'm posting in the wrong forum section, I didn't see any section for plugins. 

 

What I'm looking for is a plugin that essentially will allow me to copy an image such as a texture I drew and be able to fill it in to fit a selected area. Now to be clear I am not talking about tiling it, I want it the texture to conform to the shape of the selected area. In a sense a fill plugin that will allow me to flood fill my clipboard into the shape of my selected area. Does this already exist? If not can it please?

Thank you.

Link to comment
Share on other sites

You can use Boltbai's Fill from file or Fill from clipboard effect. Just make your selection and run it.

I've tried using that it does not do what I'm talking about. That tiles the clipboard I don't want it to tile. I want it to paste into the selected area and conform into the shape of what I selected, similar to how the paintbucket simple conforms to the area you put the color in. 

Edited by acoustichead
Link to comment
Share on other sites

I am not sure what you want to achieve. Can you post an example of what you want to achieve?

 

Perhaps using the Alpha mask effect can help you.

Ok say I have this empty area in a sorta odd shape and I had this texture i drew on the left. I want to fill that exact texture into that transparent area and have it take on the shape it is.

18d194d150.png

Now to do this I would have to put it into the shape and drag my select tool across it by each level of the shape pixel by pixel increments and drag it over to re-size it to shape. I am not looking for something that will simply turn it into a circle or square I am looking to be able to copy a texture or pattern and easily paste it to conform and bend into the shape on the right in a flood fill like manner. The result here would be this. 

4e0f0732bb.png

Edited by acoustichead
Link to comment
Share on other sites

I do not know of an effect that will fill a shape inside another shape and follow the contours of the last one. However, if all you want to do is to fill the shape with some gradients, you can use TR's Contour filler and then soften it with Gaussian blur

trscontourfiller-4dadd72.png

Link to comment
Share on other sites

I do not know of an effect that will fill a shape inside another shape and follow the contours of the last one. However, if all you want to do is to fill the shape with some gradients, you can use TR's Contour filler and then soften it with Gaussian blur

trscontourfiller-4dadd72.png

Not what I was looking for but thanks for the help nonetheless.  :) . I really needed it to be for specific clipboard textures but oh well. 

Link to comment
Share on other sites

I don't think that plugin does anything more than superimpose one image over another.  As I interpret acoustichead's request, it's for a plugin that spacially distorts the image to fit into the selection. I'm not sure the goal is well-defined enough to implement as a plugin for anything but trivial cases, and perhaps not even for that. It appears to me that in the example given, the pattern is compressed in the X direction to fit the selection, and would look different if it were compressed in the Y direction instead.

 

EDIT: I can see a simple algorithm for mapping a rectangular region to a convex region. For any point in the convex region, compute the rectangle's X coordinate based on the proportion of the distance between the convex region's left and right boundaries at the Y value, and the Y coordinate based on the proportion of the distance between the upper and lower boundaries at the X value. In other words, bilinear interpolation based on the convex region's current X row and Y column. This could be extended to map a convex region to another convex region by essentially first mapping the source convex region to a rectangle, using the same idea.

Edited by MJW
Link to comment
Share on other sites

Midora made something along those lines ... I can't find the thread but do have the codelab code. I've just named it "MidorasStretchObjectSideToSides". (All his work, not mine).
Could be relevant if adapted?

//Midora's stretch object to edges


void Render(Surface dst, Surface src, Rectangle rect)
{
    float CenterX = src.Width / 2f;

    // for each row
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        int x;

        // Determine the number of transparent pixels on the left side
        // Determine the scale factor which is (opaque pixels / max pixels)
        for (x = 0; x < CenterX; x++) 
        {
            if (src[x,y].A == 255) break;
        }
        float lScale = (CenterX - x) / CenterX;

        // Same for the right side
        for (x = src.Width - 1; x >= CenterX; x--)
        {
            if (src[x,y].A == 255) break;
        }
        float rScale = (x - CenterX) / CenterX;
        
        // Render the pixels of the row
        for (x = rect.Left; x < rect.Right; x++)
        {
            if (x < CenterX)
            {
                dst[x,y] = src.GetBilinearSample(CenterX - ((CenterX - x) * lScale),y);
            }
            else
            {
                dst[x,y] = src.GetBilinearSample(CenterX + ((x - CenterX) * rScale),y);
            }
        }
    }
}

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Link to comment
Share on other sites

Perhaps the seamless texture helper plugin used with boltbaits fill plugin can help you. Although his fill plugin tiles, you might be able to play with the tiling enough to where you get something that is OK.

http://forums.getpaint.net/index.php?/topic/2244-seamless-texture-helper-plugin/
(note, the texture plugin page links to a different fill plugin, but that fill plugin doesn't work anymore. So just try boltbait's instead.)

Edited by Cc4FuzzyHuggles
Link to comment
Share on other sites

I don't think that plugin does anything more than superimpose one image over another.  As I interpret acoustichead's request, it's for a plugin that spacially distorts the image to fit into the selection. I'm not sure the goal is well-defined enough to implement as a plugin for anything but trivial cases, and perhaps not even for that. It appears to me that in the example given, the pattern is compressed in the X direction to fit the selection, and would look different if it were compressed in the Y direction instead.

 

EDIT: I can see a simple algorithm for mapping a rectangular region to a convex region. For any point in the convex region, compute the rectangle's X coordinate based on the proportion of the distance between the convex region's left and right boundaries at the Y value, and the Y coordinate based on the proportion of the distance between the upper and lower boundaries at the X value. In other words, bilinear interpolation based on the convex region's current X row and Y column. This could be extended to map a convex region to another convex region by essentially first mapping the source convex region to a rectangle, using the same idea.

You are 100% correct with what you're understanding from what I wrote. I do want it to intentionally distort the image to fit the space selected when pasted in. I really need to thank you all I had no idea the forums here were so welcoming and helpful  :). This is exactly what I was looking for! http://forums.getpaint.net/index.php?/topic/28298-trs-paste-warp/ Thank you all so much!

Edited by acoustichead
  • Upvote 1
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...