|
CIC iSign Version 1.2 | ||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||
java.lang.Object | +--InkTools.CicUtils
This is a general utiliy class for Cic's InkTools package. It covers two areas: helper functions for what is called HTTP Tunneling and helper functions to convert signatures into images.
A HTTP form can communicate with a servlet through GET and POST requests. Java's 'java.net' package provides classes that can be utilized to establish a direct HTTP communication between an applet and a servlet, a technique known as HTTP Tunneling. If the URL of the servlet is known, an applet can simple call the functions 'httpGet' or 'httpPost' to send requests and receive the servlet response.
Often it is reqired to display ink data or signatures as an image rather than redisplay it in an InkControl. The 'createJpegImage' will create a Jpeg image from a signature. Note: this function is using Sun's Jpeg encoder, which is very slow.
| Field Summary | |
static int |
BMP_FILE
CreateSignatureImage: specify to produce a Bmp file. |
static int |
GIF_FILE
CreateSignatureImage: specify to produce a Gif file. |
static int |
JPEG_FILE
CreateSignatureImage: specify to produce a Jpeg file. |
static int |
PNG_FILE
CreateSignatureImage: specify to produce a Png file. |
static int |
TIFF_FILE
CreateSignatureImage: specify to produce a Tiff file. |
| Constructor Summary | |
CicUtils()
Constructs a CicUtils object. |
|
| Method Summary | |
boolean |
createGifImage(CicDoodle doodle,
int width,
int height,
java.awt.Component comp,
java.lang.String fileName)
Creates a Gif image from the ink of a CicDoodle and writes it to disk. |
boolean |
createGifImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Creates a Gif image from the ink of a CicDoodle and writes it to disk. |
boolean |
createGifImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Creates a Gif image from the ink of a CicDoodle and writes it to disk. |
boolean |
createJpegImage(CicDoodle doodle,
int width,
int height,
java.awt.Component comp,
java.lang.String fileName)
Creates a Jpeg image from the ink of a CicDoodle and writes it to disk. |
boolean |
createJpegImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Creates a Jpeg image from the ink of a CicDoodle and writes it to disk. |
boolean |
createJpegImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Creates a Jpeg image from the ink of a CicDoodle and writes it to disk. |
boolean |
createSignatureImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName,
int format)
Creates an image from the ink of a CicDoodle and writes it to disk. |
boolean |
createSignatureImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName,
int format)
Creates an image from the ink of a CicDoodle and writes it to disk. |
java.awt.Image |
getSigImage()
Creates a Java Image of the current CicDoodle. |
java.awt.Image |
getSigImage(java.awt.Component comp)
Creates a Java Image of the current CicDoodle. |
java.awt.Image |
getSigImageEx()
Creates a Java Image of the current CicDoodle. |
java.io.InputStream |
httpGet(java.net.URL servlet,
java.lang.String field,
java.lang.String value)
HTTP - Tunneling: this function performs a GET request to the given servlet. |
java.io.InputStream |
httpPost(java.net.URL servlet,
java.lang.String field,
java.lang.String value)
HTTP - Tunneling: this function performs a POST request to the given servlet. |
void |
setImageInkWidth(int newInkWidth)
This function should get called before 'createJpegImage' or 'createGifImage' to set the ink width used for creating the image Values are: 1 for thin ink, 2 for thick ink. |
void |
setImageOptions(java.awt.Color ink,
java.awt.Color background,
int writingGuide)
This function should get called before 'createJpegImage' or 'createGifImage' to set the ink and background colors used for creating the image as well as if the writing guide shoulf get included in the image. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int GIF_FILE
public static final int JPEG_FILE
public static final int TIFF_FILE
public static final int PNG_FILE
public static final int BMP_FILE
| Constructor Detail |
public CicUtils()
| Method Detail |
public java.io.InputStream httpGet(java.net.URL servlet,
java.lang.String field,
java.lang.String value)
throws java.io.IOException
Example: http://java:8080/servlet/iSignServlet?field:value
servlet - the URL object of the servletvalue - the value associated with the field
throws - IOExeption
java.io.IOException
public java.io.InputStream httpPost(java.net.URL servlet,
java.lang.String field,
java.lang.String value)
throws java.io.IOException
servlet - the URL object of the servletvalue - the value associated with the field
throws - IOExeption
java.io.IOException
public boolean createGifImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Note 1: Use this method if the calling process runs on a backend with no graphic context (no applet or application)
Note 2: This function requiers Java 1.3 (BufferedImage class)
The encoder class is provided by ACME Labs:
GifEncoder - write out an image as a GIF
Transparency handling and variable bit size courtesy of Jack Palevich.
Copyright (C)1996,1998 by Jef Poskanzer
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard disk
public boolean createGifImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Note 1: Use this method if the calling process runs on a backend with no graphic context (no applet or application)
Note 2: This function requiers Java 1.3 (BufferedImage class, Graphics2D)
The encoder class is provided by ACME Labs:
GifEncoder - write out an image as a GIF
Transparency handling and variable bit size courtesy of Jack Palevich.
Copyright (C)1996,1998 by Jef Poskanzer
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard disk
public boolean createGifImage(CicDoodle doodle,
int width,
int height,
java.awt.Component comp,
java.lang.String fileName)
Note: Use this method if the calling process an applet or application which has a graphic context.
The encoder class is provided by ACME Labs:
GifEncoder - write out an image as a GIF
Transparency handling and variable bit size courtesy of Jack Palevich.
Copyright (C)1996,1998 by Jef Poskanzer
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Visit the ACME Labs Java page for up-to-date versions of this and other
fine Java utilities: http://www.acme.com/java/
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagecomp - the main component of the calling applet or application ('this')fileName - the file name under which the image should get written
onto the hard disk
public boolean createJpegImage(CicDoodle doodle,
int width,
int height,
java.awt.Component comp,
java.lang.String fileName)
Note: Use this method if the calling process an applet or application which has a graphic context.
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard disk
The JpegEncoder and its associated classes are Copyright (c) 1998, James R. Weeks and BioElectroMech. This software is based in part on the work of the Independent JPEG Group.
Disclaimer: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
public boolean createJpegImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Note 1: Use this method if the calling process runs on a backend with no graphic context (no applet or application)
Note 2: This function requiers Java 1.3 (BufferedImage class)
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard disk
The JpegEncoder and its associated classes are Copyright (c) 1998, James R. Weeks and BioElectroMech. This software is based in part on the work of the Independent JPEG Group.
Disclaimer: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
public boolean createJpegImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName)
Note 1: Use this method if the calling process runs on a backend with no graphic context (no applet or application)
Note 2: This function requiers Java 1.3 (BufferedImage class, Graphics2D)
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard disk
The JpegEncoder and its associated classes are Copyright (c) 1998, James R. Weeks and BioElectroMech. This software is based in part on the work of the Independent JPEG Group.
Disclaimer: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
public boolean createSignatureImage(CicDoodle doodle,
int width,
int height,
java.lang.String fileName,
int format)
Note: This function requiers Java 1.3 (BufferedImage class, Graphics2D)
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard diskformat - The grafic format of the output file:
GIF_FILE, JPEG_FILE, TIFF_FILE, PNG_FILE, BMP_FILE
public boolean createSignatureImageEx(CicDoodle doodle,
int width,
int height,
java.lang.String fileName,
int format)
Note: This function requiers Java 1.3 (BufferedImage class, Graphics2D)
doodle - the ink which should get transformed into an imagewidth - the width of the imageheight - the height of the imagefileName - the file name under which the image should get written
onto the hard diskformat - The grafic format of the output file:
GIF_FILE, JPEG_FILE, TIFF_FILE, PNG_FILE, BMP_FILE
public void setImageOptions(java.awt.Color ink,
java.awt.Color background,
int writingGuide)
ink - The color of the inkbackground - The color of the backgroundwritingGuide - The style of the writing guide included in the imagepublic void setImageInkWidth(int newInkWidth)
newInkWidth - The width of the inkpublic java.awt.Image getSigImage(java.awt.Component comp)
public java.awt.Image getSigImage()
public java.awt.Image getSigImageEx()
|
CIC iSign Version 1.2 | ||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||