I have a project that involves shifting a single row of pixels over and having them wrap around, kinda like the Move tool on Wrap mode but with just one row/column of pixels. Is this do-able?
Or hey, if it's simpler, maybe just a Wrapper that only applies to a selected area, that would do the same thing and much more!
Id help but don't really get what you want.
Is it something like...
You have a width of 100 pixels
You want to move one column, lets say x position 57
You want to say how many x positions to move across
And if that goes after 100 to wrap around
So if you said move across 50 it would end up at 7?
And all the other stays where they are, so 7 gets replaced by 57 and 57 is now empty
If thats not it then your going to have to explain better, if thats it just say, thats easy enough.
That's not quite right... What I had in mind was more like cutting it, sliding it over, and pasting into the gap. Like... uh...
shifting the top row 2 pixels might look like...
123456 -> | 345612 |
789012 | 789012 |
...except colors instead of numbers. Does that make any sense?
I can't make it look right...
well thats simple
Configuration
Configuration.AddEditBox("row", "Row", "Row to shift", 0);
Configuration.AddEditBox("shift", "Shift Amount", "May be a negative number to shift to the left", 0);
Execution
var dest = Document.RasterImage;
var width = dest.sizeX;
var height = dest.sizeY;
var clone;
clone = Document.Duplicate();
clone = clone.RasterImage;
var row = Configuration.row;
var shift = Configuration.shift * -1;
var srcX;
for (var x = 0; x < width; x++) {
srcX = x + shift;
while (srcX < 0 || srcX >= width) {
if (srcX < 0) srcX = width + srcX;
else srcX = srcX - width;
}
c = clone.getPixel(srcX, row, 0, 0);
dest.setPixel(x, row, 0, 0, c);
}
Great! Thank you so much! Perfect!
One more question, what piece of code would I edit to change it from "shift row" to "shift column" mode, and what would I swap it with? I don't mind messing with code myself if I know what I'm doing but I don't know what I'm doing.
Oh, and how does someone make a RWCommands file, by the way? Vlasta made a few that I borrowed but I didn't figure it out.