public override string ToString() { var sb = new StringBuilder(); sb.Append(Bold.ToString()); sb.Append("-"); sb.Append(Italic.ToString()); sb.Append("-"); sb.Append(Underline.ToString()); sb.Append("-"); sb.Append(Strikethrough.ToString()); sb.Append("-"); sb.Append(VerticalAlignment.ToString()); sb.Append("-"); sb.Append(Shadow.ToString()); sb.Append("-"); sb.Append(FontSize.ToString()); sb.Append("-"); sb.Append(FontColor); sb.Append("-"); sb.Append(FontName); sb.Append("-"); sb.Append(FontFamilyNumbering.ToString()); return(sb.ToString()); }
private unsafe static int DrawStrikethroughImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float baselineOriginX, float baselineOriginY, Strikethrough.__Native *strikethrough, IntPtr clientDrawingEffectPtr) { unsafe { var shadow = ToShadow <TextRendererShadow>(thisObject); var callback = (TextRenderer)shadow.Callback; var strikethroughData = new Strikethrough(); strikethroughData.__MarshalFrom(ref *strikethrough); return(callback.DrawStrikethrough(GCHandle.FromIntPtr(clientDrawingContextPtr).Target, baselineOriginX, baselineOriginY, ref strikethroughData, (ComObject)Utilities.GetObjectForIUnknown(clientDrawingEffectPtr)).Code); } }
public static Strikethrough GetStrikethroughStruct(PropertyMap map) { var strikethrough = new Strikethrough(); if (null != map) { strikethrough.Enable = GetBoolFromMap(map, "enable", false); strikethrough.Color = GetColorFromMap(map, "color"); strikethrough.Height = GetFloatFromMap(map, "height", 0.0f); } return(strikethrough); }
public override int GetHashCode() { return(Bold.GetHashCode() ^ Italic.GetHashCode() ^ (Int32)Underline ^ Strikethrough.GetHashCode() ^ (Int32)VerticalAlignment ^ Shadow.GetHashCode() ^ FontSize.GetHashCode() ^ FontColor.GetHashCode() ^ FontName.GetHashCode() ^ (Int32)FontFamilyNumbering); }
public override Result DrawStrikethrough( object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { var point0 = new Vector2(baselineOriginX, baselineOriginY + strikethrough.Offset); var point1 = new Vector2(baselineOriginX + strikethrough.Width, baselineOriginY + strikethrough.Offset); var brush = clientDrawingEffect as Brush ?? _defaultBrush; _renderTarget.DrawLine(point0, point1, brush, strikethrough.Thickness); return(Result.Ok); }
public Boolean Equals(IXLRichString other) { return (Text == other.Text && Bold.Equals(other.Bold) && Italic.Equals(other.Italic) && Underline.Equals(other.Underline) && Strikethrough.Equals(other.Strikethrough) && VerticalAlignment.Equals(other.VerticalAlignment) && Shadow.Equals(other.Shadow) && FontSize.Equals(other.FontSize) && FontColor.Equals(other.FontColor) && FontName.Equals(other.FontName) && FontFamilyNumbering.Equals(other.FontFamilyNumbering) ); }
public override int GetHashCode() { var hashCode = 1158783753; hashCode = hashCode * -1521134295 + Bold.GetHashCode(); hashCode = hashCode * -1521134295 + Italic.GetHashCode(); hashCode = hashCode * -1521134295 + Underline.GetHashCode(); hashCode = hashCode * -1521134295 + Strikethrough.GetHashCode(); hashCode = hashCode * -1521134295 + VerticalAlignment.GetHashCode(); hashCode = hashCode * -1521134295 + Shadow.GetHashCode(); hashCode = hashCode * -1521134295 + FontSize.GetHashCode(); hashCode = hashCode * -1521134295 + FontColor.GetHashCode(); hashCode = hashCode * -1521134295 + StringComparer.InvariantCultureIgnoreCase.GetHashCode(FontName); hashCode = hashCode * -1521134295 + FontFamilyNumbering.GetHashCode(); hashCode = hashCode * -1521134295 + FontCharSet.GetHashCode(); return(hashCode); }
public static PropertyMap GetStrikethroughMap(Strikethrough strikethrough) { var map = new PropertyMap(); map.Add("enable", strikethrough.Enable); if (strikethrough.Color != null) { map.Add("color", strikethrough.Color); } if (strikethrough.Height != null) { map.Add("height", (float)strikethrough.Height); } return(map); }
private static unsafe int DrawStrikethrough(IntPtr thisObject, IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, GlyphOrientationAngle orientationAngle, Strikethrough.__Native *strikethroughNative, IntPtr clientDrawingEffectPtr) { try { var shadow = ToShadow <IDWriteTextRenderer1Shadow>(thisObject); var callback = (IDWriteTextRenderer1)shadow.Callback; Strikethrough strikethrough = default; strikethrough.__MarshalFrom(ref *strikethroughNative); var clientDrawingEffect = clientDrawingEffectPtr == IntPtr.Zero ? null : new ComObject(clientDrawingEffectPtr); callback.DrawStrikethrough(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, ref strikethrough, clientDrawingEffect); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
private static unsafe int DrawStrikethroughImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float baselineOriginX, float baselineOriginY, Strikethrough.__Native *strikethroughNative, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRendererShadow shadow = ToShadow <IDWriteTextRendererShadow>(thisObject); IDWriteTextRenderer callback = (IDWriteTextRenderer)shadow.Callback; var strikethrough = new Strikethrough(); strikethrough.__MarshalFrom(ref *strikethroughNative); callback.DrawStrikethrough(clientDrawingContextPtr, baselineOriginX, baselineOriginY, ref strikethrough, clientDrawingEffectPtr == IntPtr.Zero ? null : (IUnknown)Marshal.GetObjectForIUnknown(clientDrawingEffectPtr)); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
public override Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { PathGeometry pg = new PathGeometry(this.factory); GeometrySink sink = pg.Open(); Vector2 topLeft = new Vector2(0.0f, strikethrough.Offset); sink.BeginFigure(topLeft, FigureBegin.Filled); topLeft.X += strikethrough.Width; sink.AddLine(topLeft); topLeft.Y += strikethrough.Thickness; sink.AddLine(topLeft); topLeft.X -= strikethrough.Width; sink.AddLine(topLeft); sink.EndFigure(FigureEnd.Closed); sink.Close(); TransformedGeometry tg = new TransformedGeometry(this.factory, pg, Matrix3x2.Translation(baselineOriginX, baselineOriginY) * Matrix3x2.Scaling(1.0f, -1.0f)); pg.Dispose(); this.AddGeometry(tg); return Result.Ok; }
/// <summary> /// IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough. /// </summary> /// <remarks> /// A single strikethrough can be broken into multiple calls, depending on how the formatting changes attributes. Strikethrough is not averaged across font sizes/styles changes. To get an appropriate starting pixel position, add strikethrough::offset to the baseline. Like underlines, the x coordinate will always be passed as the left side, regardless of text directionality. /// </remarks> /// <param name="clientDrawingContext">The application-defined drawing context passed to IDWriteTextLayout::Draw.</param> /// <param name="baselineOriginX">The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="baselineOriginY">The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="strikethrough">Pointer to a structure containing strikethrough logical information.</param> /// <param name="clientDrawingEffect">Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.</param> /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <unmanaged>HRESULT DrawStrikethrough([None] void* clientDrawingContext,[None] FLOAT baselineOriginX,[None] FLOAT baselineOriginY,[In] const DWRITE_STRIKETHROUGH* strikethrough,[None] IUnknown* clientDrawingEffect)</unmanaged> public virtual Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { return Result.NotImplemented; }
public override Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { PathGeometry pg = new PathGeometry(this.factory); GeometrySink sink = pg.Open(); Vector2 topLeft = new Vector2(0.0f, strikethrough.Offset); sink.BeginFigure(topLeft, FigureBegin.Filled); topLeft.X += strikethrough.Width; sink.AddLine(topLeft); topLeft.Y += strikethrough.Thickness; sink.AddLine(topLeft); topLeft.X -= strikethrough.Width; sink.AddLine(topLeft); sink.EndFigure(FigureEnd.Closed); sink.Close(); TransformedGeometry tg = new TransformedGeometry(this.factory, pg, Matrix3x2.Translation(baselineOriginX, baselineOriginY) * Matrix3x2.Scaling(1.0f, -1.0f)); pg.Dispose(); sink.Dispose(); this.AddGeometry(tg); return(Result.Ok); }
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { throw new NotImplementedException(); }
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { var rect = new SharpDX.RectangleF(0, strikethrough.Offset, strikethrough.Width, strikethrough.Offset + strikethrough.Thickness); var rectangleGeometry = new RectangleGeometry(_d2DFactory, rect); var matrix = new Matrix3x2() { M11 = 1, M12 = 0, M21 = 0, M22 = 1, M31 = baselineOriginX, M32 = baselineOriginY }; var transformedGeometry = new TransformedGeometry(_d2DFactory, rectangleGeometry, matrix); _renderTarget.DrawGeometry(transformedGeometry, FontBrush); _renderTarget.FillGeometry(transformedGeometry, FontBrush); rectangleGeometry.Dispose(); transformedGeometry.Dispose(); return(Result.Ok); }
/// <summary> /// IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough. /// </summary> /// <remarks> /// A single strikethrough can be broken into multiple calls, depending on how the formatting changes attributes. Strikethrough is not averaged across font sizes/styles changes. To get an appropriate starting pixel position, add strikethrough::offset to the baseline. Like underlines, the x coordinate will always be passed as the left side, regardless of text directionality. /// </remarks> /// <param name="clientDrawingContext">The application-defined drawing context passed to IDWriteTextLayout::Draw.</param> /// <param name="baselineOriginX">The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="baselineOriginY">The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="strikethrough">Pointer to a structure containing strikethrough logical information.</param> /// <param name="clientDrawingEffect">Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.</param> /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns> /// <unmanaged>HRESULT DrawStrikethrough([None] void* clientDrawingContext,[None] FLOAT baselineOriginX,[None] FLOAT baselineOriginY,[In] const DWRITE_STRIKETHROUGH* strikethrough,[None] IUnknown* clientDrawingEffect)</unmanaged> public virtual Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { return(Result.NotImplemented); }
public void DrawStrikethrough(float baselineOriginX, float baselineOriginY, Strikethrough strikethrough, ClientDrawingEffect clientDrawingEffect) { throw new NotImplementedException(); }
private unsafe static int DrawStrikethroughImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float baselineOriginX, float baselineOriginY, Strikethrough.__Native* strikethrough, IntPtr clientDrawingEffectPtr) { unsafe { var shadow = ToShadow<TextRendererShadow>(thisObject); var callback = (TextRenderer)shadow.Callback; var strikethroughData = new Strikethrough(); strikethroughData.__MarshalFrom(ref *strikethrough); return callback.DrawStrikethrough(GCHandle.FromIntPtr(clientDrawingContextPtr).Target, baselineOriginX, baselineOriginY, ref strikethroughData, (ComObject)Utilities.GetObjectForIUnknown(clientDrawingEffectPtr)).Code; } }
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { var rect = new SharpDX.RectangleF(0, strikethrough.Offset, strikethrough.Width, strikethrough.Offset + strikethrough.Thickness); var rectangleGeometry = new RectangleGeometry(_d2DFactory, rect); var matrix = new Matrix3x2() { M11 = 1, M12 = 0, M21 = 0, M22 = 1, M31 = baselineOriginX, M32 = baselineOriginY }; var transformedGeometry = new TransformedGeometry(_d2DFactory, rectangleGeometry, matrix); var brushColor = (Color4)Color.Black; if (clientDrawingEffect != null && clientDrawingEffect is ColorDrawingEffect) { brushColor = (Color4)(clientDrawingEffect as ColorDrawingEffect).Color; } var brush = new SolidColorBrush(_renderTarget, brushColor); _renderTarget.DrawGeometry(transformedGeometry, brush); _renderTarget.FillGeometry(transformedGeometry, brush); rectangleGeometry.Dispose(); transformedGeometry.Dispose(); brush.Dispose(); return(Result.Ok); }
public void VisitStrikethrough(Strikethrough item) { verifier[TagTable.Strikethrough] = item.Value; }
/// <summary> /// <see cref="IDWriteTextLayout.Draw(IntPtr, IDWriteTextRenderer, float, float)"/> calls this function to instruct the client to draw a strikethrough. /// </summary> /// <param name="clientDrawingContext">The drawing context passed to <see cref="IDWriteTextLayout.Draw(IntPtr, IDWriteTextRenderer, float, float)"/>.</param> /// <param name="baselineOriginX">The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="baselineOriginY">The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="strikethrough"><see cref="Strikethrough"/> structure containing strikethrough logical information.</param> /// <param name="clientDrawingEffect">Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.</param> public virtual void DrawStrikethrough(IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, IUnknown clientDrawingEffect) { }
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { var rect = new SharpDX.RectangleF(0, strikethrough.Offset, strikethrough.Width, strikethrough.Offset + strikethrough.Thickness); using (var rectangleGeometry = new RectangleGeometry(_d2DFactory, rect)) { var matrix = new Matrix3x2() { M11 = 1, M12 = 0, M21 = 0, M22 = 1, M31 = baselineOriginX, M32 = baselineOriginY }; using (var transformedGeometry = new TransformedGeometry(_d2DFactory, rectangleGeometry, matrix)) { _dc.DrawGeometry(transformedGeometry, _outlineBrush); _dc.FillGeometry(transformedGeometry, _fillBrush); } } return(Result.Ok); }
/// <summary> /// Gets the raw JSON string /// </summary> /// <returns>the raw JSON string used by the game</returns> public virtual string GetJsonString() { List <string> outString = new List <string>(); if (!(Color is null) && !(RGBColor is null)) { throw new InvalidOperationException("Cannot get json string since both " + nameof(Color) + " and" + nameof(RGBColor) + " is set."); } if (!(Color is null)) { outString.Add("\"color\":\"" + Color + "\""); } if (!(RGBColor is null)) { outString.Add("\"color\":\"" + RGBColor.GetHexColor() + "\""); } if (!(Obfuscated is null)) { outString.Add("\"obfuscated\":" + Obfuscated.ToMinecraftBool()); } if (!(Bold is null)) { outString.Add("\"bold\":" + Bold.ToMinecraftBool()); } if (!(Italic is null)) { outString.Add("\"italic\":" + Italic.ToMinecraftBool()); } if (!(Strikethrough is null)) { outString.Add("\"strikethrough\":" + Strikethrough.ToMinecraftBool()); } if (!(Underline is null)) { outString.Add("\"underlined\":" + Underline.ToMinecraftBool()); } if (!(Reset is null)) { outString.Add("\"reset\":" + Reset.ToMinecraftBool()); } if (!(ShiftClickInsertion is null)) { outString.Add("\"insertion\":\"" + ShiftClickInsertion.Escape() + "\""); } if (!(Font is null)) { outString.Add("\"font\":\"" + Font.Escape() + "\""); } if (!(ClickEvent is null)) { outString.Add(ClickEvent.GetEventString()); } if (!(HoverEvent is null)) { outString.Add(HoverEvent.GetEventString()); } if (!(Extra is null) && Extra.Length != 0) { outString.Add("\"extra\":[" + string.Join(",", Extra.Select(j => j.GetJsonString())) + "]"); } outString.Add(GetSpecificJsonString()); return("{" + string.Join(",", outString) + "}"); }
public void DrawStrikethrough(IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, GlyphOrientationAngle orientationAngle, ref Strikethrough strikethrough, IUnknown clientDrawingEffect) => DrawStrikethrough_(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, ref strikethrough, clientDrawingEffect);
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { var rect = new SharpDX.RectangleF(0, strikethrough.Offset, strikethrough.Width, strikethrough.Offset + strikethrough.Thickness); var rectangleGeometry = new RectangleGeometry(_d2DFactory, rect); var matrix = new Matrix3x2() { M11 = 1, M12 = 0, M21 = 0, M22 = 1, M31 = baselineOriginX, M32 = baselineOriginY }; var transformedGeometry = new TransformedGeometry(_d2DFactory, rectangleGeometry, matrix); var brushColor = (Color4)Color.Black; if (clientDrawingEffect != null && clientDrawingEffect is ColorDrawingEffect) brushColor = (Color4)(clientDrawingEffect as ColorDrawingEffect).Color; var brush = new SolidColorBrush(_renderTarget, brushColor); _renderTarget.DrawGeometry(transformedGeometry, brush); _renderTarget.FillGeometry(transformedGeometry, brush); rectangleGeometry.Dispose(); transformedGeometry.Dispose(); brush.Dispose(); return Result.Ok; }
/// <summary> /// IDWriteTextLayout::Draw calls this function to instruct the client to draw a strikethrough. /// </summary> /// <param name="clientDrawingContext">The application-defined drawing context passed to IDWriteTextLayout::Draw.</param> /// <param name="baselineOriginX">The pixel location (X-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="baselineOriginY">The pixel location (Y-coordinate) at the baseline origin of the run where strikethrough applies.</param> /// <param name="strikethrough">Pointer to a structure containing strikethrough logical information.</param> /// <param name="clientDrawingEffect">Application-defined effect to apply to the strikethrough. Usually this argument represents effects such as the foreground brush filling the interior of a line.</param> /// <returns> /// If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// </returns> /// <unmanaged>HRESULT DrawStrikethrough([None] void* clientDrawingContext,[None] FLOAT baselineOriginX,[None] FLOAT baselineOriginY,[In] const DWRITE_STRIKETHROUGH* strikethrough,[None] IUnknown* clientDrawingEffect)</unmanaged> /// <remarks> /// A single strikethrough can be broken into multiple calls, depending on how the formatting changes attributes. Strikethrough is not averaged across font sizes/styles changes. To get an appropriate starting pixel position, add strikethrough::offset to the baseline. Like underlines, the x coordinate will always be passed as the left side, regardless of text directionality. /// </remarks> public override SDX.Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, SDX.ComObject clientDrawingEffect) { return(SDX.Result.Ok); }
public Result DrawStrikethrough(object clientDrawingContext, float baselineOriginX, float baselineOriginY, ref Strikethrough strikethrough, ComObject clientDrawingEffect) { return(new Result()); }