Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Perform Cut Paste operations on the image*/
- IMAGE* CutPaste( IMAGE *image,
- unsigned int startX,
- unsigned int startY,
- unsigned int x_width,
- unsigned int y_width, unsigned int pasteNumber)
- {
- unsigned char baseR[image->Width][image->Height];
- unsigned char baseG[image->Width][image->Height];
- unsigned char baseB[image->Width][image->Height];
- int x, y, n;
- for(x = startX ; x < startX + image->Width ; x++){
- for(y = startY ; y < startY + image->Height ; y++){
- baseR[x-startX][y-startY] = GetPixelR(image,x,y);
- baseG[x-startX][y-startY] = GetPixelG(image,x,y);
- baseB[x-startX][y-startY] = GetPixelB(image,x,y);
- }
- }
- for( n = 1; n <= pasteNumber ; n++){
- unsigned int pasteX, pasteY;
- #ifdef DEBUG
- switch(n)
- {
- case 1:
- pasteX = 341;
- pasteY = 19;
- break;
- case 2:
- pasteX = 315;
- pasteY = 18;
- break;
- case 3:
- pasteX = 288;
- pasteY = 16;
- break;
- default:
- break;
- }
- #else
- printf("Please input start x and y coordinates for paste no %d: ", n);
- scanf("%u %u", &pasteX, &pasteY);
- #endif /* DEBUG */
- for(x = 0 ; x < image->Width ; x++){
- for(y = 0 ; y < image->Height ; y++){
- SetPixelR(image,x+pasteX,y+pasteY,baseR[x][y]);
- SetPixelG(image,x+pasteX,y+pasteY,baseG[x][y]);
- SetPixelB(image,x+pasteX,y+pasteY,baseB[x][y]);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement