KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > ext > awt > image > Light


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.ext.awt.image;
19
20 import java.awt.Color JavaDoc;
21
22 /**
23  * Top level interface to model a light element. A light is responsible for
24  * computing the light vector on a given point of a surface. A light is
25  * typically in a 3 dimensional space and the methods assumes the surface
26  * is at elevation 0.
27  *
28  * @author <a HREF="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
29  * @version $Id: Light.java,v 1.5 2005/03/27 08:58:32 cam Exp $
30  */

31 public interface Light {
32     /**
33      * @return true if the light is constant over the whole surface
34      */

35     public boolean isConstant();
36
37     /**
38      * Computes the light vector in (x, y)
39      *
40      * @param x x-axis coordinate where the light should be computed
41      * @param y y-axis coordinate where the light should be computed
42      * @param z z-axis coordinate where the light should be computed
43      * @param L array of length 3 where the result is stored
44      */

45     public void getLight(final double x, final double y, final double z, final double L[]);
46
47     /**
48      * Returns a light map, starting in (x, y) with dx, dy increments, a given
49      * width and height, and z elevations stored in the fourth component on the
50      * N array.
51      *
52      * @param x x-axis coordinate where the light should be computed
53      * @param y y-axis coordinate where the light should be computed
54      * @param dx delta x for computing light vectors in user space
55      * @param dy delta y for computing light vectors in user space
56      * @param width number of samples to compute on the x axis
57      * @param height number of samples to compute on the y axis
58      * @param z array containing the z elevation for all the points
59      *
60      * @return an array of height rows, width columns where each element
61      * is an array of three components representing the x, y and z
62      * components of the light vector.
63      */

64     public double[][][] getLightMap(double x, double y,
65                                   final double dx, final double dy,
66                                   final int width, final int height,
67                                   final double[][][] z);
68
69     /**
70      * Returns a row of the light map, starting at (x, y) with dx
71      * increments, a given width, and z elevations stored in the
72      * fourth component on the N array.
73      *
74      * @param x x-axis coordinate where the light should be computed
75      * @param y y-axis coordinate where the light should be computed
76      * @param dx delta x for computing light vectors in user space
77      * @param width number of samples to compute on the x axis
78      * @param z array containing the z elevation for all the points
79      * @param lightRow array to store the light info to, if null it will
80      * be allocated for you and returned.
81      *
82      * @return an array width columns where each element
83      * is an array of three components representing the x, y and z
84      * components of the light vector. */

85     public double[][] getLightRow(double x, double y,
86                                   final double dx, final int width,
87                                   final double[][] z,
88                                   final double[][] lightRow);
89
90     /**
91      * @param linear if true the color is returned in the Linear sRGB
92      * colorspace otherwise the color is in the gamma
93      * corrected sRGB color space.
94      * @return the light's color
95      */

96     public double[] getColor(boolean linear);
97
98     /**
99      * Sets the light color to a new value
100      */

101     public void setColor(Color JavaDoc color);
102 }
103
104
Popular Tags