private void _SetWrapMode(System.Drawing.Drawing2D.WrapMode wrapMode) { int status = SafeNativeMethods.Gdip.GdipSetTextureWrapMode(new HandleRef(this, base.NativeBrush), (int)wrapMode); if (status != 0) { throw SafeNativeMethods.Gdip.StatusException(status); } }
public static GradientWrapMode ToEtoGradientWrap(this sd2.WrapMode wrapMode) { switch (wrapMode) { case sd2.WrapMode.TileFlipXY: return(GradientWrapMode.Reflect); case sd2.WrapMode.Tile: return(GradientWrapMode.Repeat); default: throw new NotSupportedException(); } }
public TextureBrush(System.Drawing.Image image, System.Drawing.Drawing2D.WrapMode wrapMode, RectangleF dstRect) { if (image == null) { throw new ArgumentNullException("image"); } if (!System.Drawing.ClientUtils.IsEnumValid(wrapMode, (int)wrapMode, 0, 4)) { throw new InvalidEnumArgumentException("wrapMode", (int)wrapMode, typeof(System.Drawing.Drawing2D.WrapMode)); } IntPtr zero = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCreateTexture2(new HandleRef(image, image.nativeImage), (int)wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out zero); if (status != 0) { throw SafeNativeMethods.Gdip.StatusException(status); } base.SetNativeBrushInternal(zero); }