Results 1 to 3 of 3
- 11-03-2009, 04:39 PM #1
How can I square(^2) the pic in the grid
How can I square(^2) the pic in the grid?
my code give the following result:XML Code:public Picture makeGrid(int size) { Picture targetPicture = new Picture(this.getWidth()*size, this.getHeight()*size); Pixel sourcePixel = null; Pixel targetPixel = null; int targetX = 0; int targetY = 0; //loop through the source picture columns for(int sourceX = 0; sourceX < this.getWidth(); sourceX++) { //loop through the source picture rows for(int sourceY = 0; sourceY < this.getHeight(); sourceY++) { // get the source pixel sourcePixel = this.getPixel(sourceX,sourceY); // loop copying to the target y for(int indexY = 0; indexY <size; indexY++) { // loop copying to the target x for(int indexX = 0; indexX < size; indexX++) { targetX = sourceX + size*2 + indexX; targetY = sourceY + size*2 + indexY; targetPixel =targetPicture.getPixel(targetX, targetY); targetPixel.setColor(sourcePixel.getColor()); } } } } return targetPicture; }
for makeGrid(2)
for makeGrid(3)
But the code should work like this as show:

How can I square(^2) the pic in the grid-cater.jpg
I just want to know how to multiply image ...
I dont know how can I square the pic
I am new to java
Chris
thx
-
Poster: you've not replied to any replies to your three past posts/threads.
- 11-03-2009, 05:27 PM #3
Similar Threads
-
How can I square(^2) the pic in the grid
By racewithferrari in forum New To JavaReplies: 1Last Post: 11-01-2009, 10:16 PM -
Display Square Roots
By hypes057 in forum New To JavaReplies: 8Last Post: 08-25-2009, 10:34 AM -
change the square to triangle java
By anotsu in forum New To JavaReplies: 3Last Post: 07-09-2009, 11:17 AM -
Simple square root problem!
By nortski in forum New To JavaReplies: 7Last Post: 04-01-2009, 02:11 PM -
8-Square puzzle loop
By SapphireSpark in forum New To JavaReplies: 7Last Post: 12-04-2008, 07:21 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks