Tabnine Logo
ColorConvertDescriptor
Code IndexAdd Tabnine to your IDE (free)

How to use
ColorConvertDescriptor
in
javax.media.jai.operator

Best Java code snippets using javax.media.jai.operator.ColorConvertDescriptor (Showing top 9 results out of 315)

origin: org.imajine.image/org-imajine-image-plugin-jai

 @Nonnull
 @Override
 protected PlanarImage execute (final @Nonnull ConvertColorProfileOp operation, 
                 final @Nonnull EditableImage image,
                 final @Nonnull PlanarImage planarImage)
  {
   log.info("execute({}) - {} ", operation, planarImage.getSampleModel());
   
   if (operation.getRenderingIntent() != PERCEPTUAL)
    {
     throw new IllegalArgumentException("Can only use PERCEPTUAL intent, was " + operation.getRenderingIntent());  
    }
   
   final ICC_Profile iccProfile = operation.getIccProfile();      
   final RenderingHints hints = new RenderingHints(Collections.<RenderingHints.Key, Object>emptyMap());
   hints.put(KEY_COLOR_RENDERING, VALUE_COLOR_RENDER_QUALITY);
   final PlanarImage result = ColorConvertDescriptor.create(planarImage, JAIUtils.getColorModel(planarImage, iccProfile), hints); 
   JAIUtils.logImage(log, ">>>> returning", planarImage);
   
   return result;
  }
}
origin: org.imajine/org-imajine-image-plugin-jai

/*******************************************************************************
 *
 * If the current image is not sRGB, apply a ColorConvert operation to convert
 * it to sRGB.
 *
 * @param colorModel    the target color model (must be a sRGB color space)
 * @param hints         the RenderingHints
 *
 ******************************************************************************/
public static PlanarImage jaiConvertTosRGBColorProfile (final PlanarImage source,
                            final ColorModel colorModel,
                            final RenderingHints hints)
 {
  boolean is_sRGB = source.getColorModel().getColorSpace().isCS_sRGB();
  logger.finer(">>>> planarImage.is_sRGB: " + is_sRGB);
  if (!is_sRGB)
   {
    // Convert color as last, since if the image has been scaled there are less pixels to convert
    logger.finer(">>>> Applying ColorConvertDescriptor");
    PlanarImage result = ColorConvertDescriptor.create(source, colorModel, hints);
    logImage(logger, ">>>>>>>>    planarImage", result);
    return result;
   }
  else
   {
    return source;
   }
 }
origin: org.imajine.image/org-imajine-image-plugin-jai

/*******************************************************************************
 *
 * If the current image is not sRGB, apply a ColorConvert operation to convert
 * it to sRGB.
 *
 * @param colorModel    the target color model (must be a sRGB color space)
 * @param hints         the RenderingHints
 *
 ******************************************************************************/
public static PlanarImage jaiConvertTosRGBColorProfile (final PlanarImage source,
                            final ColorModel colorModel,
                            final RenderingHints hints)
 {
  boolean is_sRGB = source.getColorModel().getColorSpace().isCS_sRGB();
  log.debug(">>>> planarImage.is_sRGB: {}", is_sRGB);
  if (!is_sRGB)
   {
    // Convert color as last, since if the image has been scaled there are less pixels to convert
    log.debug(">>>> Applying ColorConvertDescriptor");
    PlanarImage result = ColorConvertDescriptor.create(source, colorModel, hints);
    logImage(log, ">>>>>>>>    planarImage", result);
    return result;
   }
  else
   {
    return source;
   }
 }
origin: org.imajine/org-imajine-image-plugin-jai

 /*******************************************************************************
  *
  * @inheritDoc
  *
  ******************************************************************************/
 protected PlanarImage execute (ConvertColorProfileOp operation, final EditableImage image, PlanarImage planarImage)
  {
   ICC_Profile iccProfile = operation.getICCProfile();      
   logger.fine("convertColorProfile(" + ImageUtils.getICCProfileName(iccProfile) + ") - " + planarImage.getSampleModel());
   planarImage = ColorConvertDescriptor.create(planarImage, JAIUtils.getColorModel(planarImage, iccProfile), null); // FIXME: RenderingHints
   JAIUtils.logImage(logger, ">>>>   convertColorProfile() returning", planarImage);
   
   return planarImage;
  }
}
origin: org.geotools/gt2-coverage

