public void RemovePropertyItem(int propid) { Status status = GDIPlus.GdipRemovePropertyItem(nativeObject, propid); GDIPlus.CheckStatus(status); }
public void RotateFlip(RotateFlipType rotateFlipType) { Status status = GDIPlus.GdipImageRotateFlip(nativeObject, rotateFlipType); GDIPlus.CheckStatus(status); }
public static Font FromHfont(IntPtr hfont) { IntPtr newObject; IntPtr hdc; FontStyle newStyle = FontStyle.Regular; float newSize; LOGFONT lf = new LOGFONT(); // Sanity. Should we throw an exception? if (hfont == IntPtr.Zero) { Font result = new Font("Arial", (float)10.0, FontStyle.Regular); return(result); } if (GDIPlus.RunningOnUnix()) { // If we're on Unix we use our private gdiplus API to avoid Wine // dependencies in S.D Status s = GDIPlus.GdipCreateFontFromHfont(hfont, out newObject, ref lf); GDIPlus.CheckStatus(s); } else { // This needs testing // GetDC, SelectObject, ReleaseDC GetTextMetric and // GetFontFace are not really GDIPlus, see gdipFunctions.cs newStyle = FontStyle.Regular; hdc = GDIPlus.GetDC(IntPtr.Zero); try { return(FromLogFont(lf, hdc)); } finally { GDIPlus.ReleaseDC(IntPtr.Zero, hdc); } } if (lf.lfItalic != 0) { newStyle |= FontStyle.Italic; } if (lf.lfUnderline != 0) { newStyle |= FontStyle.Underline; } if (lf.lfStrikeOut != 0) { newStyle |= FontStyle.Strikeout; } if (lf.lfWeight > 400) { newStyle |= FontStyle.Bold; } if (lf.lfHeight < 0) { newSize = lf.lfHeight * -1; } else { newSize = lf.lfHeight; } return(new Font(newObject, lf.lfFaceName, newStyle, newSize)); }
public void Intersect(RectangleF_ rect) { Status status = GDIPlus.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.Intersect); GDIPlus.CheckStatus(status); }
public Region() { Status status = GDIPlus.GdipCreateRegion(out nativeRegion); GDIPlus.CheckStatus(status); }
public void MakeInfinite() { Status status = GDIPlus.GdipSetInfinite(nativeRegion); GDIPlus.CheckStatus(status); }
public StringFormat(StringFormatFlags options) { Status status = GDIPlus.GdipCreateStringFormat(options, GDIPlus.LANG_NEUTRAL, out nativeStrFmt); GDIPlus.CheckStatus(status); }
public void Xor(RectangleF rect) { Status status = GDIPlus.GdipCombineRegionRect(nativeRegion, ref rect, CombineMode.Xor); GDIPlus.CheckStatus(status); }
public void SetDigitSubstitution(int language, StringDigitSubstitute substitute) { Status status = GDIPlus.GdipSetStringFormatDigitSubstitution(nativeStrFmt, this.language, substitute); GDIPlus.CheckStatus(status); }
public StringFormat(StringFormatFlags options, int language) { Status status = GDIPlus.GdipCreateStringFormat(options, language, out nativeStrFmt); GDIPlus.CheckStatus(status); }
public void SetTabStops(float firstTabOffset, float[] tabStops) { Status status = GDIPlus.GdipSetStringFormatTabStops(nativeStrFmt, firstTabOffset, tabStops.Length, tabStops); GDIPlus.CheckStatus(status); }
public void UnlockBits(BitmapData bitmapdata) { Status status = GDIPlus.GdipBitmapUnlockBits(nativeObject, bitmapdata); GDIPlus.CheckStatus(status); }
public void SetResolution(float xDpi, float yDpi) { Status status = GDIPlus.GdipBitmapSetResolution(nativeObject, xDpi, yDpi); GDIPlus.CheckStatus(status); }
public void Complement(Rectangle rect) { Status status = GDIPlus.GdipCombineRegionRectI(nativeRegion, ref rect, CombineMode.Complement); GDIPlus.CheckStatus(status); }
public void MultiplyTransform(Matrix matrix, MatrixOrder order) { Status status = GDIPlus.GdipMultiplyPenTransform(nativeObject, matrix.nativeMatrix, order); GDIPlus.CheckStatus(status); }
public void Exclude(Rectangle rect) { Status status = GDIPlus.GdipCombineRegionRectI(nativeRegion, ref rect, CombineMode.Exclude); GDIPlus.CheckStatus(status); }
public void ResetTransform() { Status status = GDIPlus.GdipResetPenTransform(nativeObject); GDIPlus.CheckStatus(status); }
public void Translate(float dx, float dy) { Status status = GDIPlus.GdipTranslateRegion(nativeRegion, dx, dy); GDIPlus.CheckStatus(status); }
public void RotateTransform(float angle, MatrixOrder order) { Status status = GDIPlus.GdipRotatePenTransform(nativeObject, angle, order); GDIPlus.CheckStatus(status); }
public void MakeEmpty() { Status status = GDIPlus.GdipSetEmpty(nativeRegion); GDIPlus.CheckStatus(status); }
public void ScaleTransform(float sx, float sy, MatrixOrder order) { Status status = GDIPlus.GdipScalePenTransform(nativeObject, sx, sy, order); GDIPlus.CheckStatus(status); }
public Region(RectangleF rect) { Status status = GDIPlus.GdipCreateRegionRect(ref rect, out nativeRegion); GDIPlus.CheckStatus(status); }
public void TranslateTransform(float dx, float dy, MatrixOrder order) { Status status = GDIPlus.GdipTranslatePenTransform(nativeObject, dx, dy, order); GDIPlus.CheckStatus(status); }
public void ToLogFont(object logFont, Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } if (logFont == null) { throw new AccessViolationException("logFont"); } Type st = logFont.GetType(); if (!st.GetTypeInfo().IsLayoutSequential) { throw new ArgumentException("logFont", Locale.GetText("Layout must be sequential.")); } // note: there is no exception if 'logFont' isn't big enough Type lf = typeof(LOGFONT); int size = Marshal.SizeOf(logFont); if (size >= Marshal.SizeOf(lf)) { Status status; IntPtr copy = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr(logFont, copy, false); status = GDIPlus.GdipGetLogFont(NativeObject, graphics.NativeObject, logFont); if (status != Status.Ok) { // reset to original values Marshal.PtrToStructure(copy, logFont); } } finally { Marshal.FreeHGlobal(copy); } if (CharSetOffset == -1) { // not sure why this methods returns an IntPtr since it's an offset // anyway there's no issue in downcasting the result into an int32 CharSetOffset = (int)Marshal.OffsetOf(lf, "lfCharSet"); } /* * // note: Marshal.WriteByte(object,*) methods are unimplemented on Mono * GCHandle gch = GCHandle.Alloc (logFont, GCHandleType.Pinned); * try { * IntPtr ptr = gch.AddrOfPinnedObject (); * // if GDI+ lfCharSet is 0, then we return (S.D.) 1, otherwise the value is unchanged * if (Marshal.ReadByte (ptr, CharSetOffset) == 0) { * // set lfCharSet to 1 * Marshal.WriteByte (ptr, CharSetOffset, 1); * } * } * finally { * gch.Free (); * }*/ // now we can throw, if required GDIPlus.CheckStatus(status); } }
public void Union(Rectangle_ rect) { Status status = GDIPlus.GdipCombineRegionRectI(nativeRegion, ref rect, CombineMode.Union); GDIPlus.CheckStatus(status); }