読み込んだカラーマップを、実際に何らかのデータに適用してみましょう。
試しに、以下の数式を可視化することを考えます。
\begin{equation} f(x, y) = \left| \cos(x) \cos(y) \right| \end{equation}描画のソースコードは以下のようになります。
キャンバスサイズは $512\times 512$、$x, y$ の値は適当にスケーリングしてあります。
// データの色を割り当てて描画(HSB補間) private void drawDataActionPerformed(java.awt.event.ActionEvent evt) { BufferedImage image = new BufferedImage(lblDraw.getWidth(), lblDraw.getHeight(), BufferedImage.TYPE_INT_BGR); int centerX = image.getWidth() / 2; int centerY = image.getHeight() / 2; for (int y = 0; y < image.getHeight(); y++) { for (int x = 0; x < image.getWidth(); x++) { image.setRGB(x, y, getColorHSB((float)(255 * Math.abs(Math.cos((double)(x - centerX) * Math.PI / 400.0) * Math.cos((double)(y - centerY) * Math.PI / 400.0)))).getRGB()); } } lblDraw.setIcon(new ImageIcon(image)); }
結果は以下のようになります。
default.cmp
greyscale.cmp

defaultstep.cmp

highend.cmp

midrange.cmp

lowend.cmp

twostep.cmp

colorwave.cmp
