Jump to content

Feature request: Pixel stretch


Recommended Posts

Do you want to make an animation, or do you just want to stretch pixels? Its easy to strech pixels, just make a selection that is the entire height of the image and only a few pixels wide(between 1-10ish). Then use the "Move Selected Pixels" tool to strech the selection from either the right or left side.

 

Take responsibility for your own intelligence. ;) -Rick Brewster

Link to comment
Share on other sites

Get the picture you want to stretch (say half an eye like in the demo).

Paste it into an empty image that is wider than it is and align it to the left.

Then either:

Use square selection box to hilight the right hand side of the pasted image to a width of 1 pixel and use the Move Selection tool to stretch the selected area all the way to the right (as stated above)

or

Use selection tool to select everythign to the right of the image and 1 pixel width of the right of the image and use motion blur

Link to comment
Share on other sites

Try this in the Code Lab...

void Render(Surface dst, Surface src, Rectangle rect)
{
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           ColorBgra pix = src[0, y];
           dst[x, y] = pix;
       }
   }
}

Is that what you were looking for?

Link to comment
Share on other sites

nope. only the first column of pix's are stretched...
try this one and modify start to you liking:

const int start = 0;

void Render(Surface dst, Surface src, Rectangle rect)
{
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           if (x < start)
           {
               dst[x, y] = src[x, y];
           }
           else
           {
               dst[x, y] = src[start, y];
           }
       }
   }
} 

(boy is my c# bad :?)

edit: 2 posts in between :?

however... you mean, you want a not-straight starting line for your pixel stretch?

edit2: sepcots one below looks nice :wink:

Link to comment
Share on other sites

but i said i didn't simply wanted that, i want to stretch the last pixel of each row that doesn't have Alpha = 0

My bad trickman, is this more of what you are looking for?

void Render(Surface dst, Surface src, Rectangle rect)
{
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
           if (x > 0) dst[x, y] = (0 == src[x,y].A) ? dst[x-1, y] : src[x, y]; 
       }
   }
}

Link to comment
Share on other sites

Not sure how the PnD plugins work but I think to get the effect you would have to go along each horizontal row until you find the last pixel that is no transparent (or a specified colour). Then take that colour and fill in the rest of the row using it. Once you've filled in the rest of the row drop down a row and repeat with the next row. and so on and so forth.

Might even be easier to go from right to left, keeping count of the number of empty pixels, and then when you find a non-empty pixel get the colour of it and fill in x number of pixels with that colour where x is the number of pixels you've just counted.

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