コード例 #1
0
ファイル: ImagePanel.java プロジェクト: TheSpuc/workspaces
 /**
  * Set the image that this panel should show.
  *
  * @param image The image to be displayed.
  */
 public void setImage(OFImage image) {
   if (image != null) {
     width = image.getWidth();
     height = image.getHeight();
     panelImage = image;
     repaint();
   }
 }
コード例 #2
0
 /**
  * Apply this filter to an image.
  *
  * @param image The image to be changed by this filter.
  */
 public void apply(OFImage image) {
   int height = image.getHeight();
   int width = image.getWidth();
   for (int y = 0; y < height; y++) {
     for (int x = 0; x < width / 2; x++) {
       Color left = image.getPixel(x, y);
       image.setPixel(x, y, image.getPixel(width - 1 - x, y));
       image.setPixel(width - 1 - x, y, left);
     }
   }
 }