1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.bmp;
18
19 import java.io.IOException;
20
21 import org.apache.commons.imaging.ImagingException;
22 import org.apache.commons.imaging.common.ImageBuilder;
23
24 abstract class AbstractPixelParserSimple extends AbstractPixelParser {
25 AbstractPixelParserSimple(final BmpHeaderInfo bhi, final byte[] colorTable, final byte[] imageData) {
26 super(bhi, colorTable, imageData);
27 }
28
29 public abstract int getNextRgb() throws ImagingException, IOException;
30
31 public abstract void newline() throws ImagingException, IOException;
32
33 @Override
34 public void processImage(final ImageBuilder imageBuilder) throws ImagingException, IOException {
35 for (int y = bhi.height - 1; y >= 0; y--) {
36 for (int x = 0; x < bhi.width; x++) {
37 final int rgb = getNextRgb();
38
39 imageBuilder.setRgb(x, y, rgb);
40
41 }
42 newline();
43 }
44 }
45 }