Java Code Examples for net.imglib2.type.numeric.ARGBType#rgba()
The following examples show how to use
net.imglib2.type.numeric.ARGBType#rgba() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrthoSliceFX.java From paintera with GNU General Public License v2.0 | 5 votes |
private void setTextureOpacityAndShading(final Texture texture, final Interval interval) { // NOTE: the opacity property of the MeshView object does not have any effect. // But the transparency can still be controlled by modifying the alpha channel in the texture images. final double alpha = this.opacity.get(); final double shading = this.shading.get(); final BufferExposingWritableImage[] targetImages = {texture.selfIlluminationMapImage, texture.diffuseMapImage}; final double[] brightnessFactors = {1 - shading, shading}; final RandomAccessibleInterval<ARGBType> src = Views.interval(texture.originalImage.asArrayImg(), interval); for (int i = 0; i < 2; ++i) { final BufferExposingWritableImage targetImage = targetImages[i]; final double brightnessFactor = brightnessFactors[i]; final RandomAccessibleInterval<ARGBType> dst = Views.interval(targetImage.asArrayImg(), interval); final Cursor<ARGBType> srcCursor = Views.flatIterable(src).cursor(); final Cursor<ARGBType> dstCursor = Views.flatIterable(dst).cursor(); while (dstCursor.hasNext()) { final int srcArgb = srcCursor.next().get(); final int dstArgb = ARGBType.rgba( ARGBType.red(srcArgb) * brightnessFactor, ARGBType.green(srcArgb) * brightnessFactor, ARGBType.blue(srcArgb) * brightnessFactor, alpha * 255); dstCursor.next().set(PixelUtils.NonPretoPre(dstArgb)); } } Arrays.stream(targetImages).forEach(BufferExposingWritableImage::setPixelsDirty); }
Example 2
Source File: Colors.java From paintera with GNU General Public License v2.0 | 5 votes |
public static ARGBType toARGBType(final Color color) { final int r = (int) Math.round(255 * color.getRed()); final int g = (int) Math.round(255 * color.getGreen()); final int b = (int) Math.round(255 * color.getBlue()); final int a = (int) Math.round(255 * color.getOpacity()); final ARGBType argb = new ARGBType(ARGBType.rgba(r, g, b, a)); LOG.debug("color={} argb={}", color, argb); return argb; }
Example 3
Source File: ARGBColorConverter.java From paintera with GNU General Public License v2.0 | 5 votes |
private void update() { final double scale = 1.0 / (max.get() - min.get()); final int value = color.get().get(); A = (int) Math.min(Math.max(Math.round(255 * alphaProperty().get()), 0), 255); scaleR = ARGBType.red(value) * scale; scaleG = ARGBType.green(value) * scale; scaleB = ARGBType.blue(value) * scale; black = ARGBType.rgba(0, 0, 0, A); }