org.seltar.Bytes2Web
Class ImageToWeb

java.lang.Object
  extended by PApplet
      extended by org.seltar.Bytes2Web.PostToWeb
          extended by org.seltar.Bytes2Web.ImageToWeb

public class ImageToWeb
extends PostToWeb


Field Summary
static int GIF
           
static int JPEG
           
static int PNG
           
static int TIFF
           
 int type
           
 
Constructor Summary
ImageToWeb(PApplet _papplet)
           
 
Method Summary
 byte[] getBytes()
          Get the current screen's bytearray
 byte[] getBytes(PGraphics src)
          Get the given PGraphics bytearray
protected  byte[] getBytesJPEG(java.awt.image.BufferedImage image)
          Get the image as a jpeg byte array
protected  byte[] getBytesTIFF(PImage srcimg)
          Get the image as a tiff byte array
 void post(java.lang.String project, java.lang.String url, java.lang.String filename, boolean popup)
          Special Image Post function, automatically adds the right extension
 void post(java.lang.String project, java.lang.String url, java.lang.String filename, boolean popup, byte[] bytes)
          Special Image Post function, automatically adds the right extension Takes a byte array, from other images
 void save(java.lang.String filename)
          Just save as a file
 void save(java.lang.String prefix, boolean useDate)
          Special Image Post function Adds date if requested, and automatically adds the right extension
 void save(java.lang.String filename, byte[] bytes)
          Just save a bytearray as a file
 void setType(int _type)
          Set the filetype to save / post as
 
Methods inherited from class org.seltar.Bytes2Web.PostToWeb
_post, _post, _save, _save, _save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public int type

JPEG

public static final int JPEG
See Also:
Constant Field Values

PNG

public static final int PNG
See Also:
Constant Field Values

GIF

public static final int GIF
See Also:
Constant Field Values

TIFF

public static final int TIFF
See Also:
Constant Field Values
Constructor Detail

ImageToWeb

public ImageToWeb(PApplet _papplet)
Method Detail

setType

public void setType(int _type)
Set the filetype to save / post as

Parameters:
_type - the image type; ImageToWeb.JPEG, ImageToWeb.PNG, ImageToWeb.GIF, ImageToWeb.TIFF

post

public void post(java.lang.String project,
                 java.lang.String url,
                 java.lang.String filename,
                 boolean popup)
Special Image Post function, automatically adds the right extension

Parameters:
project - the project folder
url - url to the file that receives the data
filename - the filename it's supposed to save as
popup - wether or not to open the link with the file

post

public void post(java.lang.String project,
                 java.lang.String url,
                 java.lang.String filename,
                 boolean popup,
                 byte[] bytes)
Special Image Post function, automatically adds the right extension Takes a byte array, from other images

Parameters:
project - the project folder
url - url to the file that receives the data
filename - the filename it's supposed to save as
popup - wether or not to open the link with the file
bytes - the byte array to post

save

public void save(java.lang.String prefix,
                 boolean useDate)
Special Image Post function Adds date if requested, and automatically adds the right extension

Parameters:
prefix - the filename
useDate - wether or not to prefix with a date

save

public void save(java.lang.String filename)
Just save as a file

Parameters:
filename - the filename to save as

save

public void save(java.lang.String filename,
                 byte[] bytes)
Just save a bytearray as a file

Parameters:
filename - the filename to save as
bytes - the byte array to save

getBytes

public byte[] getBytes()
Get the current screen's bytearray

Overrides:
getBytes in class PostToWeb

getBytes

public byte[] getBytes(PGraphics src)
Get the given PGraphics bytearray

Parameters:
src - the source graphics

getBytesJPEG

protected byte[] getBytesJPEG(java.awt.image.BufferedImage image)
Get the image as a jpeg byte array

Parameters:
image - BufferedImage to create the byte array from
See Also:
BufferedImage

getBytesTIFF

protected byte[] getBytesTIFF(PImage srcimg)
Get the image as a tiff byte array

Parameters:
srcimg - PImage to create the byte array from
See Also:
PImage