本文整理汇总了C#中ConfigManager.save方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigManager.save方法的具体用法?C# ConfigManager.save怎么用?C# ConfigManager.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: makeSampleConfig
/// <summary>
/// Fill the config manager with a default configuration.
/// </summary>
/// <param name="config"></param>
public static void makeSampleConfig(ConfigManager config)
{
if (config == null) {
return;
}
int counter = 1; // number of the preset to preserve the order
// ----------------------------------------------
// Thresholding
HalftoneAlgorithm halftoneAlgorithm = new HalftoneAlgorithm();
ThresholdHalftoneMethod thresholdHalftoneMethod =
new ThresholdHalftoneMethod();
halftoneAlgorithm.Method = thresholdHalftoneMethod;
halftoneAlgorithm.Name = String.Format("[{0:d2}] Thresholding", counter);
halftoneAlgorithm.Description = "Simple threshold at 50% grey";
config.saveModule(halftoneAlgorithm, false);
counter++;
// ----------------------------------------------
// Random dither with white noise
DynamicMatrixThresholdFilter dynamicThresholdFilter =
new DynamicMatrixThresholdFilter();
dynamicThresholdFilter.MatrixTable.addDefinitionRecord(
new DynamicMatrixThresholdFilter.ThresholdRecord(
0, ThresholdMatrix.Samples.simpleThreshold, 1.0));
thresholdHalftoneMethod.ThresholdFilter = dynamicThresholdFilter;
halftoneAlgorithm.Name =
String.Format("[{0:d2}] Random dither", counter);
halftoneAlgorithm.Description = "Threshold perturbed with white noise";
config.saveModule(halftoneAlgorithm, false);
counter++;
// ----------------------------------------------
// Bayer matrix
thresholdHalftoneMethod.ThresholdFilter = new MatrixThresholdFilter(
ThresholdMatrix.Samples.createBayerDispersedDotMatrix(3));
halftoneAlgorithm.Name =
String.Format("[{0:d2}] Ordered dither with Bayer matrix", counter);
halftoneAlgorithm.Description = "Recursive tesselation matrix 8x8";
config.saveModule(halftoneAlgorithm, false);
counter++;
// -------------------- SCREENING METHODS --------------------
// Clustered-dot hand coded threshold matrix
thresholdHalftoneMethod.ThresholdFilter = new MatrixThresholdFilter(
ThresholdMatrix.Samples.sampleScreenMatrix);
halftoneAlgorithm.Name =
String.Format("[{0:d2}] Screen - Clustered-dot threshold matrix", counter);
halftoneAlgorithm.Description = "Hand-coded threshold matrix 8x8 with 45 angle";
config.saveModule(halftoneAlgorithm, false);
counter++;
// ----------------------------------------------
// Spot function - Eulid dot
thresholdHalftoneMethod.ThresholdFilter = new SpotFunctionThresholdFilter(
SpotFunction.Samples.euclidDot);
halftoneAlgorithm.Name =
String.Format("[{0:d2}] Screen - Spot function", counter);
halftoneAlgorithm.Description = "Euclid-dot spot function - computed on-the-fly\nEuclid dot: angle = 45 deg, distance: 10 px";
config.saveModule(halftoneAlgorithm, false);
counter++;
// ----------------------------------------------
// Patterning
thresholdHalftoneMethod.ThresholdFilter = new MatrixThresholdFilter(
new ThresholdMatrix(new int[,] { { 1, 2 }, { 3, 4 } }));
halftoneAlgorithm.PreResize = new HalftoneAlgorithm.Resize()
{
Factor = 2.0,
Interpolation = HalftoneAlgorithm.Resize.InterpolationType.NearestNeighbour
};
halftoneAlgorithm.Name =
String.Format("[{0:d2}] Screen - Patterning", counter);
halftoneAlgorithm.Description = "Resize 2x via Nearest-neighbour interpolation\n2x2 matrix threshold";
config.saveModule(halftoneAlgorithm, false);
counter++;
halftoneAlgorithm.PreResize = null;
// -------------------- ERROR DIFFUSION METHODS --------------------
// Floyd-Steinberg
thresholdHalftoneMethod.ThresholdFilter = new MatrixThresholdFilter();
//.........这里部分代码省略.........