ccsaver/0000755000175000001440000000000010062411261013503 5ustar nyerglerusers00000000000000ccsaver/.project0000644000175000001440000000055610061614545015171 0ustar nyerglerusers00000000000000 ccsaver org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature ccsaver/src/0000755000175000001440000000000010062402145014273 5ustar nyerglerusers00000000000000ccsaver/src/java/0000755000175000001440000000000010062411212015207 5ustar nyerglerusers00000000000000ccsaver/src/java/CcSaver.java0000644000175000001440000000710010062405765017416 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * Sample JDIC SaverBeans screen saver which displays random, Creative Commons * licensed images. */ import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.concurrent.ArrayBlockingQueue; import javax.imageio.ImageIO; import org.jdesktop.jdic.screensaver.ScreensaverSettings; import org.jdesktop.jdic.screensaver.SimpleScreensaver; /** * @author Nathan R. Yergler */ public class CcSaver extends SimpleScreensaver { private UrlTaskFactory taskFactory; private ArrayBlockingQueue urlQueue; public void init() { // set up the timer for switching images ScreensaverSettings settings = getContext().getSettings(); long interval = 30 * 1000; try { interval = Long.getLong(settings.getProperty("interval")).longValue() * 1000; } catch (Exception e){ } // instantiate the URL queue and retrieval timers this.urlQueue = new ArrayBlockingQueue(10); this.taskFactory = new UrlTaskFactory(interval, this.urlQueue); // show the CC logo while we load up the first image this.urlQueue.offer(this.loadImage("/cc.jpg")); // create the first task this.taskFactory.newTask(UrlTaskFactory.NOW); } // init public Image loadImage(String path) { Image imageData = null; try { InputStream in = getClass().getResourceAsStream(path); imageData = ImageIO.read(in); in.close(); imageData.flush(); } catch (IOException e) { e.printStackTrace(); } return imageData; } public Image loadImage(URL imageUrl) { // Open composite image (can be created with Skinner) Image compositeImage = null; try { InputStream in = imageUrl.openStream(); compositeImage = ImageIO.read( in ); in.close(); compositeImage.flush(); } catch( IOException e ) { e.printStackTrace(); } return compositeImage; } // loadImage public void paint(Graphics g) { Image currImage = null; // see if there is a URL in the queue if (this.urlQueue.isEmpty()) { // no items exist, bail out return; } Object qObj = this.urlQueue.remove(); if (qObj instanceof URL) { // load the image to draw currImage = loadImage((URL)qObj); } else if (qObj instanceof Image) { currImage = (Image)qObj; } else { // not an Image or URL return; } this.paintImage(g, currImage); // schedule the next URL retrieval this.taskFactory.newTask(); } // paint public void paintImage(Graphics g, Image paintImage) { Graphics2D g2 = (Graphics2D) g; Component c = getContext().getComponent(); Dimension d = c.getSize(); // Clears the previously drawn image. g2.setColor(Color.white); g2.fillRect(0, 0, d.width, d.height); // Creates the buffered image. int w = d.width; int h = d.height; BufferedImage buffImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D gbi = buffImg.createGraphics(); gbi.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); // calculate the position of the image (currently centered) int img_x = (w - paintImage.getWidth(null)) / 2; int img_y = (h - paintImage.getHeight(null)) / 2; ((Graphics)gbi).drawImage(paintImage, img_x, img_y, null); // Draws the buffered image. g2.drawImage(buffImg, null, 0, 0); } // paintImage } ccsaver/src/java/UrlSource.java0000644000175000001440000000123010062332567020010 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * UrlSource.java * $Id:$ */ import java.net.MalformedURLException; import java.net.URL; import java.util.Random; public abstract class UrlSource { protected int MAX_ID=23044; protected Random randNums = new Random(); public UrlSource() { // stub constructor super(); } // nextUrlString: sub-classes must implement protected abstract String nextUrlString(); public URL nextUrl() { try { return new URL(this.nextUrlString()); } catch (MalformedURLException e) { return null; } } // nextUrl } // UrlSource ccsaver/src/java/UrlTimerTask.java0000644000175000001440000000153410062332170020450 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * UrlTimerTask.java * $Id:$ * Implements a java.util.TimerTask sub-class which retrieves an image URL from a random * source when called. */ import java.net.URL; import java.util.Queue; import java.util.Random; import java.util.TimerTask; public class UrlTimerTask extends TimerTask { private Queue queue = null; private UrlTaskFactory factory = null; private Random randNums = new Random(); public UrlTimerTask(Queue queue, UrlTaskFactory factory) { super(); this.queue = queue; this.factory = factory; } public void run() { URL imageURL; imageURL = this.factory.sources[this.randNums.nextInt(this.factory.sources.length)].nextUrl(); // add the URL to the queue this.queue.offer(imageURL); } } ccsaver/src/java/UrlTaskFactory.java0000644000175000001440000000356010062332461021003 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * UrlTaskFactory.java * $Id:$ * Factory class for UrlTimerTasks; manages a list of possible image sources, as well as * references to the screen-savers URL queue. */ import java.util.Queue; import java.util.Timer; public class UrlTaskFactory { public static final long NOW = 0; public UrlSource[] sources; private long interval = 1000; private Timer timer = null; private Queue urlQueue = null; public UrlTaskFactory(long interval, Queue urlQueue) { // store the constructor parameters this.interval = interval; this.urlQueue = urlQueue; // create the timer this.timer = new Timer(); // initialize the source list // XXX we do this statically now, but is there a way to use introspection to instantiate all available sources? this.sources = new UrlSource[1]; this.sources[0] = new OpenPhotoUrlSource(); } // getInterval: return the current interval, in milliseconds public long getInterval() { return this.interval; } // getInterval // setInterval_msec: sets the interval to a new value, specified in milliseconds public void setInterval_msec(long interval) { this.interval = interval; } // setInterval_sec: sets the interval to a new value, specified in seconds public void setInterval_sec(long interval) { this.interval = interval * 1000; } // newTask: creates and schedules a task object, using the default interval public void newTask() { // defer to the more generalized newTask method (pass in default interval) this.newTask(this.interval); } // newTask // newTask: creates and schedules a task object, using the specified interval public void newTask(long scheduleInterval) { this.timer.schedule(new UrlTimerTask(this.urlQueue, this), scheduleInterval); } // newTask } // UrlTaskFactory ccsaver/src/java/OpenPhotoUrlSource.java0000644000175000001440000000112210062332671021640 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * OpenPhotoUrlSource.java * $Id:$ * Generates image URLs from the OpenPhoto.net website. */ public class OpenPhotoUrlSource extends UrlSource { // MAX_ID stores the number of images in OpenPhoto; this should probably be detected somehow protected int MAX_ID=23044; public String nextUrlString() { return "http://legacy.openphoto.net/cgi-bin/image?image_id=" + String.valueOf(this.randNums.nextInt(this.MAX_ID)) + "&geometry=800x600&filters=&rotate="; } } ccsaver/src/java/FreeMediaUrlSource.java0000644000175000001440000000110710062333034021543 0ustar nyerglerusers00000000000000/* * ccsaver * copyright 2004, Nathan R. Yergler * http://yergler.net/projects/ccsaver * licensed under the GNU GPL * * FreeMediaUrlSource.java * $Id:$ * Generates image URLs from the FreeMedia website; currently broken. */ public class FreeMediaUrlSource extends UrlSource { protected int MAX_ID=23044; protected String nextUrlString() { // TODO: Implement FreeMedia specific retrieval return ""; // return "http://legacy.openphoto.net/cgi-bin/image?image_id=" + String.valueOf(this.randNums.nextInt(this.MAX_ID)) + "&geometry=800x600&filters=&rotate="; } } ccsaver/src/doc/0000755000175000001440000000000010061616363015050 5ustar nyerglerusers00000000000000ccsaver/src/doc/unix/0000755000175000001440000000000010061616363016033 5ustar nyerglerusers00000000000000ccsaver/src/doc/unix/README.txt0000644000175000001440000001245310061616363017536 0ustar nyerglerusers00000000000000------------------------------------------------------------------------------- Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- SaverBeans Screensaver Pack Unix README --------------------------------------- Requirements: * Administrator access * lesstif (provides /usr/X11R6/lib/libXm.so) Any version will do - you may need an older version if you don't have glibc2.3; such is the case with Java Desktop System for example. * xscreensaver (any version should do, 4-14 and greater is known to work) * Java VM 1.5 Beta or higher (Get at http://java.sun.com/). To Install: * Edit Makefile and jdkhome and xscreensaverhome to valid directories * Run 'make' to build the screensaver binaries for your platform * In the future, there will be a 'make install' task (contributions welcome). For now this has to be done manually: * Copy files to the right directories. Java Desktop System: SCREENSAVER_BIN=/usr/lib/xscreensaver SCREENSAVER_CONF=/usr/lib/xscreensaver/config Solaris: SCREENSAVER_BIN=/usr/openwin/lib/xscreensaver SCREENSAVER_CONF=/usr/openwin/share/control-center-2.0/screensavers Red Hat 9: SCREENSAVER_BIN=/usr/X11R6/bin SCREENSAVER_CONF=/usr/share/control-center/screensavers Other platforms: SCREENSAVER_BIN=(search for an xscreensaver, like apollonian) SCREENSAVER_CONF=(search for a config file, like apollonian.xml) Please check where your other screensavers are installed. You will need root access to do this (RPM will be provided later) 1. Copy or symbolically link *.jar to SCREENSAVER_BIN 2. Copy *.xml to SCREENSAVER_CONF 3. For each screensaver, you will see two files, e.g. bouncingline and bouncingline-bin. Copy or symbolically link bouncingline and bouncingline-bin to SCREENSAVER_BIN * Edit ~/.xscreensaver and add an entry for the screensaver. For example, for BouncingLine, add the following to the programs section: "Bouncing Line (Java)" /full/path/to/bouncingline -root \n\ (the bouncingline.bin, saverbeans-examples.jar saverbeans-api.jar files must appear in the same directory) NOTE: If you don't have a .xscreensaver file, go to your screensaver preferences and adjust the settings of a screensaver. The file will be created for you automatically. * Make sure the Java Virtual Machine can be located by each screensaver from the shell launched by the xscreensaver process. The following sources will be checked for your Java Virtual Machine (in order). See the screensaver wrapper script for more details. At worst, you can always edit these scripts directly, but usually editing ~/.xscreensaver and adding -jdkhome will suffice. - -jdkhome parameter, if present (this parameter is also set by the screensaver "Java Home" option in the control panel) - $JAVA_HOME environment variable, if set - `rpm -ql j2sdk`, if available - `which java`, if found - otherwise error * Run xscreensaver-demo to test and select. Look for "Bouncing Line (Java)". If it works, you should see a bouncing line in the preview window. If not, look for an error message in stderr. To Run: * Go to screensaver settings - the new screensavers will appear there. For a basic example, look for BouncingLine. Release Notes: * JDK 1.4 support is upcoming in a future release. * If it does not work but you get no error, try running bouncingline directly from the commandline and observe the output. * If you get an error containing: libjvm.so: cannot open shared object file: No such file or directory Then the screensaver cannot find the JDK. Pass -jdkhome as a parameter, pointing to a valid installation of J2SDK 1.5.0 or greater. * If you get the error: Could not find class sun/awt/X11/XEmbeddedFrame Exception in thread "main" java.lang.NoClassDefFoundError: sun/awt/X11/XEmbeddedFrame Then you're not using JDK 1.5. JDK 1.5 is currently required on Linux/Solaris. See above for how to fix this (most likely with -jdkhome) * If you get the error: java.lang.UnsupportedClassVersionError ... (unsupported major.minor version) Then you're not using JDK 1.5. JDK 1.5 is currently required on Linux/Solaris. See above for how to fix this (most likely with -jdkhome) * If "Bouncing Line" does not appear, try restarting xscreensaver (or log out and log back in): pkill xscreensaver xscreensaver -nosplash & ccsaver/src/doc/win32/0000755000175000001440000000000010061616363016012 5ustar nyerglerusers00000000000000ccsaver/src/doc/win32/README.txt0000644000175000001440000000300210061616363017503 0ustar nyerglerusers00000000000000------------------------------------------------------------------------------- Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- SaverBeans Screensaver Pack Windows README ------------------------------------------ Requirements: * Administrator access, to copy screensaver to Windows system directory * Windows ME or XP (may work on other versions of Windows as well) * Java VM 1.4 or higher (Get at http://java.com/) To Install: * Copy all files in this directory (except for this README) to your Windows system directory (e.g. c:\windows\system32). To Run: * Go to screensaver settings - the new screensavers will appear there. For a basic example, look for BouncingLine. ccsaver/src/conf/0000755000175000001440000000000010061615657015235 5ustar nyerglerusers00000000000000ccsaver/src/conf/ccsaver.xml0000644000175000001440000000263110062065602017375 0ustar nyerglerusers00000000000000 <_description> Sample screensaver written as an exercise of long-rusty Java skills. Loads random Creative Commons licensed images from the internet for your slide show viewing pleasure. ccsaver/src/res/0000755000175000001440000000000010062402216015063 5ustar nyerglerusers00000000000000ccsaver/src/res/cc.jpg0000644000175000001440000002103710062402216016155 0ustar nyerglerusers00000000000000JFIF,,Created with The GIMPC  !"$"$C" L  !1AQa"2q #BRbr3$Ccs&4DSTU ?p    T5O4 EpNSOiv[#YS/Oh&r;BR}Xщ%U˂Kd~" jKKⰦx,4|I[S)KZ*RI=Giޑt%wq 0;Nhl}I:tꖈȄJ- nH'ēllF~OSPL[[%ڃl{ Sj4Jΰy9.\IeFLL6zfJa>˲qI:ZBY*9,U&gp[kR&ܭl=NYT1^+YZVRϔIo6!W`cso=0:8⊔dĘ=z]JQjH'8n^U:ϒR 08D6E; [%Tͷ%6,erzp~2gJE5N>yRz<Έi M%͸By%G9&a5Z?24HoZTٙ8I:Dz)#V"mRJݴoiUq)b.|F{86׫VZ]zAsTS8;vY*U5Id'ԘyMwQҤ,i)RN#L] aFIo&&7O><=&-JJB4&% BǑ| :E-a4T9Ճ9L}DN>c,p8Fگj굶*D!"vA dx 1a7ln鄫Yݪ@*Rrԙ#BMHz%ziޢ?oVOhMt}2<*O8gTO*[[.82*YD!!!!kz!zË[ L* K ]l=UImz~U\ O,N"ch(ZB"!ie*]a&ԥK4da wS='8A2ҳ.Lq%*BI sOĺe.Kj}rsS OA?b6~Z~@R*MR~~gEYǦz$rkW(ymcT9q cQb\c䪕Wͫ0A<9F!!!c+#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 2;CitܱTl\W 0;8WvZG*G(nH(J>^NF'u($OI'd!!!!!!!!-VOH;OJɼ7]e.إ@=5dm/A_.UܴJxg4-zFCY{ҿP ccsaver/build.properties0000644000175000001440000000007710062404552016731 0ustar nyerglerusers00000000000000saverbeans.path = /home/nyergler/Projects/classpath/saverbeans ccsaver/build.xml0000644000175000001440000001142410062402125015325 0ustar nyerglerusers00000000000000 Property saverbeans.path not found. Please copy build.properties.sample to build.properties and follow the instructions in that file. Property saverbeans.path is invalid. Please set it to the installation path of the SaverBeans SDK.