< prev index next >

src/demo/share/jfc/J2Ddemo/java2d/demos/Images/JPEGFlip.java

Print this page


   1 /*
   2  *
   3  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms, with or without
   6  * modification, are permitted provided that the following conditions
   7  * are met:
   8  *
   9  *   - Redistributions of source code must retain the above copyright
  10  *     notice, this list of conditions and the following disclaimer.
  11  *
  12  *   - Redistributions in binary form must reproduce the above copyright
  13  *     notice, this list of conditions and the following disclaimer in the
  14  *     documentation and/or other materials provided with the distribution.
  15  *
  16  *   - Neither the name of Oracle nor the names of its
  17  *     contributors may be used to endorse or promote products derived
  18  *     from this software without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  21  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 159                     in.close();
 160                 } catch (IOException ex) {
 161                     Logger.getLogger(JPEGFlip.class.getName()).log(Level.SEVERE,
 162                             null, ex);
 163                 }
 164             }
 165         }
 166 
 167         if (bi1 == null) {
 168             g2.setColor(RED);
 169             g2.drawString("Error reading the image", 5, hh * 2 - 5);
 170             return;
 171         }
 172 
 173         g2.drawImage(bi1, w, hh * 2, -w, -hh, null);
 174 
 175         g2.drawString("JPEGImage Flipped", 4, hh * 2 - 4);
 176         g2.drawLine(0, hh, w, hh);
 177     }
 178 
 179     public static void main(String s[]) {
 180         createDemoFrame(new JPEGFlip());
 181     }
 182 }
   1 /*
   2  *
   3  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms, with or without
   6  * modification, are permitted provided that the following conditions
   7  * are met:
   8  *
   9  *   - Redistributions of source code must retain the above copyright
  10  *     notice, this list of conditions and the following disclaimer.
  11  *
  12  *   - Redistributions in binary form must reproduce the above copyright
  13  *     notice, this list of conditions and the following disclaimer in the
  14  *     documentation and/or other materials provided with the distribution.
  15  *
  16  *   - Neither the name of Oracle nor the names of its
  17  *     contributors may be used to endorse or promote products derived
  18  *     from this software without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  21  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 159                     in.close();
 160                 } catch (IOException ex) {
 161                     Logger.getLogger(JPEGFlip.class.getName()).log(Level.SEVERE,
 162                             null, ex);
 163                 }
 164             }
 165         }
 166 
 167         if (bi1 == null) {
 168             g2.setColor(RED);
 169             g2.drawString("Error reading the image", 5, hh * 2 - 5);
 170             return;
 171         }
 172 
 173         g2.drawImage(bi1, w, hh * 2, -w, -hh, null);
 174 
 175         g2.drawString("JPEGImage Flipped", 4, hh * 2 - 4);
 176         g2.drawLine(0, hh, w, hh);
 177     }
 178 
 179     public static void main(String[] s) {
 180         createDemoFrame(new JPEGFlip());
 181     }
 182 }
< prev index next >