Java Doc for ColorUtilities.java in  » GIS » GeoTools-2.4.1 » org » geotools » resources » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.resources.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.resources.image.ColorUtilities

ColorUtilities
final public class ColorUtilities (Code)
A set of static methods for handling of colors informations. Some of those methods are useful, but not really rigorous. This is why they do not appear in any "official" package, but instead in this private one. Do not rely on this API! It may change in incompatible way in any future version.
since:
   2.0
version:
   $Id: ColorUtilities.java 26799 2007-08-31 21:31:21Z desruisseaux $
author:
   Martin Desruisseaux
author:
   Simone Giannecchini




Method Summary
public static  float[]XYZtoLAB(float[] color)
     Transforms a color from XYZ color space to LAB.
public static  floatcolorDistance(float[] lab1, float[] lab2)
     Computes the distance E (CIE 1994) between two colors in LAB color space.
public static  voidexpand(Color[] colors, int[] ARGB, int lower, int upper)
     Copy colors into array ARGB from index lower inclusive to index upper exclusive.
public static  intgetBitCount(int mapSize)
     Returns a bit count for an IndexColorModel mapping mapSize colors.
public static  intgetColorIndex(IndexColorModel colors, Color color, int exclude)
     Returns the index of the specified color, excluding the specified one.
public static  IndexColorModelgetIndexColorModel(int[] ARGB)
     Returns an index color model for specified ARGB codes.
public static  IndexColorModelgetIndexColorModel(int[] ARGB, int numBands, int visibleBand)
     Returns a tolerant index color model for the specified ARGB code.
public static  intgetIntFromColor(int r, int g, int b, int a)
     Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
public static  intgetNumBands(ColorModel model)
     Tries to guess the number of bands from the specified color model.
public static  intgetTransferType(int mapSize)
     Returns a suggered type for an IndexColorModel of mapSize colors.
public static  intgetTransparentPixel(IndexColorModel colors)
     Returns the most transparent pixel in the specified color model.
public static  booleanisGrayPalette(IndexColorModel icm, boolean ignoreTransparents)
     Tells us if a specific IndexColorModel contains only gray color or not, ignoring alpha information.
Parameters:
  icm - IndexColorModel to be inspected.
Parameters:
  ignoreTransparents - true if the RGB values of fully transparent pixels(the ones with an value of 0)should not be taken in account during the check for gray color.
public static  introundByte(double value)
     Round a float value and clamp the result between 0 and 255 inclusive.
public static  Color[]subarray(Color[] palette, int lower, int upper)
     Returns a subarray of the specified color array.



Method Detail
XYZtoLAB
public static float[] XYZtoLAB(float[] color)(Code)
Transforms a color from XYZ color space to LAB. The color are transformed in place. This method returns color for convenience. Reference: http://www.brucelindbloom.com/index.html?ColorDifferenceCalc.html



colorDistance
public static float colorDistance(float[] lab1, float[] lab2)(Code)
Computes the distance E (CIE 1994) between two colors in LAB color space. Reference: http://www.brucelindbloom.com/index.html?ColorDifferenceCalc.html



expand
public static void expand(Color[] colors, int[] ARGB, int lower, int upper)(Code)
Copy colors into array ARGB from index lower inclusive to index upper exclusive. If upper-lower is not equals to the length of colors array, then colors will be interpolated.
Parameters:
  colors - Colors to copy into the ARGB array.
Parameters:
  ARGB - Array of integer to write ARGB values to.
Parameters:
  lower - Index (inclusive) of the first element of ARGB to change.
Parameters:
  upper - Index (exclusive) of the last element of ARGB to change.



getBitCount
public static int getBitCount(int mapSize)(Code)
Returns a bit count for an IndexColorModel mapping mapSize colors. It is guaranteed that the following relation is hold:
(1 << getBitCount(mapSize)) >= mapSize



getColorIndex
public static int getColorIndex(IndexColorModel colors, Color color, int exclude)(Code)
Returns the index of the specified color, excluding the specified one. If the color is not explicitly found, a close color is returned. This method never returns a negative value (0 is returned if the color model has no colors).
Parameters:
  colors - The color model in which to look for a color index.
Parameters:
  color - The color to search for.
Parameters:
  exclude - An index to exclude from the search (usually the background or the pixel), or -1 if none. The index of the color, or 0.



getIndexColorModel
public static IndexColorModel getIndexColorModel(int[] ARGB)(Code)
Returns an index color model for specified ARGB codes. If the specified array has not transparent color (i.e. all alpha values are 255), then the returned color model will be opaque. Otherwise, if the specified array has one and only one color with alpha value of 0, the returned color model will have only this transparent color. Otherwise, the returned color model will be translucent.
Parameters:
  ARGB - An array of ARGB values. An index color model for the specified array.



getIndexColorModel
public static IndexColorModel getIndexColorModel(int[] ARGB, int numBands, int visibleBand)(Code)
Returns a tolerant index color model for the specified ARGB code. This color model accept image with the specified number of bands.
Parameters:
  ARGB - An array of ARGB values.
Parameters:
  numBands - The number of bands.
Parameters:
  visibleBand - The band to display. An index color model for the specified array.



getIntFromColor
public static int getIntFromColor(int r, int g, int b, int a)(Code)
Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).
Parameters:
  r - the red component
Parameters:
  g - the green component
Parameters:
  b - the blue component
Parameters:
  a - the alpha component
throws:
  IllegalArgumentException - if , g , b or a are outside of the range 0 to 255, inclusive.



getNumBands
public static int getNumBands(ColorModel model)(Code)
Tries to guess the number of bands from the specified color model. The recommanded approach is to invoke java.awt.image.SampleModel.getNumBands . This method should be used only as a fallback when the sample model is not available. This method uses some heuristic rules for guessing the number of bands, so the return value may not be exact in all cases.



getTransferType
public static int getTransferType(int mapSize)(Code)
Returns a suggered type for an IndexColorModel of mapSize colors. This method returns DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT .



getTransparentPixel
public static int getTransparentPixel(IndexColorModel colors)(Code)
Returns the most transparent pixel in the specified color model. If many colors has the same alpha value, than the darkest one is returned. This method never returns a negative value (0 is returned if the color model has no colors).
Parameters:
  colors - The color model in which to look for a transparent color. The index of a transparent color, or 0.



isGrayPalette
public static boolean isGrayPalette(IndexColorModel icm, boolean ignoreTransparents)(Code)
Tells us if a specific IndexColorModel contains only gray color or not, ignoring alpha information.
Parameters:
  icm - IndexColorModel to be inspected.
Parameters:
  ignoreTransparents - true if the RGB values of fully transparent pixels(the ones with an value of 0)should not be taken in account during the check for gray color. true if the palette is grayscale, false otherwise.



roundByte
public static int roundByte(double value)(Code)
Round a float value and clamp the result between 0 and 255 inclusive.



subarray
public static Color[] subarray(Color[] palette, int lower, int upper)(Code)
Returns a subarray of the specified color array. The lower and upper index will be clamb into the palette range. If they are completly out of range, or if they would result in an empty array, then null is returned. This method is used by org.geotools.cv.SampleDimension as an heuristic approach for distributing palette colors into a list of categories.
Parameters:
  palette - The color array (may be null ).
Parameters:
  lower - The lower index, inclusive.
Parameters:
  upper - The upper index, inclusive. The subarray (may be palette if the original array already fit),or null if the lower and upper indexare out of palette bounds.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.