private void CreateInlineImage(RadFlowDocument document, Paragraph paragraph) { #region radwordsprocessing-model-floatingimage_0 FloatingImage floatingImage = new FloatingImage(document); paragraph.Inlines.Add(floatingImage); #endregion }
void DisplayPopupDialogImageTest(ToolStripButton button) { if (this.WindowState == FormWindowState.Minimized || m_bIsMainFormActive == false) { return; } FloatingImage m_floatingImageDlg = new FloatingImage(); int imgHeight = 600; int imgWidth = 300; Rectangle rect = button.Bounds; Point px = new Point(rect.Left, rect.Bottom); Point screenLocation = PointToScreen(px); //Point.Empty); //m_floatingImageDlg.SetImage(global::ECPApp.Properties.Resources.diag_arrow_up_right128); //m_floatingImageDlg.SetImage(global::ECPApp.Properties.Resources.text_popup_dialog); m_floatingImageDlg.SetImgSize(imgHeight, imgWidth); //m_floatingImageDlg.SetImgLocation(screenLocation.X - (imgWidth / 2), screenLocation.Y - imgHeight); //m_floatingImageDlg.SetImgLocation(screenLocation.X - imgWidth, screenLocation.Y - (imgWidth / 2)); m_floatingImageDlg.SetImgLocation(screenLocation.X + imgWidth, screenLocation.Y); int imageTimeout = 5000; // 4 secs m_floatingImageDlg.Show(imageTimeout); }
private void AddInlineImageAtIndex(RadFlowDocument document, Paragraph paragraph) { #region radwordsprocessing-model-floatingimage_1 FloatingImage floatingImage = new FloatingImage(document); paragraph.Inlines.Insert(0, floatingImage); #endregion }
private void FloatingImage() { #region radspreadsheet-model-features-shapes-and-images_0 Worksheet worksheet = this.radSpreadsheet.ActiveWorksheet; FloatingImage image = new FloatingImage(worksheet, new CellIndex(7, 1), 35, 10); #endregion #region radspreadsheet-model-features-shapes-and-images_01 FileStream stream = File.Open(@"C:\Users\Velcheva\Desktop\spreadsheet_wpf_46_text.png", FileMode.Open); using (stream) { image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(stream, "jpg"); } image.Width = 330; image.Height = 45; image.RotationAngle = 20; #endregion #region radspreadsheet-model-features-shapes-and-images_02 worksheet.Shapes.Add(image); #endregion #region radspreadsheet-model-features-shapes-and-images_03 worksheet.Shapes.Add(image); #endregion #region radspreadsheet-model-features-shapes-and-images_04 image.CellIndex = new CellIndex(4, 5); image.OffsetX = 10; image.OffsetY = 10; #endregion #region radspreadsheet-model-features-shapes-and-images_05 image.Width -= 50; image.Height += 50; #endregion #region radspreadsheet-model-features-shapes-and-images_06 image.RotationAngle = 40; #endregion #region radspreadsheet-model-features-shapes-and-images_07 image.IsHorizontallyFlipped = true; #endregion }
public void FloatingImageTheUIDeselection() { #region radspreadsheet-ui-working-with-selection_8 Selection selection = this.radSpreadsheet.ActiveWorksheetEditor.Selection; FloatingImage image2 = this.radSpreadsheet.ActiveWorksheet.Shapes.ElementAt(1) as FloatingImage; selection.Select(image2, true); #endregion }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { return(new FloatingColor() { R = (int)(Image[X, Y].R * Layers) / (float)(Layers - 1), G = (int)(Image[X, Y].G * Layers) / (float)(Layers - 1), B = (int)(Image[X, Y].B * Layers) / (float)(Layers - 1), A = Image[X, Y].A }); }
public void FloatingImageTheUISelection() { #region radspreadsheet-ui-working-with-selection_7 Selection selection = this.radSpreadsheet.ActiveWorksheetEditor.Selection; FloatingImage image = this.radSpreadsheet.ActiveWorksheet.Shapes.First() as FloatingImage; selection.Select(image); #endregion }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { return(new FloatingColor() { R = Math.Min(1, Math.Max(Image[X, Y].R, 0)), G = Math.Min(1, Math.Max(Image[X, Y].G, 0)), B = Math.Min(1, Math.Max(Image[X, Y].B, 0)), A = Math.Min(1, Math.Max(Image[X, Y].A, 0)) }); }
private void InsertCompanyLogo() { FloatingImage image = new FloatingImage(this.worksheet, new CellIndex(1, 4), 25, 10); using (Stream stream = File.OpenRead("Resources/MyCompanyLogo.jpg")) { image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(stream, "jpg"); } this.worksheet.Shapes.Add(image); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { float O = Y * PeriodY + X * PeriodX; return new FloatingColor() { R = (float)Math.Sin(Math.PI * (O + Turbulence * Image[X, Y].R)), G = (float)Math.Sin(Math.PI * (O + Turbulence * Image[X, Y].G)), B = (float)Math.Sin(Math.PI * (O + Turbulence * Image[X, Y].B)), A = Image[X, Y].A }; }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { float O = Y * PeriodY + X * PeriodX; return(new FloatingColor() { R = 1 - O - Turbulence * Image[X, Y].R, G = 1 - O - Turbulence * Image[X, Y].G, B = 1 - O - Turbulence * Image[X, Y].B, A = Image[X, Y].A }); }
protected override void OnMouseMove(MouseEventArgs e) { if (beginDragged) { if (image == null) { image = FloatingImage.GetImage(this, this.BackgroundImage, Color.Gray, null); image.KeepInMousePos(true, new Point(5, 5), this.Size); } } base.OnMouseMove(e); }
private void HandleDrop(int X, int Y, FloatingImage Image, FloatingImage Field) { Random Random = new Random(); int x = X; int y = Y; double Velocity = 0; double Sediment = 0; double Height = Field[X, Y].Luminosity(); for (int i = 0; i < _Steps; ++i) { if (x < 2 || x > Image.Width || y < 2 || y > Image.Height) { break; } Pair <int, int> Lowest = _NEIGHBORS[Random.Next(0, _NEIGHBORS.Length)]; double H = Field[Lowest.First + x, Lowest.Second + y].Luminosity(); foreach (Pair <int, int> N in _NEIGHBORS) { double h = Field[N.First + x, N.Second + y].Luminosity(); if (h < H) { Lowest = N; H = h; } } double Slope = Height - H; Velocity += Slope; double MaxSediment = Math.Max(.1, Slope) * Velocity * (1 - ((float)i / (_Steps - 1))); double Delta = 0; if (Slope < 0) { Velocity = 0; Delta = Slope; } else { Delta = .5 * (MaxSediment - Sediment); } if (Delta > Slope) { Delta = Slope; } Sediment += Delta; _Brush.Color = new FloatingColor(-(float)Delta, -(float)Delta, -(float)Delta); _Brush.Paint(x, y, Field); x += Lowest.First; y += Lowest.Second; Height = H; } }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { FloatingColor x = ((Image[X + 1, Y + 1] - Image[X - 1, Y + 1]) + 2 * (Image[X + 1, Y] - Image[X - 1, Y]) + (Image[X + 1, Y - 1] - Image[X - 1, Y - 1])); FloatingColor y = ((Image[X - 1, Y - 1] - Image[X - 1, Y + 1]) + 2 * (Image[X, Y - 1] - Image[X, Y + 1]) + (Image[X + 1, Y - 1] - Image[X + 1, Y + 1])); x *= x; y *= y; return(new FloatingColor( (float)Math.Sqrt(x.R + y.R), (float)Math.Sqrt(x.G + y.G), (float)Math.Sqrt(x.B + y.B))); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { float x = _Scale * ((Image[X + 1, Y + 1] - Image[X - 1, Y + 1]) + 2 * (Image[X + 1, Y] - Image[X - 1, Y]) + (Image[X + 1, Y - 1] - Image[X - 1, Y - 1])).R; float y = _Scale * ((Image[X - 1, Y - 1] - Image[X - 1, Y + 1]) + 2 * (Image[X, Y - 1] - Image[X, Y + 1]) + (Image[X + 1, Y - 1] - Image[X + 1, Y + 1])).R; float z = 1; float l = (float)Math.Sqrt(x * x + y * y + z); x /= l; y /= l; z /= l; return(new FloatingColor(x / 2 + .5f, y / 2 + .5f, z / .5f)); }
private void InsertCompanyLogo() { FloatingImage image = new FloatingImage(worksheet, new CellIndex(1, 4), 25, 10); using (Stream stream = GetResourceStream("Resources/MyCompanyLogo.jpg")) { image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(stream, "jpg"); } image.Width = 65; image.Height = 65; worksheet.Shapes.Add(image); }
private void AddInlinesToParagraph(Paragraph paragraph) { #region radwordsprocessing-model-paragraph_4 Run run = paragraph.Inlines.AddRun(); #endregion #region radwordsprocessing-model-paragraph_5 ImageInline imageInline = paragraph.Inlines.AddImageInline(); #endregion #region radwordsprocessing-model-paragraph_6 FloatingImage floatingImage = paragraph.Inlines.AddFloatingImage(); #endregion }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { int Width = Radius * 2 + 1; FloatingColor R = new FloatingColor(0, 0, 0); for (int i = 0; i < Width; ++i) { for (int j = 0; j < Width; ++j) { int x = i - Radius; int y = j - Radius; R = R + Matrix[i, j] * Image[X + x, Y + y]; } } return(R); }
public void Filter(FloatingImage Image, FloatingImage Field) { for (int i = 0; i < Field.Width; ++i) { for (int j = 0; j < Field.Height; ++j) { Field[i, j] = new FloatingColor(0, 0, 0, 1f); } } Random Random = new Random(); for (int i = 0; i < _Actors; ++i) { int X = Random.Next(0, Image.Width); int Y = Random.Next(0, Image.Height); HandleActor(X, Y, Image, Field); } }
public void Filter(FloatingImage Image, FloatingImage Field) { for (int i = 0; i < Field.Width; ++i) { for (int j = 0; j < Field.Height; ++j) { Field[i, j] = Image[i, j]; } } Random Random = new Random(); for (int i = 0; i < _Drops; ++i) { int X = Random.Next(0, Image.Width); int Y = Random.Next(0, Image.Height); HandleDrop(X, Y, Image, Field); } }
public static void AddFloatingImage() { WordDocument document = new WordDocument(); WordDocumentBuilder builder = new WordDocumentBuilder(document); builder.CharacterState.FontSize = 24; //Add floating image using builder using (Stream stream = File.OpenRead("sample.jpg")) { FloatingImage floatingImage1 = builder.InsertFloatingImage(stream, "jpg"); floatingImage1.Wrapping.WrappingType = ShapeWrappingType.Square; } builder.InsertText("This text sentence content will display at the square of the floating image. "); builder.InsertText("This text sentence content will display at the square of the floating image."); WordFile wordFile = new WordFile(); File.WriteAllBytes("AddFloatingImage.docx", wordFile.Export(document)); }
private void HandleActor(int X, int Y, FloatingImage Image, FloatingImage Field) { double Angle = _Angle; double x = X; double y = Y; for (int i = 0; i < _Steps; ++i) { if (x < 0 || x > Image.Width || y < 0 || y > Image.Height) { break; } Field[(int)x, (int)y] += _Gradient.Evaluate((float)i / (_Steps - 1)); double NewAngle = Image[(int)x, (int)y].Luminosity() * 2 * Math.PI; Angle = _Alpha * NewAngle + (1 - _Alpha) * Angle; x += _Velocity * Math.Cos(Angle); y += _Velocity * Math.Sin(Angle); } }
private Workbook ExportWorkbook(GridViewDataControl grid) { var imageExtension = "png"; var imageWidth = 20; var imageHeight = 23; var padding = 5; Workbook workbook = grid.ExportToWorkbook(); Worksheet worksheet = workbook.ActiveWorksheet; var usedRows = worksheet.UsedCellRange.RowCount; var usedColumns = worksheet.UsedCellRange.ColumnCount; for (int i = 0; i < usedRows; i++) { for (int j = 0; j < usedColumns; j++) { var cell = worksheet.Cells[i, j]; var cellValue = cell.GetValue().Value.RawValue; if (cellValue.Contains(string.Format(".{0}", imageExtension))) { FloatingImage image = new FloatingImage(worksheet, new CellIndex(i, j), padding, padding); Stream stream = File.Open("../../" + cellValue, FileMode.Open, FileAccess.Read); using (stream) { image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(stream, imageExtension); } image.Width = imageWidth; image.Height = imageHeight; worksheet.Shapes.Add(image); cell.SetValue(string.Empty); worksheet.Rows[i].SetHeight(new RowHeight(imageHeight + padding * 2, true)); } } } return(workbook); }
void DisplayPopupDialogImage(Bitmap img, int imgHeight, int imgWidth, int nSecTimeout) { if (this.WindowState == FormWindowState.Minimized || m_bIsMainFormActive == false) { return; } FloatingImage m_floatingImageDlg = new FloatingImage(); Rectangle rect = this.Bounds; Point px = new Point(rect.Right, rect.Top); Point screenLocation = PointToScreen(px); m_floatingImageDlg.SetImage(img); m_floatingImageDlg.SetImgSize(imgHeight, imgWidth); m_floatingImageDlg.SetImgLocation(screenLocation.X - (imgWidth + (imgWidth / 2)), screenLocation.Y); m_floatingImageDlg.Show(nSecTimeout); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { FloatingColor C = (Image[X, Y + 1] + Image[X + 1, Y]) - (Image[X - 1, Y] + Image[X, Y - 1]); return(C); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { FloatingColor F = Image[X, Y].MakeHSL(); return(new FloatingColor(F.R, 1, .5f).MakeRGB()); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { return(5 * Image[X, Y] - Image[X, Y - 1] - Image[X, Y + 1] - Image[X - 1, Y] - Image[X + 1, Y]); }
public FloatingColor Filter(int X, int Y, FloatingImage Image) { return(Image[X, Y]); }
private void CreateInlineImageAndAddToParagraph(Paragraph paragraph) { #region radwordsprocessing-model-floatingimage_2 FloatingImage floatingImage = paragraph.Inlines.AddFloatingImage(); #endregion }