Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/sixlegs/image/png/BitMover2G.java


1   // Copyright (C) 1998, 1999, 2001 Chris Nokleberg
2   // Please see included LICENSE.TXT
3   
4   package com.sixlegs.image.png;
5   
6   import java.io.IOException;
7   import java.io.InputStream;
8   
9   final class BitMover2G
10  extends BitMover
11  {
12      int fill(int[] pixels, InputStream str, int off, int len)
13      throws IOException
14      {
15          for (int n = 0; n < len; n++) {
16              int x = str.read();
17              int p1 = x >>> 6 & 0x03, p2 = x >>> 4 & 0x03, p3 = x >>> 2 & 0x03, p4 = x & 0x03;
18              pixels[off++] = (p1 == transgray ? 0 : 0xF0000000) | gammaTable[p1];
19              pixels[off++] = (p2 == transgray ? 0 : 0xF0000000) | gammaTable[p2];
20              pixels[off++] = (p3 == transgray ? 0 : 0xF0000000) | gammaTable[p3];
21              pixels[off++] = (p4 == transgray ? 0 : 0xF0000000) | gammaTable[p4];
22          }
23          return off;
24      }
25  }