tags:

views:

293

answers:

3

I'm trying to port a library from Java to .NET that makes heavy use of the java.awt.color namespace. What is the .NET equivalent to this?

+3  A: 

I'm not entirely familiar with the Java namespace, but maybe you're looking for System.Drawing.Color?

EDIT: Obviously Java and ICC are not my game, but I figured I'd still try to help out. There are several references to ICC in the documentation for System.Windows.Media.

Color Structure: http://msdn.microsoft.com/en-us/library/system.windows.media.color.aspx

Color Context: http://msdn.microsoft.com/en-us/library/system.windows.media.colorcontext.aspx

Maybe this is a sufficient starting point to find the functionality you are seeking.

Mayo
To quote the <a href="http://java.sun.com/javase/6/docs/api/java/awt/color/package-summary.html">package summary</a>: "Provides classes for color spaces. It contains an implementation of a color space based on the International Color Consortium (ICC) Profile Format Specification, Version 3.4, August 15, 1997. It also contains color profiles based on the ICC Profile Format Specification."
aperkins
ColorContext represents the ICC or ICM profile, see also pixel formats http://msdn.microsoft.com/en-us/library/system.windows.media.pixelformats.aspx
slf
+1  A: 

The java.awt.color namespace seems to only concern itself with color spaces. There's no such concept in .Net as a color space. Everything in .Net is based on RGB (RGB color space) except perhaps some new XAML attributes in WPF. The java.awt.color namespace includes considerations for such ideas as CMYK (Cyan, Magenta, Yellow b**L**ack) which is used in printing applications only.

My guess is that unless you are indeed working on an application that sends CMYK color data to a printer then you don't need to worry about it. The colors in .Net are based around RGB or aRGB (even the gray scale. The RGB values are simply all equal so RGB(128,128,128=MediumGray)

Paul Sasik
A: 

The SystemColors class provides access to system brushes and colors, such as ControlBrush, ControlBrushKey, and DesktopBrush. A system brush is a SolidColorBrush object that paints an area with the specified system color. A system brush always produces a solid fill; it can't be used to create a gradient.

The System.Drawing namespace has brushes, images, converters, system colours, regions and pretty much all the basics for drawing on windows. I think this works closely with GDI+.

If you have any specif classes you need to map to or requirements add a comment and I'll see what I can do.

objektivs