/**
 * Forces the {@linkplain #image} color model to the
 * {@linkplain ColorSpace#CS_GRAY GRAYScale color space}. If the current
 * color space is already of {@linkplain ColorSpace#TYPE_GRAY  type}, then
 * this method does nothing.
 *
 * @return this {@link ImageWorker}.
 *
 * @see #isColorSpaceGRAYScale
 * @see ColorConvertDescriptor
 */
public final ImageWorker forceColorSpaceGRAYScale() {
  if (!isColorSpaceRGB()) {
    final ColorModel cm = new ComponentColorModel(
        ColorSpace.getInstance(ColorSpace.CS_GRAY), false, false,
        Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    image = ColorConvertDescriptor.create(image, cm, getRenderingHints());
    invalidateStatistics();
  }
  // All post conditions for this method contract.
  assert isColorSpaceGRAYScale();
  return this;
}
origin: org.geotools/gt-coverage

/**
 * Forces the {@linkplain #image} color model to the
 * {@linkplain ColorSpace#CS_GRAY GRAYScale color space}. If the current
 * color space is already of {@linkplain ColorSpace#TYPE_GRAY  type}, then
 * this method does nothing.
 *
 * @return this {@link ImageWorker}.
 *
 * @see #isColorSpaceGRAYScale
 * @see ColorConvertDescriptor
 */
public final ImageWorker forceColorSpaceGRAYScale() {
  if (!isColorSpaceRGB()) {
    final ColorModel cm = new ComponentColorModel(
        ColorSpace.getInstance(ColorSpace.CS_GRAY), false, false,
        Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    image = ColorConvertDescriptor.create(image, cm, getRenderingHints());
    invalidateStatistics();
  }
  // All post conditions for this method contract.
  assert isColorSpaceGRAYScale();
  return this;
}
origin: org.geotools/gt2-coverage

/**
 * Forces the {@linkplain #image} color model to the
 * {@linkplain ColorSpace#CS_sRGB RGB color space}. If the current color
 * space is already of {@linkplain ColorSpace#TYPE_RGB RGB type}, then this
 * method does nothing. This operation may loose the alpha channel.
 *
 * @return this {@link ImageWorker}.
 *
 * @see #isColorSpaceRGB
 * @see ColorConvertDescriptor
 */
public final ImageWorker forceColorSpaceRGB() {
  if (!isColorSpaceRGB()) {
    final ColorModel cm = new ComponentColorModel(
        ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false,
        Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    image = ColorConvertDescriptor.create(image, cm, getRenderingHints());
    invalidateStatistics();
  }
  // All post conditions for this method contract.
  assert isColorSpaceRGB();
  return this;
}
origin: org.geotools/gt-coverage

/** Forces the provided {@link ColorModel} via the JAI ColorConvert operation.*/
private void forceColorModel(final ColorModel cm){
      
  final org.jaitools.imageutils.ImageLayout2 il = new org.jaitools.imageutils.ImageLayout2(image);
  il.setColorModel(cm);
  il.setSampleModel(cm.createCompatibleSampleModel(image.getWidth(), image.getHeight()));
  final RenderingHints oldRi = this.getRenderingHints();
  final RenderingHints newRi = (RenderingHints) oldRi.clone();
  newRi.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il));
  setRenderingHints(newRi);
  image = ColorConvertDescriptor.create(image, cm, getRenderingHints());
  // restore RI
  this.setRenderingHints(oldRi);
  // invalidate stats
  invalidateStatistics();
}
origin: geosolutions-it/jai-ext

  imageCalculated = javax.media.jai.operator.ColorConvertDescriptor.create(image,
      colorModel, null);
} else {
javax.media.jai.operatorColorConvertDescriptor

Most used methods

  • create

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • ImageIO (javax.imageio)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now