Jump to content
How to Install Plugins ×

Seamless Move (3rd Nov 2012)


davidf

Recommended Posts

Effects > Distort > Seamless Move

Note: it turns out this plugin is fairly redundant (see posts below), so feel free to ignore!

This is a small plugin to help create seamless images: it lets you scroll an image around, wrapping around the left & right and top & bottom of the image.

For an alternative, see the Seamless Texture Maker plugin (which does something similar to this with the "only cut" option, but with no scrolling): http://forums.getpai...?showtopic=4591.

seamless_move.jpg

The parameters are:

Position - drag to change the center of the image.

Fine tune X / Y - pixel perfect X and Y adjustment.

The CodeLab code is very short:

#region UICode
Pair<double, double> Amount1 = Pair.Create( 0.0 , 0.0 ); // Position
int Amount2 = 0; // [-100,100] Fine tune X
int Amount3 = 0; // [-100,100] Fine tune Y
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
int w = src.Bounds.Width;
int h = src.Bounds.Height;
int dx = -((int) (Amount1.First * 0.5 * w) + Amount2);
int dy = -((int) (Amount1.Second * 0.5 * h) + Amount3);

for (int y = rect.Top; y < rect.Bottom; y++)
{
	int ypos = (y + dy) % h;
	if (ypos < 0) { ypos += h; }

	for (int x = rect.Left; x < rect.Right; x++)
	{
		int xpos = (x + dx) % w;
		if (xpos < 0) { xpos += w; }

		dst[x,y] = src[xpos,ypos];
	}
}
}

One problem is that there is no obvious way to reset the parameters to all zero when the effect is restarted; it always remembers the parameter values last used, which is not really appropriate for this particular plugin.

Anyone know of a way to do this (within either CodeLab or a Visual Studio project)?

Download: SeamlessMove.zip

Edited by davidf
Link to comment
Share on other sites

Well, don't feel bad. I've been around almost from the beginning and even I don't know them all.

You might want to download the Plugin Index and do a quick search before starting a plugin.

We typically don't mind someone making improvements to existing plugins. But, exact duplicates are somewhat frowned upon. There are some people around here that download EVERY plugin!

FWIW, I've been enjoying your plugins so far. I've got my eye on you. ;)

You want to tackle something tough? How about a "seam carving" canvas plugin? :D

Link to comment
Share on other sites

FWIW, I've been enjoying your plugins so far. I've got my eye on you. ;)

Thanks!

You want to tackle something tough? How about a "seam carving" canvas plugin? :D

I'm already on something at the moment ... it's a surprise, though :smile:

It'll take a few more days (and then another few days to add the extra features I've thought of by then ...)

Is there a general area where people post ideas or requests for plugins, by the way? Or is that just mixed in with the other forums?

Edited by davidf
Link to comment
Share on other sites

Us mods typically move plugin requests to the General Discussion forum.

If you want to post plugin ideas, questions about development, and rough versions of plugins, etc. try here: http://forums.getpaint.net/index.php?/forum/17-plugin-developers-central/

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