22 package com.realtime.crossfire.jxclient.faces;
24 import java.util.HashMap;
26 import java.util.Map.Entry;
27 import org.jetbrains.annotations.NotNull;
61 private final Map<Integer, Integer>
pixels =
new HashMap<>();
69 public RawScale8d(@NotNull
final int[] imageData,
final int dataWidth,
final int dataHeight) {
74 dstImage =
new int[imageData.length*4];
84 dstImage[x+y*width/8] = p;
94 return srcImage[x+y*
width];
102 private void process(
final int x,
final int y) {
104 for (
int dx = 0; dx < 8; dx++) {
105 for (
int dy = 0; dy < 8; dy++) {
108 final Integer count = pixels.get(value);
109 pixels.put(value, count == null ? 1 : count+1);
115 for (
final Entry<Integer, Integer> e : pixels.entrySet()) {
116 final int thisCount = e.getValue();
117 if (thisCount > maxCount) {
118 maxCount = thisCount;
119 maxPixel = e.getKey();
135 for (
int x = 0; x < width/8; x++) {
136 for (
int y = 0; y < height/8; y++) {
int getSourcePixel(final int x, final int y)
Gets a pixel from the source image.
int [] getScaledData()
Returns the scale image data.
final int [] dstImage
The destination image data.
final int [] srcImage
The source image data.
final int height
The height of the source image.
void setDestPixel(final int x, final int y, final int p)
Sets a pixel in the destination image data.
final Map< Integer, Integer > pixels
Maps pixel value to number of pixels.
RawScale8d(@NotNull final int[] imageData, final int dataWidth, final int dataHeight)
Creates a new instance.
Scales down a raw image to an eighth in both dimensions.
final int width
The width of the source image.
void process(final int x, final int y)
Processes a specific destination pixel.