Changeset 221

Show
Ignore:
Timestamp:
04/22/06 13:07:33 (2 years ago)
Author:
goodea
Message:

skeleton in place

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • misc/java/src/edu/cmu/cs/cc3/misc/FakePixbuf.java

    r220 r221  
    99 
    1010    public FakePixbuf() { 
    11         super(); 
    12  
    13         rawWidth = 88 * 2; 
    14         rawHeight = 144; 
     11        super(88 * 2, 144); 
    1512 
    1613        // load the image 
  • misc/java/src/edu/cmu/cs/cc3/misc/Pixbuf.java

    r220 r221  
    1010    final static public int CHANNEL_ALL = 3; 
    1111 
    12     int rawWidth, rawHeight; 
     12    final int rawWidth, rawHeight; 
    1313 
    14     int x0, y0, x1 = rawWidth + 1, y1 = rawHeight + 1; 
     14    int x0, y0, x1, y1; 
    1515 
    1616    int yLoc; 
     
    2222    int width, height; 
    2323 
    24     public Pixbuf() { 
     24    Pixbuf(int rawW, int rawH) { 
     25        rawWidth = rawW; 
     26        rawHeight = rawH; 
     27         
     28        x1 = rawWidth; 
     29        y1 = rawHeight; 
     30 
    2531        updateFrameBounds(); 
    2632    } 
     
    9399    public byte[] allocateRows(int rows) { 
    94100        int p = coi == CHANNEL_ALL ? 3 : 1; 
     101         
     102        System.out.println("allocate " + p + " * " + getWidth() + " * " + rows); 
     103         
    95104        return new byte[p * getWidth() * rows]; 
    96105    } 
  • misc/java/src/edu/cmu/cs/cc3/misc/Test.java

    r220 r221  
    2222        j.setSize(400, 400); 
    2323 
    24         JLabel jp = new JLabel(); 
    25  
    2624        j.setBackground(Color.BLACK); 
    2725 
     
    2927                ColorSpace.TYPE_RGB); 
    3028 
    31         jp.setIcon(new ImageIcon(b)); 
    32         jp.setBackground(Color.BLACK); 
     29        fillImage(b, p); 
     30 
     31        System.out.println(b); 
     32         
     33        JLabel jp = new JLabel(new ImageIcon(b)); 
    3334        j.getContentPane().add(jp); 
    34          
     35 
    3536        j.setVisible(true); 
    3637    } 
    3738 
    38      
    39      
     39    private static void fillImage(BufferedImage b, Pixbuf p) { 
     40        p.rewind(); 
     41 
     42        byte row[] = p.allocateRows(1); 
     43 
     44        System.out.println(row.length); 
     45        System.out.println("w: " + p.getWidth() + ", h: " + p.getHeight()); 
     46        for (int y = 0; y < p.getHeight(); y++) { 
     47            int i = 0; 
     48            p.readRows(row, 1); 
     49            for (int x = 0; x < p.getWidth(); x++) { 
     50                b.setRGB(x, y, row[i] << 16 | row[i + 1] << 8 | row[i + 2]); 
     51                i += 3; 
     52            } 
     53        } 
     54    } 
     55 
    4056}