Changeset 11648
- Timestamp:
- 2006-04-12T09:33:14+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/java/org/nzdl/gsdl/GsdlCollageApplet/DisplayImages.java
r11572 r11648 146 146 next_frame_ = new Thread(new Runnable(){ 147 147 public void run() { 148 try { 149 150 Thread curr_thread = Thread.currentThread(); 151 152 while (curr_thread == next_frame_) { 153 next_frame(); 154 155 Thread.sleep(app_. refreshDelay_); 156 curr_thread = Thread.currentThread(); 148 149 Thread curr_thread = Thread.currentThread(); 150 151 while (curr_thread == next_frame_) { 152 try { 153 next_frame(); 154 Thread.sleep(app_. refreshDelay_); 155 curr_thread = Thread.currentThread(); 156 } catch (Exception e) { 157 break; 157 158 } 158 159 160 } catch (Exception e) {161 e.printStackTrace();162 159 } 160 161 163 162 } 164 163 … … 175 174 * @param y the y co-ordinate of the mouse 176 175 * @return the image that the user has clicked on or null if the user has clicked whitespace */ 177 public synchronizedCollageImage clickedOnImage(int x, int y)176 public CollageImage clickedOnImage(int x, int y) 178 177 { 179 178 if (app_.verbosity() > 1) … … 182 181 } 183 182 184 int no_images = inuse_.size() - 1;183 185 184 // checks from last image down, as last images place will be at the top of the collage 186 for (int i= no_images; i >= 0; i--)185 for (int i= inuse_.size() - 1; i >= 0; i--) 187 186 { 188 187 CollageImage collage_image = (CollageImage)inuse_.elementAt(i); … … 256 255 = restoreAlpha(collage_image.image_, 0, 0, 257 256 collage_image.image_x_dim_, collage_image.image_y_dim_); 258 257 259 258 } 260 259 … … 266 265 { 267 266 268 269 267 // conducts fading and colouring of image 270 268 Image img = handlepixels(collage_image.image_, 0, 0, collage_image.image_x_dim_, … … 512 510 public Image handlepixels(Image img, int x, int y, int w, int h, int p, boolean fresh) { 513 511 512 514 513 // declare an array to hold the pixels 515 514 int[] pixels = new int[w * h]; … … 536 535 else 537 536 bound *= h; 537 538 538 int upperboundheight = h - (int) bound; 539 539 int upperboundwidth = w - (int) bound; 540 540 int lowerbound = (int) bound; 541 541 542 // loop through every pixel in the picture and handle it542 // loop through every pixel in the picture and handle it 543 543 for (int j = lowerbound; j < upperboundheight; j++) { 544 544 for (int i = lowerbound; i < upperboundwidth; i++) { … … 558 558 fader = 0; 559 559 560 for (int m = 0; m < w; m++) 561 pixels[n * w + m] = handlesinglepixel(pixels[n * w + m], p, fresh, true, fader); 560 for (int m = 0; m < w; m++){ 561 int index = n* w + m; 562 if (index <pixels.length){ 563 pixels[index] = handlesinglepixel(pixels[index], p, fresh, true, fader); 564 565 } 566 } 567 568 562 569 563 570 fade+= FADEVALUE; … … 570 577 if (fader < 0) 571 578 fader = 0; 572 for (int m = 0; m < w; m++) 573 pixels[n * w + m] = handlesinglepixel(pixels[n * w + m], p, fresh, true, fader); 579 for (int m = 0; m < w; m++){ 580 int index = n * w + m; 581 if (index <pixels.length){ 582 pixels[index] = handlesinglepixel(pixels[index], p, fresh, true, fader); 583 584 } 585 } 574 586 575 587 fade += FADEVALUE; … … 585 597 if ( m < lowerbound && n > m); 586 598 else if ( m > upperboundheight && n > (h - m)); 587 else 588 pixels[m * w + n] = handlesinglepixel(pixels[m * w + n], p, fresh, true, fader); 599 else { 600 int index = m * w + n; 601 if (index <pixels.length){ 602 pixels[index] = handlesinglepixel(pixels[index], p, fresh, true, fader); 603 604 } 605 } 606 589 607 } 590 608 fade += FADEVALUE; … … 600 618 if ( m < lowerbound && (w - n) > m); 601 619 else if ( m > upperboundheight && (w - n) > (h - m)); 602 else 603 pixels[m * w + n] = handlesinglepixel(pixels[m * w + n], p, fresh, true, fader); 620 else { 621 int index = m * w + n; 622 if (index <pixels.length){ 623 pixels[index] = handlesinglepixel(pixels[index], p, fresh, true, fader); 624 625 } 626 } 627 604 628 } 605 629 … … 694 718 int corealpha = (pixels[(h/2) * w + (w/2)] >> 24) & 0xff; 695 719 696 if (corealpha < 2)720 if (corealpha < 10) 697 721 return true; 698 722 … … 792 816 793 817 } catch (Exception e) { 794 //e.printStackTrace();818 e.printStackTrace(); 795 819 System.out.println("Display images thread is interrupted"); 796 820 }
Note:
See TracChangeset
for help on using the changeset viewer.