コード例 #1
0
 /**
  * Creates a new record based on the data stored in the MfCommand.
  *
  * @return the created record.
  */
 public MfRecord getRecord() {
   final Point dest = getDestination();
   final MfRecord record = new MfRecord(RECORD_SIZE);
   record.setParam(POS_Y, dest.y);
   record.setParam(POS_X, dest.x);
   return record;
 }
コード例 #2
0
 public void setRecord(final MfRecord record) {
   final int bottom = record.getParam(POS_BOTTOM);
   final int right = record.getParam(POS_RIGHT);
   final int top = record.getParam(POS_TOP);
   final int left = record.getParam(POS_LEFT);
   setBounds(left, top, right - left, bottom - top);
 }
コード例 #3
0
 /**
  * Creates a new record based on the data stored in the MfCommand.
  *
  * @return the created record.
  */
 public MfRecord getRecord() throws RecordCreationException {
   final MfRecord record = new MfRecord(RECORD_SIZE);
   final Point p = getTarget();
   record.setParam(POS_X, p.x);
   record.setParam(POS_Y, p.y);
   return record;
 }
コード例 #4
0
 /** Writer function */
 public MfRecord getRecord() {
   final Rectangle rc = getBounds();
   final MfRecord record = new MfRecord(RECORD_SIZE);
   record.setParam(POS_BOTTOM, (int) (rc.getY() + rc.getHeight()));
   record.setParam(POS_RIGHT, (int) (rc.getX() + rc.getWidth()));
   record.setParam(POS_TOP, (int) (rc.getY()));
   record.setParam(POS_LEFT, (int) (rc.getX()));
   return record;
 }
コード例 #5
0
  /**
   * Reads the command data from the given record and adjusts the internal parameters according to
   * the data parsed.
   *
   * <p>This method is not implemented, as a Palette implementation is still missing.
   *
   * @param record the record.
   */
  public void setRecord(final MfRecord record) {
    // the handle to the palette object ignored
    final int hPalette = record.getParam(POS_HPALETTE);
    setHPalette(hPalette);
    // the number of defined entries ...
    final int cEntries = record.getParam(POS_CENTRIES);
    final Color[] colors = new Color[cEntries];

    for (int i = 0; i < cEntries; i++) {
      final int cr = record.getLongParam(i * 2 + POS_START_ENTRIES);
      final GDIColor color = new GDIColor(cr);
      colors[i] = color;
    }
    setEntries(colors);
  }
コード例 #6
0
  /**
   * Creates a new record based on the data stored in the MfCommand. <i>This function may or may not
   * work, there is not much HQ documentation about metafiles available in the net. </i>
   *
   * @return the created record.
   */
  public MfRecord getRecord() throws RecordCreationException {
    final int cEntries = getEntriesCount();
    if (cEntries == 0) {
      throw new RecordCreationException("Empty CreatePaletteRecord is not valid");
    }

    final MfRecord record = new MfRecord(2 + cEntries * 2);
    record.setParam(POS_HPALETTE, getHPalette());
    record.setParam(POS_CENTRIES, cEntries);
    for (int i = 0; i < cEntries; i++) {
      final Color c = colors[i];
      // a long parameter is 2 words long
      record.setLongParam(i * 2 + POS_START_ENTRIES, GDIColor.translateColor(c));
    }
    return record;
  }
コード例 #7
0
 /**
  * Creates a new record based on the data stored in the MfCommand.
  *
  * @return the created record.
  */
 public MfRecord getRecord() throws RecordCreationException {
   final MfRecord record = new MfRecord(RECORD_SIZE);
   record.setParam(POS_TEXT_CHAR_EXTRA, getTextCharExtra());
   return record;
 }
コード例 #8
0
 /**
  * Reads the command data from the given record and adjusts the internal parameters according to
  * the data parsed.
  *
  * <p>After the raw record was read from the datasource, the record is parsed by the concrete
  * implementation.
  *
  * @param record the raw data that makes up the record.
  */
 public void setRecord(final MfRecord record) {
   final int id = record.getParam(POS_TEXT_CHAR_EXTRA);
   setTextCharExtra(id);
 }
コード例 #9
0
 /**
  * Reads the command data from the given record and adjusts the internal parameters according to
  * the data parsed.
  *
  * <p>After the raw record was read from the datasource, the record is parsed by the concrete
  * implementation.
  *
  * @param record the raw data that makes up the record.
  */
 public void setRecord(final MfRecord record) {
   final int y = record.getParam(POS_Y);
   final int x = record.getParam(POS_X);
   setDestination(x, y);
 }
コード例 #10
0
 /**
  * Reads the command data from the given record and adjusts the internal parameters according to
  * the data parsed.
  *
  * <p>After the raw record was read from the datasource, the record is parsed by the concrete
  * implementation.
  *
  * @param record the raw data that makes up the record.
  */
 public void setRecord(final MfRecord record) {
   final int y = record.getParam(POS_Y);
   final int x = record.getParam(POS_X);
   setTarget(x, y);
 }