public void DrawClippedTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle, uint fontColorOverride, Rectangle clipRect) { if (!string.IsNullOrEmpty(run.Text)) { Underline underline = null; if (run.UnderlineHeight > 0) { underline = new Underline(run, hdc, fontCache, layoutRectangle, x, baselineY, WritingMode); } int x2; int baselineY2; switch (WritingMode) { case RPLFormat.WritingModes.Horizontal: x2 = layoutRectangle.X + x; baselineY2 = layoutRectangle.Y + baselineY; break; case RPLFormat.WritingModes.Vertical: x2 = layoutRectangle.X + (layoutRectangle.Width - baselineY); baselineY2 = layoutRectangle.Y + x; break; case RPLFormat.WritingModes.Rotate270: x2 = layoutRectangle.X + baselineY; baselineY2 = layoutRectangle.Y + layoutRectangle.Height - x; break; default: throw new NotSupportedException(); } TextBox.DrawClippedTextRun(run, hdc, fontCache, x2, baselineY2, fontColorOverride, clipRect, underline); } }
private void HandleError(Win32DCSafeHandle handle) { if (handle.IsInvalid) { throw new ReportRenderingException(Marshal.GetExceptionForHR(Marshal.GetLastWin32Error())); } }
public static void CheckSimulatedFontStyles(Win32DCSafeHandle hdc, AspNetCore.ReportingServices.Rendering.RichText.Win32.TEXTMETRIC textMetric, ref bool simulateItalic, ref bool simulateBold) { simulateItalic = false; simulateBold = false; if ((textMetric.tmPitchAndFamily & 4) == 4) { if (textMetric.tmWeight < 600 && textMetric.tmItalic <= 0) { return; } ushort num = default(ushort); ushort num2 = default(ushort); if (FontPackage.GetWeightClassAndSelection(hdc, out num, out num2)) { if (textMetric.tmItalic > 0 && (num2 & 1) == 0) { simulateItalic = true; } if (textMetric.tmWeight >= 600 && num < textMetric.tmWeight) { simulateBold = true; } } } }
protected override void Dispose(bool disposing) { if (disposing) { if (this.m_firstImage != null) { this.m_firstImage.Dispose(); this.m_firstImage = null; } if (this.m_encoderParameters != null) { this.m_encoderParameters.Dispose(); this.m_encoderParameters = null; } } if (this.m_hdcBitmap != null) { this.m_hdcBitmap.Close(); this.m_hdcBitmap = null; } if (this.m_hBitmap != null) { this.m_hBitmap.Close(); this.m_hBitmap = null; } base.Dispose(disposing); }
internal void ReleaseHdc() { if (!Hdc.IsInvalid) { m_graphicsBase.ReleaseHdc(); Hdc = Win32DCSafeHandle.Zero; } }
public void NewPage(float pageWidth, float pageHeight, int dpiX, int dpiY) { if (base.m_graphicsBase != null) { this.ReleaseCachedHdc(true); base.m_graphicsBase.Dispose(); base.m_graphicsBase = null; } if (this.m_hdcBitmap != null) { this.m_hdcBitmap.Close(); this.m_hdcBitmap = null; } if (this.m_hBitmap != null) { this.m_hBitmap.Close(); this.m_hBitmap = null; } IntPtr intPtr = IntPtr.Zero; try { intPtr = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDC(IntPtr.Zero); this.HandleError(intPtr); this.m_hdcBitmap = AspNetCore.ReportingServices.Rendering.RichText.Win32.CreateCompatibleDC(intPtr); this.HandleError(this.m_hdcBitmap); AspNetCore.ReportingServices.Rendering.RichText.Win32.BITMAPINFOHEADER bITMAPINFOHEADER = new AspNetCore.ReportingServices.Rendering.RichText.Win32.BITMAPINFOHEADER(base.ConvertToPixels(pageWidth), base.ConvertToPixels(pageHeight), base.DpiX, base.DpiY); IntPtr zero = IntPtr.Zero; this.m_hBitmap = AspNetCore.ReportingServices.Rendering.RichText.Win32.CreateDIBSection(this.m_hdcBitmap, ref bITMAPINFOHEADER, 0u, ref zero, IntPtr.Zero, 0u); this.HandleError(this.m_hBitmap); AspNetCore.ReportingServices.Rendering.RichText.Win32.SelectObject(this.m_hdcBitmap, this.m_hBitmap); base.m_graphicsBase = System.Drawing.Graphics.FromHdc(this.m_hdcBitmap.Handle); Graphics.SetGraphicsProperties(base.m_graphicsBase); base.m_graphicsBase.Clear(Color.White); } catch (Exception) { if (this.m_hdcBitmap != null) { this.m_hdcBitmap.Close(); this.m_hdcBitmap = null; } if (this.m_hBitmap != null) { this.m_hBitmap.Close(); this.m_hBitmap = null; } throw; } finally { if (IntPtr.Zero != intPtr) { AspNetCore.ReportingServices.Rendering.RichText.Win32.ReleaseDC(IntPtr.Zero, intPtr); } } }
internal void NewPage(float pageWidth, float pageHeight, int dpiX, int dpiY) { if (m_graphicsBase != null) { ReleaseCachedHdc(releaseHdc: true); m_graphicsBase.Dispose(); m_graphicsBase = null; } if (m_hdcBitmap != null) { m_hdcBitmap.Close(); m_hdcBitmap = null; } if (m_hBitmap != null) { m_hBitmap.Close(); m_hBitmap = null; } IntPtr intPtr = IntPtr.Zero; try { intPtr = Microsoft.ReportingServices.Rendering.RichText.Win32.GetDC(IntPtr.Zero); HandleError(intPtr); m_hdcBitmap = Microsoft.ReportingServices.Rendering.RichText.Win32.CreateCompatibleDC(intPtr); HandleError(m_hdcBitmap); Microsoft.ReportingServices.Rendering.RichText.Win32.BITMAPINFOHEADER pbmi = new Microsoft.ReportingServices.Rendering.RichText.Win32.BITMAPINFOHEADER(ConvertToPixels(pageWidth), ConvertToPixels(pageHeight), base.DpiX, base.DpiY); IntPtr ppvBits = IntPtr.Zero; m_hBitmap = Microsoft.ReportingServices.Rendering.RichText.Win32.CreateDIBSection(m_hdcBitmap, ref pbmi, 0u, ref ppvBits, IntPtr.Zero, 0u); HandleError(m_hBitmap); Microsoft.ReportingServices.Rendering.RichText.Win32.SelectObject(m_hdcBitmap, m_hBitmap); m_graphicsBase = System.Drawing.Graphics.FromHdc(m_hdcBitmap.Handle); SetGraphicsProperties(m_graphicsBase); m_graphicsBase.Clear(Color.White); } catch (Exception) { if (m_hdcBitmap != null) { m_hdcBitmap.Close(); m_hdcBitmap = null; } if (m_hBitmap != null) { m_hBitmap.Close(); m_hBitmap = null; } throw; } finally { if (IntPtr.Zero != intPtr) { Microsoft.ReportingServices.Rendering.RichText.Win32.ReleaseDC(IntPtr.Zero, intPtr); } } }
public override void ClipTextboxRectangle(Win32DCSafeHandle hdc, RectangleF position) { if (this.m_bodyRect.X != 0 || this.m_bodyRect.Y != 0) { if (!AspNetCore.ReportingServices.Rendering.RichText.Win32.GetViewportOrgEx(hdc, out this.m_prevViewportOrg)) { int lastWin32Error = Marshal.GetLastWin32Error(); string message = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "GetViewportOrgEx", lastWin32Error); throw new Exception(message); } if (!AspNetCore.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, this.m_bodyRect.X, this.m_bodyRect.Y, Win32ObjectSafeHandle.Zero)) { int lastWin32Error2 = Marshal.GetLastWin32Error(); string message2 = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2); throw new Exception(message2); } } System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(position.X, (float)base.m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Y, (float)base.m_commonGraphics.DpiY), SharedRenderer.ConvertToPixels(position.Width, (float)base.m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Height, (float)base.m_commonGraphics.DpiY)); if (position.X < 0.0) { rectangle.Width += rectangle.X; rectangle.X = 0; } if (position.Y < 0.0) { rectangle.Height += rectangle.Y; rectangle.Y = 0; } rectangle.X += this.m_bodyRect.X; rectangle.Y += this.m_bodyRect.Y; if (rectangle.Right > this.m_bodyRect.Right) { rectangle.Width = this.m_bodyRect.Right - rectangle.Left; } if (rectangle.Bottom > this.m_bodyRect.Bottom) { rectangle.Height = this.m_bodyRect.Bottom - rectangle.Top; } Win32ObjectSafeHandle win32ObjectSafeHandle = AspNetCore.ReportingServices.Rendering.RichText.Win32.CreateRectRgn(rectangle.X, rectangle.Y, rectangle.Right, rectangle.Bottom); if (!win32ObjectSafeHandle.IsInvalid) { try { if (AspNetCore.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, win32ObjectSafeHandle) == 0) { int lastWin32Error3 = Marshal.GetLastWin32Error(); string message3 = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error3); throw new Exception(message3); } } finally { win32ObjectSafeHandle.Close(); } } }
internal static bool CheckEmbeddingRights(Win32DCSafeHandle hdc) { uint status = 0u; if (TTGetEmbeddingType(hdc, ref status) == 0) { return(status != 4); } return(false); }
public static bool CheckEmbeddingRights(Win32DCSafeHandle hdc) { uint num = 0u; if (FontPackage.TTGetEmbeddingType(hdc, ref num) == 0) { return(num != 4); } return(false); }
internal override void ClipTextboxRectangle(Win32DCSafeHandle hdc, RectangleF position) { if (m_bodyRect.X != 0 || m_bodyRect.Y != 0) { if (!Microsoft.ReportingServices.Rendering.RichText.Win32.GetViewportOrgEx(hdc, out m_prevViewportOrg)) { int lastWin32Error = Marshal.GetLastWin32Error(); throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "GetViewportOrgEx", lastWin32Error)); } if (!Microsoft.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, m_bodyRect.X, m_bodyRect.Y, Win32ObjectSafeHandle.Zero)) { int lastWin32Error2 = Marshal.GetLastWin32Error(); throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2)); } } System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(SharedRenderer.ConvertToPixels(position.X, m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Y, m_commonGraphics.DpiY), SharedRenderer.ConvertToPixels(position.Width, m_commonGraphics.DpiX), SharedRenderer.ConvertToPixels(position.Height, m_commonGraphics.DpiY)); if (position.X < 0f) { rectangle.Width += rectangle.X; rectangle.X = 0; } if (position.Y < 0f) { rectangle.Height += rectangle.Y; rectangle.Y = 0; } rectangle.X += m_bodyRect.X; rectangle.Y += m_bodyRect.Y; if (rectangle.Right > m_bodyRect.Right) { rectangle.Width = m_bodyRect.Right - rectangle.Left; } if (rectangle.Bottom > m_bodyRect.Bottom) { rectangle.Height = m_bodyRect.Bottom - rectangle.Top; } Win32ObjectSafeHandle win32ObjectSafeHandle = Microsoft.ReportingServices.Rendering.RichText.Win32.CreateRectRgn(rectangle.X, rectangle.Y, rectangle.Right, rectangle.Bottom); if (win32ObjectSafeHandle.IsInvalid) { return; } try { if (Microsoft.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, win32ObjectSafeHandle) == 0) { int lastWin32Error3 = Marshal.GetLastWin32Error(); throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error3)); } } finally { win32ObjectSafeHandle.Close(); } }
internal override void UnClipTextboxRectangle(Win32DCSafeHandle hdc) { if (Microsoft.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, Win32ObjectSafeHandle.Zero) == 0) { int lastWin32Error = Marshal.GetLastWin32Error(); throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error)); } if ((m_bodyRect.X != 0 || m_bodyRect.Y != 0) && !Microsoft.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, m_prevViewportOrg.x, m_prevViewportOrg.y, Win32ObjectSafeHandle.Zero)) { int lastWin32Error2 = Marshal.GetLastWin32Error(); throw new Exception(string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2)); } }
private static bool GetWeightClassAndSelection(Win32DCSafeHandle hdc, out ushort weightClass, out ushort selection) { weightClass = 0; selection = 0; byte[] array = new byte[64]; if (GetFontData(hdc, 841962319u, 0u, array, (uint)array.Length) == array.Length) { weightClass = ToUInt16BigEndian(array, 4); selection = ToUInt16BigEndian(array, 62); return(true); } return(false); }
public void GetHdc(bool createNewHdc, out Win32DCSafeHandle hdc, out float dpiX) { if (this.m_commonGraphics != null) { this.m_commonGraphics.CacheHdc(createNewHdc); hdc = this.m_commonGraphics.Hdc; dpiX = (float)this.m_commonGraphics.DpiX; } else { hdc = Win32DCSafeHandle.Zero; dpiX = -1f; } }
internal void GetHdc(bool createNewHdc, out Win32DCSafeHandle hdc, out float dpiX) { if (m_commonGraphics != null) { m_commonGraphics.CacheHdc(createNewHdc); hdc = m_commonGraphics.Hdc; dpiX = m_commonGraphics.DpiX; } else { hdc = Win32DCSafeHandle.Zero; dpiX = -1f; } }
public static byte[] Generate(Win32DCSafeHandle hdc, string fontFamily, ushort[] glyphIdArray) { IntPtr intPtr = IntPtr.Zero; uint num = 0u; IntPtr zero = IntPtr.Zero; uint num2 = 0u; byte[] array = null; try { if (FontPackage.GetFontData(hdc, 1717793908u, 0u, IntPtr.Zero, 0u) == 4294967295u) { num = FontPackage.GetFontData(hdc, 0u, 0u, IntPtr.Zero, 0u); FontPackage.CheckGetFontDataResult(num); intPtr = Marshal.AllocHGlobal((int)num); uint fontData = FontPackage.GetFontData(hdc, 0u, 0u, intPtr, num); FontPackage.CheckGetFontDataResult(fontData); } else { byte[] tTCFontData = FontPackage.GetTTCFontData(hdc, ref num); intPtr = Marshal.AllocHGlobal((int)num); Marshal.Copy(tTCFontData, 0, intPtr, (int)num); } ushort usFlags = 9; uint num3 = 0u; short num4 = FontPackage.CreateFontPackage(intPtr, num, out zero, ref num2, ref num3, usFlags, (ushort)0, (ushort)0, (ushort)0, (ushort)3, (ushort)65535, glyphIdArray, (ushort)glyphIdArray.Length, (Delegate) new AllocateMemory(FontPackage.AllocateFontBufferMemory), (Delegate) new ReAllocateMemory(FontPackage.ReAllocateFontBufferMemory), (Delegate) new FreeMemory(FontPackage.FreeFontBufferMemory), IntPtr.Zero); if (num4 != 0) { string source = string.Format(CultureInfo.InvariantCulture, "CreateFontPackage(fontFamily={0})", fontFamily); FontPackage.ThrowNativeException(source, num4, false); } array = new byte[num3]; Marshal.Copy(zero, array, 0, (int)num3); return(array); } finally { if (intPtr != IntPtr.Zero) { Marshal.FreeHGlobal(intPtr); } if (zero != IntPtr.Zero) { Marshal.FreeHGlobal(zero); } } }
internal static void CheckSimulatedFontStyles(Win32DCSafeHandle hdc, Microsoft.ReportingServices.Rendering.RichText.Win32.TEXTMETRIC textMetric, ref bool simulateItalic, ref bool simulateBold) { simulateItalic = false; simulateBold = false; if ((textMetric.tmPitchAndFamily & 4) == 4 && (textMetric.tmWeight >= 600 || textMetric.tmItalic > 0) && GetWeightClassAndSelection(hdc, out ushort weightClass, out ushort selection)) { if (textMetric.tmItalic > 0 && (selection & 1) == 0) { simulateItalic = true; } if (textMetric.tmWeight >= 600 && weightClass < textMetric.tmWeight) { simulateBold = true; } } }
internal static byte[] Generate(Win32DCSafeHandle hdc, string fontFamily, ushort[] glyphIdArray) { IntPtr intPtr = IntPtr.Zero; uint fontDataLength = 0u; IntPtr puchFontPackageBuffer = IntPtr.Zero; uint pulFontPackageBufferSize = 0u; byte[] array = null; try { if (GetFontData(hdc, 1717793908u, 0u, IntPtr.Zero, 0u) == uint.MaxValue) { fontDataLength = GetFontData(hdc, 0u, 0u, IntPtr.Zero, 0u); CheckGetFontDataResult(fontDataLength); intPtr = Marshal.AllocHGlobal((int)fontDataLength); CheckGetFontDataResult(GetFontData(hdc, 0u, 0u, intPtr, fontDataLength)); } else { byte[] tTCFontData = GetTTCFontData(hdc, ref fontDataLength); intPtr = Marshal.AllocHGlobal((int)fontDataLength); Marshal.Copy(tTCFontData, 0, intPtr, (int)fontDataLength); } ushort usFlags = 9; uint pulBytesWritten = 0u; short num = CreateFontPackage(intPtr, fontDataLength, out puchFontPackageBuffer, ref pulFontPackageBufferSize, ref pulBytesWritten, usFlags, 0, 0, 0, 3, ushort.MaxValue, glyphIdArray, (ushort)glyphIdArray.Length, new AllocateMemory(AllocateFontBufferMemory), new ReAllocateMemory(ReAllocateFontBufferMemory), new FreeMemory(FreeFontBufferMemory), IntPtr.Zero); if (num != 0) { ThrowNativeException(string.Format(CultureInfo.InvariantCulture, "CreateFontPackage(fontFamily={0})", fontFamily), num, dump: false); } array = new byte[pulBytesWritten]; Marshal.Copy(puchFontPackageBuffer, array, 0, (int)pulBytesWritten); return(array); } finally { if (intPtr != IntPtr.Zero) { Marshal.FreeHGlobal(intPtr); } if (puchFontPackageBuffer != IntPtr.Zero) { Marshal.FreeHGlobal(puchFontPackageBuffer); } } }
private static byte[] GetTTCFontData(Win32DCSafeHandle hdc, ref uint fontDataLength) { byte[] array = null; fontDataLength = 0u; byte[] array2 = null; byte[] array3 = new byte[2]; uint fontData = FontPackage.GetFontData(hdc, 0u, 4u, array3, 2u); FontPackage.CheckGetFontDataResult(fontData); ushort num = BitConverter.ToUInt16(FontPackage.Swap(array3), 0); ushort num2 = (ushort)(12 + num * 16); array2 = new byte[num2]; fontData = FontPackage.GetFontData(hdc, 0u, 0u, array2, num2); FontPackage.CheckGetFontDataResult(fontData); ArrayList arrayList = new ArrayList(); uint num3 = num2; for (int i = 0; i < num; i++) { byte[] array4 = new byte[16]; Array.Copy(array2, 12 + i * 16, array4, 0, 16); DirectoryEntry directoryEntry = new DirectoryEntry(array4, i); num3 += directoryEntry.TableLength; arrayList.Add(directoryEntry); } array = new byte[num3]; Array.Copy(array2, array, num2); fontDataLength += num2; arrayList.Sort(new CompareDirectoryEntryOffsets()); foreach (DirectoryEntry item in arrayList) { byte[] array5 = new byte[item.TableLength]; fontData = FontPackage.GetFontData(hdc, item.TableTag, 0u, array5, (uint)array5.Length); FontPackage.CheckGetFontDataResult(fontData); int destinationIndex = 12 + item.DirectoryIndex * 16 + 8; byte[] array6 = FontPackage.Swap(BitConverter.GetBytes(fontDataLength)); Array.Copy(array6, 0, array, destinationIndex, array6.Length); Array.Copy(array5, 0L, array, fontDataLength, array5.Length); fontDataLength += (uint)array5.Length; } return(array); }
public override void DrawTextRun(Win32DCSafeHandle hdc, FontCache fontCache, ReportTextBox textBox, AspNetCore.ReportingServices.Rendering.RichText.TextRun run, TypeCode typeCode, RPLFormat.TextAlignments textAlign, RPLFormat.VerticalAlignments verticalAlign, RPLFormat.WritingModes writingMode, RPLFormat.Directions direction, Point pointPosition, System.Drawing.Rectangle layoutRectangle, int lineHeight, int baselineY) { if (!string.IsNullOrEmpty(run.Text)) { int x; int baselineY2; switch (writingMode) { case RPLFormat.WritingModes.Horizontal: x = layoutRectangle.X + pointPosition.X; baselineY2 = layoutRectangle.Y + baselineY; break; case RPLFormat.WritingModes.Vertical: x = layoutRectangle.X + (layoutRectangle.Width - baselineY); baselineY2 = layoutRectangle.Y + pointPosition.X; break; case RPLFormat.WritingModes.Rotate270: x = layoutRectangle.X + baselineY; baselineY2 = layoutRectangle.Y + layoutRectangle.Height - pointPosition.X; break; default: throw new NotSupportedException(); } Underline underline = null; if (run.UnderlineHeight > 0) { underline = new Underline(run, hdc, fontCache, layoutRectangle, pointPosition.X, baselineY, writingMode); } if (!this.IsEmf) { AspNetCore.ReportingServices.Rendering.RichText.TextBox.DrawTextRun(run, hdc, fontCache, x, baselineY2, underline); } else { AspNetCore.ReportingServices.Rendering.RichText.TextBox.ExtDrawTextRun(run, hdc, fontCache, x, baselineY2, underline); } } }
public override void UnClipTextboxRectangle(Win32DCSafeHandle hdc) { if (AspNetCore.ReportingServices.Rendering.RichText.Win32.SelectClipRgn(hdc, Win32ObjectSafeHandle.Zero) == 0) { int lastWin32Error = Marshal.GetLastWin32Error(); string message = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SelectClipRgn", lastWin32Error); throw new Exception(message); } if (this.m_bodyRect.X == 0 && this.m_bodyRect.Y == 0) { return; } if (AspNetCore.ReportingServices.Rendering.RichText.Win32.SetViewportOrgEx(hdc, this.m_prevViewportOrg.x, this.m_prevViewportOrg.y, Win32ObjectSafeHandle.Zero)) { return; } int lastWin32Error2 = Marshal.GetLastWin32Error(); string message2 = string.Format(CultureInfo.InvariantCulture, ImageRendererRes.Win32ErrorInfo, "SetViewportOrgEx", lastWin32Error2); throw new Exception(message2); }
public void DrawTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle) { TypeCode typeCode = ((RPLTextBoxPropsDef)this.m_source.Definition).SharedTypeCode; if (typeCode == TypeCode.Object) { typeCode = this.m_source.TypeCode; } ReportTextRun reportTextRun = run.TextRunProperties as ReportTextRun; if (reportTextRun != null && reportTextRun.ActionInfo != null && reportTextRun.ActionInfo.Actions.Length > 0) { RPLActionInfo actionInfo = reportTextRun.ActionInfo; RectangleF position = default(RectangleF); if (this.WritingMode == RPLFormat.WritingModes.Horizontal) { position.Width = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), fontCache.Dpi); position.Height = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), fontCache.Dpi); position.X = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi); position.Y = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, fontCache.Dpi) + (SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi) - position.Height); } else { position.Width = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), fontCache.Dpi); position.Height = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), fontCache.Dpi); if (this.WritingMode == RPLFormat.WritingModes.Vertical) { position.X = SharedRenderer.ConvertToMillimeters(layoutRectangle.Right, fontCache.Dpi) - SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi); position.Y = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi); } else { position.X = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, fontCache.Dpi) + SharedRenderer.ConvertToMillimeters(y, fontCache.Dpi) - position.Width; position.Y = SharedRenderer.ConvertToMillimeters(layoutRectangle.Bottom, fontCache.Dpi) - SharedRenderer.ConvertToMillimeters(x, fontCache.Dpi) - position.Height; } } this.m_writer.ProcessAction(reportTextRun.UniqueName, actionInfo, position); } this.m_writer.DrawTextRun(hdc, fontCache, this, run, typeCode, paragraph.ParagraphProps.Alignment, this.VerticalAlignment, this.WritingMode, this.Direction, new Point(x, y), layoutRectangle, lineHeight, baselineY); }
private void CalculateMetafileRectangle(float pageWidth, float pageHeight) { if (this.IsEmf) { Win32DCSafeHandle hdc = this.m_graphics.GetHdc(); try { int deviceCaps = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 4); int deviceCaps2 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 6); int deviceCaps3 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 8); int deviceCaps4 = AspNetCore.ReportingServices.Rendering.RichText.Win32.GetDeviceCaps(hdc, 10); double num = (double)SharedRenderer.ConvertToPixels(pageWidth, (float)this.m_graphics.DpiX); double num2 = (double)SharedRenderer.ConvertToPixels(pageHeight, (float)this.m_graphics.DpiY); float width = (float)(num * (double)deviceCaps * 100.0) / (float)deviceCaps3; float height = (float)(num2 * (double)deviceCaps2 * 100.0) / (float)deviceCaps4; this.MetafileRectangle = new RectangleF(0f, 0f, width, height); } finally { this.m_graphics.ReleaseHdc(); } } }
public virtual void DrawTextRun(Win32DCSafeHandle hdc, FontCache fontCache, ReportTextBox textBox, TextRun run, TypeCode typeCode, RPLFormat.TextAlignments textAlign, RPLFormat.VerticalAlignments verticalAlign, RPLFormat.WritingModes writingMode, RPLFormat.Directions direction, Point position, Rectangle layoutRectangle, int lineHeight, int baselineY) { }
public void DrawClippedTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle, uint fontColorOverride, Rectangle clipRect) { }
private static extern int TTGetEmbeddingType(Win32DCSafeHandle hdc, ref uint status);
private static extern uint GetFontData(Win32DCSafeHandle hdc, uint dwTable, uint dwOffset, byte[] lpvBuffer, uint cbData);
public virtual void ClipTextboxRectangle(Win32DCSafeHandle hdc, RectangleF position) { }
public virtual void UnClipTextboxRectangle(Win32DCSafeHandle hdc) { }
public void DrawTextRun(TextRun run, Paragraph paragraph, Win32DCSafeHandle hdc, float dpiX, FontCache fontCache, int x, int y, int baselineY, int lineHeight, Rectangle layoutRectangle) { RPLFormat.WritingModes writingMode = WritingMode; if (string.IsNullOrEmpty(run.Text)) { return; } Underline underline = null; if (run.UnderlineHeight > 0) { underline = new Underline(run, hdc, fontCache, layoutRectangle, x, baselineY, writingMode); } int x2; int baselineY2; switch (writingMode) { case RPLFormat.WritingModes.Horizontal: x2 = layoutRectangle.X + x; baselineY2 = layoutRectangle.Y + baselineY; break; case RPLFormat.WritingModes.Vertical: x2 = layoutRectangle.X + (layoutRectangle.Width - baselineY); baselineY2 = layoutRectangle.Y + x; break; case RPLFormat.WritingModes.Rotate270: x2 = layoutRectangle.X + baselineY; baselineY2 = layoutRectangle.Y + layoutRectangle.Height - x; break; default: throw new NotSupportedException(); } if (!m_context.TestMode) { TextBox.DrawTextRun(run, hdc, fontCache, x2, baselineY2, underline); } else { TextBox.ExtDrawTextRun(run, hdc, fontCache, x2, baselineY2, underline); } RenderingTextRun renderingTextRun = run.TextRunProperties as RenderingTextRun; if (renderingTextRun == null) { return; } RPLTextRunProps rPLTextRunProps = renderingTextRun.InstanceProperties as RPLTextRunProps; if (rPLTextRunProps == null) { return; } float num = SharedRenderer.ConvertToMillimeters(run.GetWidth(hdc, fontCache), dpiX); float num2 = SharedRenderer.ConvertToMillimeters(run.GetHeight(hdc, fontCache), dpiX); float num3 = SharedRenderer.ConvertToMillimeters(x, dpiX); float num4 = SharedRenderer.ConvertToMillimeters(y, dpiX); SizeF empty = SizeF.Empty; PointF location = PointF.Empty; if (writingMode == RPLFormat.WritingModes.Horizontal) { empty = new SizeF(num, num2); location = new PointF(num3 + TextPosition.X, num4 - num2 + TextPosition.Y); } else { empty = new SizeF(num2, num); if (writingMode == RPLFormat.WritingModes.Vertical) { float num5 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Right, dpiX); float num6 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Y, dpiX); location = new PointF(num5 - num4, num6 + num3); } else { float num7 = SharedRenderer.ConvertToMillimeters(layoutRectangle.X, dpiX); float num8 = SharedRenderer.ConvertToMillimeters(layoutRectangle.Bottom, dpiX); location = new PointF(num7 + num4 - num2, num8 - num3 - num); } } RectangleF position = new RectangleF(location, empty); renderingTextRun.ProcessActions(m_context, rPLTextRunProps.UniqueName, rPLTextRunProps.ActionInfo, position); string toolTip = renderingTextRun.ToolTip; if (!string.IsNullOrEmpty(toolTip)) { m_context.RenderingReport.ToolTips.Add(new ReportToolTip(rPLTextRunProps.UniqueName, position, toolTip)); } }