<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../../jacoco-resources/report.gif" type="image/gif"/><title>PreviewSettings.java</title><link rel="stylesheet" href="../../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../../index.html" class="el_report">Mistral Operations</a> > <a href="../index.html" class="el_bundle">image-core</a> > <a href="index.source.html" class="el_package">it.tidalwave.image.render</a> > <span class="el_source">PreviewSettings.java</span></div><h1>PreviewSettings.java</h1><pre class="source lang-java linenums">/*
* *********************************************************************************************************************
*
* Mistral: open source imaging engine
* http://tidalwave.it/projects/mistral
*
* Copyright (C) 2003 - 2023 by Tidalwave s.a.s. (http://tidalwave.it)
*
* *********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* *********************************************************************************************************************
*
* git clone https://bitbucket.org/tidalwave/mistral-src
* git clone https://github.com/tidalwave-it/mistral-src
*
* *********************************************************************************************************************
*/
package it.tidalwave.image.render;
import java.awt.image.ByteLookupTable;
import java.awt.image.ShortLookupTable;
/***********************************************************************************************************************
*
* This class holds preview settings for displaying an image.
*
* @author Fabrizio Giudici
*
**********************************************************************************************************************/
<span class="nc" id="L39">public class PreviewSettings</span>
{
<span class="nc" id="L41"> private byte[] redCurve8bit = new byte[256];</span>
<span class="nc" id="L42"> private byte[] greenCurve8bit = new byte[256];</span>
<span class="nc" id="L43"> private byte[] blueCurve8bit = new byte[256];</span>
<span class="nc" id="L44"> private byte[] alphaCurve8bit = new byte[256];</span>
private ShortLookupTable lookupTable16bit;
private ByteLookupTable lookupTable8bit;
/*******************************************************************************************************************
*
* TODO: it would be event better to pass abstract curves and leave to this
* class the responsibility of sampling them. Check out performances.
*
******************************************************************************************************************/
public void setLookupTable (final short[] redCurve,
final short[] greenCurve,
final short[] blueCurve,
final short[] alphaCurve)
{
<span class="nc" id="L59"> lookupTable16bit = new ShortLookupTable(0, new short[][]{redCurve, greenCurve, blueCurve, alphaCurve});</span>
// FIXME: use a better interpolation
use a better interpolation
<span class="nc bnc" id="L62" title="All 2 branches missed."> for (var i = 0; i < redCurve8bit.length; i++)</span>
{
<span class="nc" id="L64"> final var j = (i << 8) | (i & 0xff);</span>
<span class="nc" id="L65"> redCurve8bit[i] = (byte)(redCurve[j] >>> 8);</span>
<span class="nc" id="L66"> greenCurve8bit[i] = (byte)(greenCurve[j] >>> 8);</span>
<span class="nc" id="L67"> blueCurve8bit[i] = (byte)(blueCurve[j] >>> 8);</span>
<span class="nc" id="L68"> alphaCurve8bit[i] = (byte)(alphaCurve[j] >>> 8);</span>
}
<span class="nc" id="L71"> lookupTable8bit = new ByteLookupTable(0,</span>
new byte[][]{redCurve8bit,
greenCurve8bit,
blueCurve8bit,
alphaCurve8bit});
<span class="nc" id="L76"> }</span>
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
public ShortLookupTable getLookupTable16bit()
{
<span class="nc" id="L84"> return lookupTable16bit;</span>
}
/*******************************************************************************************************************
*
*
******************************************************************************************************************/
public ByteLookupTable getLookupTable8bit()
{
<span class="nc" id="L93"> return lookupTable8bit;</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html>