View Javadoc

1   // Copyright 2002-2003, FreeHEP.
2   package org.freehep.graphicsio.emf.gdi;
3   
4   import java.io.IOException;
5   
6   import org.freehep.graphicsio.emf.EMFConstants;
7   import org.freehep.graphicsio.emf.EMFInputStream;
8   import org.freehep.graphicsio.emf.EMFOutputStream;
9   
10  /**
11   * EMF BitmapInfoHeader
12   * 
13   * @author Mark Donszelmann
14   * @version $Id: BlendFunction.java 10363 2007-01-20 15:30:50Z duns $
15   */
16  public class BlendFunction implements EMFConstants {
17  
18      public static final int size = 4;
19  
20      private int blendOp;
21  
22      private int blendFlags;
23  
24      private int sourceConstantAlpha;
25  
26      private int alphaFormat;
27  
28      public BlendFunction(int blendOp, int blendFlags, int sourceConstantAlpha,
29              int alphaFormat) {
30          this.blendOp = blendOp;
31          this.blendFlags = blendFlags;
32          this.sourceConstantAlpha = sourceConstantAlpha;
33          this.alphaFormat = alphaFormat;
34      }
35  
36      public BlendFunction(EMFInputStream emf) throws IOException {
37          blendOp = emf.readUnsignedByte();
38          blendFlags = emf.readUnsignedByte();
39          sourceConstantAlpha = emf.readUnsignedByte();
40          alphaFormat = emf.readUnsignedByte();
41      }
42  
43      public void write(EMFOutputStream emf) throws IOException {
44          emf.writeBYTE(blendOp);
45          emf.writeBYTE(blendFlags);
46          emf.writeBYTE(sourceConstantAlpha);
47          emf.writeBYTE(alphaFormat);
48      }
49  
50      public String toString() {
51          return "BlendFunction";
52      }
53  
54      public int getSourceConstantAlpha() {
55          return sourceConstantAlpha;
56      }
57  
58      public int getAlphaFormat() {
59          return alphaFormat;
60      }
61  }