cz.cuni.jagrlib
Class BinaryOperation

java.lang.Object
  extended by cz.cuni.jagrlib.BinaryOperation

public class BinaryOperation
extends java.lang.Object

Binary operations used in set*() drawing methods. All 16 binary mappings are coded into one integer ( [oldBit,newBit] -> resultBit).

Since:
0.02
See Also:
BinaryOperation.java, interface BitMask, interface RasterGraphics

Field Summary
static int BIN_OP_0010
          Old & Not(New) /= Old subtract New/ .. code = 0010.
static int BIN_OP_0100
          Not(Old) & New /= New subtract Old/ .. code = 0100.
static int BIN_OP_1011
          Old | Not(New) .. code = 1011.
static int BIN_OP_1101
          Not(Old) | New .. code = 1101.
static int BIN_OP_AND
          And .. code = 0001.
static int BIN_OP_DUMMY
          Dummy .. code = 0011.
static int BIN_OP_EQUAL
          Equal .. code = 1001.
static int BIN_OP_NAND
          Not(And) .. code = 1110.
static int BIN_OP_NEGATE
          Negate .. code = 1100.
static int BIN_OP_NOR
          Not(Or) .. code = 1000.
static int BIN_OP_NSET
          Not(Set) .. code = 1010.
static int BIN_OP_ONE
          One .. code = 1111.
static int BIN_OP_OR
          Or .. code = 0111.
static int BIN_OP_SET
          Set .. code = 0101.
static int BIN_OP_SUB_INV
           
static int BIN_OP_SUBTRACT
           
static int BIN_OP_XOR
          Xor .. code = 0110.
static int BIN_OP_ZERO
          Zero .. code = 0000.
 
Constructor Summary
BinaryOperation()
           
 
Method Summary
static boolean boolOp(int op, boolean canvas, boolean brush)
          Returns the binary-op result.
static int stationaryOp(int op)
          Returns the stationary closure of a binary operation (0 in brush plane must not change anything).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIN_OP_ZERO

public static final int BIN_OP_ZERO
Zero .. code = 0000.

See Also:
Constant Field Values

BIN_OP_NOR

public static final int BIN_OP_NOR
Not(Or) .. code = 1000.

See Also:
Constant Field Values

BIN_OP_0100

public static final int BIN_OP_0100
Not(Old) & New /= New subtract Old/ .. code = 0100.

See Also:
Constant Field Values

BIN_OP_SUB_INV

public static final int BIN_OP_SUB_INV
See Also:
Constant Field Values

BIN_OP_NEGATE

public static final int BIN_OP_NEGATE
Negate .. code = 1100.

See Also:
Constant Field Values

BIN_OP_0010

public static final int BIN_OP_0010
Old & Not(New) /= Old subtract New/ .. code = 0010.

See Also:
Constant Field Values

BIN_OP_SUBTRACT

public static final int BIN_OP_SUBTRACT
See Also:
Constant Field Values

BIN_OP_NSET

public static final int BIN_OP_NSET
Not(Set) .. code = 1010.

See Also:
Constant Field Values

BIN_OP_XOR

public static final int BIN_OP_XOR
Xor .. code = 0110.

See Also:
Constant Field Values

BIN_OP_NAND

public static final int BIN_OP_NAND
Not(And) .. code = 1110.

See Also:
Constant Field Values

BIN_OP_AND

public static final int BIN_OP_AND
And .. code = 0001.

See Also:
Constant Field Values

BIN_OP_EQUAL

public static final int BIN_OP_EQUAL
Equal .. code = 1001.

See Also:
Constant Field Values

BIN_OP_SET

public static final int BIN_OP_SET
Set .. code = 0101.

See Also:
Constant Field Values

BIN_OP_1101

public static final int BIN_OP_1101
Not(Old) | New .. code = 1101.

See Also:
Constant Field Values

BIN_OP_DUMMY

public static final int BIN_OP_DUMMY
Dummy .. code = 0011.

See Also:
Constant Field Values

BIN_OP_1011

public static final int BIN_OP_1011
Old | Not(New) .. code = 1011.

See Also:
Constant Field Values

BIN_OP_OR

public static final int BIN_OP_OR
Or .. code = 0111.

See Also:
Constant Field Values

BIN_OP_ONE

public static final int BIN_OP_ONE
One .. code = 1111.

See Also:
Constant Field Values
Constructor Detail

BinaryOperation

public BinaryOperation()
Method Detail

boolOp

public static final boolean boolOp(int op,
                                   boolean canvas,
                                   boolean brush)
Returns the binary-op result.

Parameters:
op - Binary operation code.
canvas - The original (canvas) boolean value.
brush - The drawn (brush) boolean value.
Returns:
The result boolean value.

stationaryOp

public static final int stationaryOp(int op)
Returns the stationary closure of a binary operation (0 in brush plane must not change anything).

Parameters:
op - The binary operation.
Returns:
The stationary closure of the operation.