private static void SetupWordCloudThemes() { var segoeUi = new Typeface("Segoe UI"); Default = new WordCloudTheme(segoeUi, WordCloudThemeWordRotation.Mixed, ColorPalette1, Brushes.Black); Horizontal1 = new WordCloudTheme(segoeUi, WordCloudThemeWordRotation.Horizontal, ColorPalette1, Brushes.Black); Mixed1 = new WordCloudTheme(segoeUi, WordCloudThemeWordRotation.Mixed, ColorPalette1, Brushes.Black); Random1 = new WordCloudTheme(segoeUi, WordCloudThemeWordRotation.Random, ColorPalette1, Brushes.Black); }
public WordDrawing(WordCloudEntry wordEntry, WordCloudTheme theme, DpiScale scale) { var text = new FormattedText(wordEntry.Word, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, theme.Typeface, 100, wordEntry.Brush, scale.PixelsPerDip); var textGeometry = text.BuildGeometry(new Point(0, 0)); _geo = textGeometry; WordCloudEntry = wordEntry; _bounds = textGeometry.Bounds; _geo.Transform = _transformGroup; var rotateTransform = new RotateTransform(WordCloudEntry.Angle, _bounds.Width / 2, _bounds.Height / 2); _transformGroup.Children.Add(rotateTransform); _bounds = rotateTransform.TransformBounds(_bounds); _transformGroup.Children.Add(_scaleTransformGroup); _initialPlacementTransform = new TranslateTransform(-_bounds.X, -_bounds.Y); _transformGroup.Children.Add(_initialPlacementTransform); _bounds.X = 0; _bounds.Y = 0; IntWidth = (int)Math.Ceiling(_bounds.Width); IntHeight = (int)Math.Ceiling(_bounds.Height); _transformGroup.Children.Add(_translateTransform); }