示例#1
0
void TScannerParameters::saveData(TOStream &os) const {
  std::map<std::string, std::string> attr;
  attr["fmt"] = m_paperFormat;
  os.openCloseChild("paper", attr);

  if (m_paperFeeder.m_value == 1.0) {
    attr.clear();
    os.openCloseChild("autoFeeder", attr);
  }

  if (m_reverseOrder) {
    attr.clear();
    os.openCloseChild("reverseOrder", attr);
  }

  if (m_scanType != None) {
    std::string scanTypeString = Rgbcolors;
    switch (m_scanType) {
    case BW:
      scanTypeString = BlackAndWhite;
      break;
    case GR8:
      scanTypeString = Graytones;
      break;
    case RGB24:
      scanTypeString = Rgbcolors;
      break;
    }
    attr.clear();
    attr["value"] = scanTypeString;
    os.openCloseChild("mode", attr);
  }

  if (m_dpi.m_supported) {
    attr.clear();
    attr["value"] = std::to_string(m_dpi.m_value);
    os.openCloseChild("dpi", attr);
  }

  if (m_brightness.m_supported) {
    attr.clear();
    attr["value"] = std::to_string(m_brightness.m_value);
    os.openCloseChild("brightness", attr);
  }

  if (m_contrast.m_supported) {
    attr.clear();
    attr["value"] = std::to_string(m_contrast.m_value);
    os.openCloseChild("contrast", attr);
  }

  if (m_threshold.m_supported) {
    attr.clear();
    attr["value"] = std::to_string(m_threshold.m_value);
    os.openCloseChild("threshold", attr);
  }
}
void CleanupParameters::saveData(TOStream &os) const
{
	CleanupParameters::LastSavedParameters.assign(this);

	os.openChild("cleanupCamera");
	m_camera.saveData(os);
	os.closeChild();

	os.openChild("cleanupPalette");
	m_cleanupPalette->saveData(os);
	os.closeChild();

	std::map<std::string, std::string> attr;
	if (m_autocenterType != AUTOCENTER_NONE) {
		attr.clear();
		attr["type"] = toString((int)m_autocenterType);
		attr["pegHoles"] = toString((int)m_pegSide);
		//attr["fieldGuide"] = toString((int)m_pegSide);
		os.openCloseChild("autoCenter", attr);
	}

	if (m_flipx || m_flipy || m_rotate != 0 //|| m_scale!=1
		|| m_offx != 0 || m_offy != 0) {
		attr.clear();
		std::string flip = std::string(m_flipx ? "x" : "") + std::string(m_flipy ? "y" : "");
		if (flip != "")
			attr["flip"] = flip;
		if (m_rotate != 0)
			attr["rotate"] = toString(m_rotate);
		//if(m_scale!=1) attr["scale"] = toString(m_scale);
		if (m_offx != 0.0)
			attr["xoff"] = toString(m_offx);
		if (m_offy != 0.0)
			attr["yoff"] = toString(m_offy);
		os.openCloseChild("transform", attr);
	}

	if (m_lineProcessingMode != lpNone) {
		attr.clear();
		attr["sharpness"] = toString(m_sharpness);
		attr["autoAdjust"] = toString((int)m_autoAdjustMode);
		attr["mode"] = (m_lineProcessingMode == lpGrey ? "grey" : "color");
		os.openCloseChild("lineProcessing", attr);
	}
	if (m_noAntialias) {
		attr.clear();
		os.openCloseChild("noAntialias", attr);
	}
	if (m_postAntialias) {
		attr.clear();
		os.openCloseChild("MLAA", attr);
	}
	attr.clear();
	attr["value"] = toString(m_despeckling);
	os.openCloseChild("despeckling", attr);
	attr.clear();
	attr["value"] = toString(m_aaValue);
	os.openCloseChild("aaValue", attr);
	attr.clear();
	attr["value"] = toString(m_closestField);
	os.openCloseChild("closestField", attr);
	attr.clear();
	attr["name"] = m_fdgInfo.m_name;
	os.openCloseChild("fdg", attr);
	attr.clear();
	if (m_path != TFilePath())
		os.child("path") << m_path;

	// attr["path"] = toString(m_path.getWideString());
	// os.openCloseChild("path", attr);

	//m_closestField = param->m_closestField;
	//m_autoAdjustMode = param->m_autoAdjustMode;
	//m_sharpness = param->m_sharpness;
	//m_transparencyCheckEnabled = param->m_transparencyCheckEnabled;
}