Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        protected override void OnPreviewMouseWheel(MouseState mouseState, ref bool handled)
        {
            if (mouseState.IsCtrl)
            {
                _zoomLevel += mouseState.WheelNotchY;
#warning とりあえず
                _zoomLevel = MathUtil.Clamp(_zoomLevel, -10, 22);
                ZoomRate   = Math.Pow(1.1, _zoomLevel);

                AsciiFont.Dispose();
                AsciiFont = CanvasContext.CreateFont(_settings.fonts.asciiFont.name, _settings.fonts.asciiFont.height * ZoomRate);
                JpFont.Dispose();
                JpFont = CanvasContext.CreateFont(_settings.fonts.jpFont.name, _settings.fonts.jpFont.height * ZoomRate);

                UpdateLayout();

                FontChanged?.Invoke();
            }
            else
            {
                if (mouseState.IsShift)
                {
                    HScrollBar.Value += mouseState.WheelNotchY * _settings.scrollSpeed_horizontal * -1;
                }
                else
                {
                    VScrollBar.Value += mouseState.WheelNotchY * _settings.scrollSpeed_vertical * -1;
                }
            }

            handled = true;
        }
Esempio n. 2
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            if (CbFontFamily.SelectedItem == null)
            {
                return;
            }

            char[] alphabet = TbAlphabet.Text.ToCharArray();
            if (alphabet.Length == 0)
            {
                alphabet = new char[] { ' ' };
            }

            var font = new Font(((System.Windows.Media.FontFamily)CbFontFamily.SelectedItem).FamilyNames.First().Value, float.Parse(TbFontSize.Text, CultureInfo.InvariantCulture.NumberFormat), (System.Drawing.FontStyle)CbFontStyle.SelectedIndex);

            Font = new AsciiFont(font, alphabet);

            DialogResult = true;
        }
Esempio n. 3
0
        private void BtnChangeFont_Click(object sender, RoutedEventArgs e)
        {
            FontDialog dlg = new FontDialog
            {
                Owner = this,
                Font  = _font
            };

            dlg.ShowDialog();

            if (dlg.DialogResult == true)
            {
                _font = dlg.Font;

                UpdateInfos();

                TbAscii.FontFamily = new System.Windows.Media.FontFamily(_font.Font.FontFamily.Name);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatusitaDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public MatusitaDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatusitaDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public MatusitaDistanceRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IntersectionRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public IntersectionRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BhattacharyyaDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public BhattacharyyaDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BhattacharyyaDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public BhattacharyyaDistanceRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChiSquaredDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public ChiSquaredDistanceRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SsimBasedRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public SsimBasedRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public RenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
Esempio n. 12
0
 public MainWindow()
 {
     InitializeComponent();
     _font = new AsciiFont(new Font("Courier New", 16), _chars2);
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManhattanDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public ManhattanDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EarthMoversDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public EarthMoversDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EarthMoversDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public EarthMoversDistanceRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EuclideanDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public EuclideanDistanceRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
Esempio n. 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrightnessBasedRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public BrightnessBasedRenderOption(AsciiFont font) : this(font, RenderingMode.Default)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EuclideanDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public EuclideanDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChiSquaredDistanceRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public ChiSquaredDistanceRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public RenderOption(AsciiFont font, RenderingMode renderingMode)
 {
     Font          = font;
     TileSize      = font.CharSize;
     RenderingMode = renderingMode;
 }
Esempio n. 21
0
 internal int GetLineHeight()
 {
     return(CharSize.RoundHeight(
                Math.Max(AsciiFont.MeasureChar('A').Height, JpFont.MeasureChar('あ').Height) + _settings.lineHeightAdjust));
 }
Esempio n. 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrightnessBasedRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 /// <param name="renderingMode">The RenderingMode used to determine the best-fitting character.</param>
 public BrightnessBasedRenderOption(AsciiFont font, RenderingMode renderingMode) : base(font, renderingMode)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MseBasedRenderOption"/> class.
 /// </summary>
 /// <param name="font">The AsciiImageFont used to draw the characters.</param>
 public MseBasedRenderOption(AsciiFont font) : base(font)
 {
 }