java.awt.image.WritableRenderedImage.getSampleModel()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(317)

本文整理了Java中java.awt.image.WritableRenderedImage.getSampleModel()方法的一些代码示例,展示了WritableRenderedImage.getSampleModel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableRenderedImage.getSampleModel()方法的具体详情如下:
包路径:java.awt.image.WritableRenderedImage
类名称:WritableRenderedImage
方法名:getSampleModel

WritableRenderedImage.getSampleModel介绍

暂无

代码示例

代码示例来源:origin: Geomatys/geotoolkit

  1. /**
  2. * <p>Fill destination image area from interpolation of source pixels from imageSrc.<br/>
  3. * Source pixel coordinates is obtained from invert transformation of destination pixel coordinates.<br/><br/>
  4. * - In case where interpolation equals {@linkplain InterpolationCase#LANCZOS lanczos interpolation} the default
  5. * choosen lanczos window is initialized by value 2.<br/>
  6. * - The default border comportement is define as {@link ResampleBorderComportement#FILL_VALUE}<br/>
  7. * - In case where pixel transformation is out of source image boundary the default choosen fill value is {@link Double#NaN}.<br/><br/>
  8. *
  9. * <strong>
  10. * Moreover : the specified MathTransform should be from CENTER of target image point to CENTER of source image point.<br/>
  11. * The used MathTransform is consider as {@link PixelInCell#CELL_CENTER} configuration.</strong></p>
  12. *
  13. * @param mathTransform Transformation use to transform target point to source point.
  14. * @param imageDest image will be fill by image source pixel interpolation.
  15. * @param imageSrc source image which contain pixel values which will be interpolate.
  16. * @param interpolation case of interpolation.
  17. * @throws NoninvertibleTransformException if it is impossible to invert {@code MathTransform} parameter.
  18. * @see ResampleBorderComportement
  19. * @see LanczosInterpolation#LanczosInterpolation(org.geotoolkit.image.iterator.PixelIterator, int)
  20. */
  21. public Resample(MathTransform mathTransform, WritableRenderedImage imageDest,
  22. RenderedImage imageSrc, InterpolationCase interpolation) throws TransformException {
  23. this(mathTransform, imageDest, null, imageSrc, interpolation, 2, ResampleBorderComportement.FILL_VALUE, new double[imageDest.getSampleModel().getNumBands()]);
  24. }

代码示例来源:origin: Geomatys/geotoolkit

  1. /**
  2. * Colors an area of connected pixels with the same set of color.
  3. * The fill is performed in place in the given image.
  4. * The operation is performed immediately; it is not deferred like usual JAI operations.
  5. *
  6. * @param image The image in which to colors an area.
  7. * @param oldValues The colors to replace (usually only 1 color, but more are allowed).
  8. * @param newValues The new colors replacing the old ones.
  9. * @param points The coordinate of the starting point. There is usually only one
  10. * such point, but more are allowed.
  11. */
  12. public static void fill(final WritableRenderedImage image, final double[][] oldValues,
  13. final double[] newValues, final Point... points)
  14. {
  15. /*
  16. * Copies the old values in a set of SampleValues objects. The exact type of SampleValues
  17. * will depend on the transfer type.
  18. */
  19. final int transferType = image.getSampleModel().getTransferType();
  20. final Set<SampleValues> oldSamples = new HashSet<>(hashMapCapacity(oldValues.length));
  21. for (final double[] samples : oldValues) {
  22. oldSamples.add(SampleValues.getInstance(transferType, samples));
  23. }
  24. final SampleValues newSamples = SampleValues.getInstance(transferType, newValues);
  25. oldSamples.remove(newSamples); // Necessary for avoiding infinite loop.
  26. if (oldSamples.isEmpty()) {
  27. return;
  28. }
  29. fill(image, oldSamples::contains, newSamples, points);
  30. }

代码示例来源:origin: Geomatys/geotoolkit

  1. /**
  2. * Colors an area of connected pixels with the same set of color.
  3. * The fill is performed in place in the given image.
  4. * The operation is performed immediately; it is not deferred like usual JAI operations.
  5. *
  6. * @param image The image in which to colors an area.
  7. * @param oldColors The colors to replace (usually only 1 color, but more are allowed).
  8. * @param newColors The new colors replacing the old ones.
  9. * @param points The coordinate of the starting point. There is usually only one
  10. * such point, but more are allowed.
  11. */
  12. public static void fill(final WritableRenderedImage image, final Color[] oldColors,
  13. final Color newColors, final Point... points)
  14. {
  15. final int numBands = image.getSampleModel().getNumBands();
  16. final double[][] oldValues = new double[oldColors.length][];
  17. for (int i=0; i<oldValues.length; i++) {
  18. oldValues[i] = ColorUtilities.toDoubleValues(oldColors[i], numBands);
  19. }
  20. final double[] newValues = ColorUtilities.toDoubleValues(newColors, numBands);
  21. fill(image, oldValues, newValues, points);
  22. }

代码示例来源:origin: apache/sis

  1. destination = output;
  2. if (output != null) {
  3. if (!input.getSampleModel().equals(output.getSampleModel())) {
  4. throw new IllegalArgumentException(Resources.format(Resources.Keys.MismatchedSampleModel));
  5. } else if (input.getMinX() != output.getMinX() ||

代码示例来源:origin: Geomatys/geotoolkit

  1. || renderedImage.getWidth() != writableRI.getWidth()
  2. || renderedImage.getHeight() != writableRI.getHeight()
  3. || renderedImage.getSampleModel().getNumBands() != writableRI.getSampleModel().getNumBands())
  4. throw new IllegalArgumentException("rendered image and writable rendered image dimensions are not conform.\n" +
  5. "First : "+renderedImage+"\nSecond : "+writableRI);

代码示例来源:origin: Geomatys/geotoolkit

  1. if (renderedImage.getSampleModel().getNumBands() != writableRI.getSampleModel().getNumBands())
  2. throw new IllegalArgumentException("renderedImage and writableRenderedImage haven't got same band number");
  3. final int riMinX = renderedImage.getMinX();

代码示例来源:origin: Geomatys/geotoolkit

  1. destCoords = new double[2];
  2. this.rbc = rbc;
  3. this.clamp = getClamp(imageDest.getSampleModel().getDataType());

代码示例来源:origin: Geomatys/geotoolkit

  1. this.clamp = getClamp(imageDest.getSampleModel().getDataType());

相关文章