public Matrix(RectangleF rect, PointF[] plgpts)
 {
     if (plgpts == null)
     {
         throw new ArgumentNullException("plgpts");
     }
     if (plgpts.Length != 3)
     {
         throw SafeNativeMethods.Gdip.StatusException(2);
     }
     IntPtr handle = SafeNativeMethods.Gdip.ConvertPointToMemory(plgpts);
     try
     {
         IntPtr zero = IntPtr.Zero;
         GPRECTF gprectf = new GPRECTF(rect);
         int status = SafeNativeMethods.Gdip.GdipCreateMatrix3(ref gprectf, new HandleRef(null, handle), out zero);
         if (status != 0)
         {
             throw SafeNativeMethods.Gdip.StatusException(status);
         }
         this.nativeMatrix = zero;
     }
     finally
     {
         Marshal.FreeHGlobal(handle);
     }
 }
Beispiel #2
0
 internal static extern int GdipGetPathWorldBounds(HandleRef path, ref GPRECTF gprectf, HandleRef matrix, HandleRef pen);
Beispiel #3
0
        public RectangleF GetBounds(ref GraphicsUnit pageUnit) {
            GPRECTF gprectf = new GPRECTF();

            int status = SafeNativeMethods.Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), ref gprectf, out pageUnit);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            return gprectf.ToRectangleF();
        }
        public void EnumerateMetafile(Metafile metafile, PointF[] destPoints,
                                      RectangleF srcRect, GraphicsUnit unit,
                                      EnumerateMetafileProc callback, IntPtr callbackData,
                                      ImageAttributes imageAttr) {
            if (destPoints == null)
                throw new ArgumentNullException("destPoints");
            if (destPoints.Length != 3) {
                throw new ArgumentException(SR.GetString(SR.GdiplusDestPointsInvalidParallelogram));
            }

            IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
            IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);

            IntPtr buffer = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);

            GPRECTF grf = new GPRECTF(srcRect);

            int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPoints(new HandleRef(this, this.NativeGraphics),
                                                                        new HandleRef(metafile, mf),
                                                                        buffer,
                                                                        destPoints.Length,
                                                                        ref grf,
                                                                        unchecked((int) unit),
                                                                        callback,
                                                                        new HandleRef(null, callbackData),
                                                                        new HandleRef(imageAttr, ia));
            Marshal.FreeHGlobal(buffer);                                                                     

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
        }
        public Region[] MeasureCharacterRanges(String text, Font font, RectangleF layoutRect, 
                                          StringFormat stringFormat ) {
            if (text == null || text.Length == 0) {
                return new Region[]{};
            }
            if (font == null){
                throw new ArgumentNullException("font");
            }

            int count;
            int status = SafeNativeMethods.Gdip.GdipGetStringFormatMeasurableCharacterRangeCount(new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat)
                                                                                    , out count);

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            IntPtr[] gpRegions = new IntPtr[count];

            GPRECTF grf = new GPRECTF(layoutRect);
                                          
            Region[] regions = new Region[count];

            for (int f = 0; f < count; f++) {
                regions[f] = new Region();
                gpRegions[f] = (IntPtr)regions[f].nativeRegion;
            }

            status = SafeNativeMethods.Gdip.GdipMeasureCharacterRanges(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref grf, 
                                                         new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat),
                                                         count, gpRegions);


            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            return regions;
        }
        /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString1"]/*' />
        /// <devdoc>
        /// </devdoc>
        public SizeF MeasureString(String text, Font font, PointF origin, StringFormat stringFormat) {
            if (text == null || text.Length == 0)
                return new SizeF(0, 0);
            if (font == null)
                throw new ArgumentNullException("font");

            GPRECTF grf = new GPRECTF();
            GPRECTF grfboundingBox = new GPRECTF();

            grf.X = origin.X;
            grf.Y = origin.Y;
            grf.Width = 0;
            grf.Height = 0;
            
            int a, b;
            int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont),
                ref grf, 
                new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), 
                ref grfboundingBox, out a, out b);

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            return grfboundingBox.SizeF;

        }
 public void Xor(RectangleF rect)
 {
     GPRECTF gprectf = new GPRECTF(rect);
     int status = SafeNativeMethods.Gdip.GdipCombineRegionRect(new HandleRef(this, this.nativeRegion), ref gprectf, CombineMode.Xor);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
 }
 public RectangleF GetBounds(Graphics g)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     GPRECTF gprectf = new GPRECTF();
     int status = SafeNativeMethods.Gdip.GdipGetRegionBounds(new HandleRef(this, this.nativeRegion), new HandleRef(g, g.NativeGraphics), ref gprectf);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return gprectf.ToRectangleF();
 }
 public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
 {
     if (destPoints == null)
     {
         throw new ArgumentNullException("destPoints");
     }
     if (destPoints.Length != 3)
     {
         throw new ArgumentException(System.Drawing.SR.GetString("GdiplusDestPointsInvalidParallelogram"));
     }
     IntPtr handle = (metafile == null) ? IntPtr.Zero : metafile.nativeImage;
     IntPtr ptr2 = (imageAttr == null) ? IntPtr.Zero : imageAttr.nativeImageAttributes;
     IntPtr ptr3 = SafeNativeMethods.Gdip.ConvertPointToMemory(destPoints);
     GPRECTF gprectf = new GPRECTF(srcRect);
     int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestPoints(new HandleRef(this, this.NativeGraphics), new HandleRef(metafile, handle), ptr3, destPoints.Length, ref gprectf, (int) unit, callback, new HandleRef(null, callbackData), new HandleRef(imageAttr, ptr2));
     Marshal.FreeHGlobal(ptr3);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
 }
 public void EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
 {
     IntPtr handle = (metafile == null) ? IntPtr.Zero : metafile.nativeImage;
     IntPtr ptr2 = (imageAttr == null) ? IntPtr.Zero : imageAttr.nativeImageAttributes;
     GPRECTF gprectf = new GPRECTF(destRect);
     GPRECTF gprectf2 = new GPRECTF(srcRect);
     int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestRect(new HandleRef(this, this.NativeGraphics), new HandleRef(metafile, handle), ref gprectf, ref gprectf2, (int) unit, callback, new HandleRef(null, callbackData), new HandleRef(imageAttr, ptr2));
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
 }
 public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
 {
     if (brush == null)
     {
         throw new ArgumentNullException("brush");
     }
     if ((s != null) && (s.Length != 0))
     {
         if (font == null)
         {
             throw new ArgumentNullException("font");
         }
         GPRECTF layoutRect = new GPRECTF(layoutRectangle);
         IntPtr handle = (format == null) ? IntPtr.Zero : format.nativeFormat;
         int status = SafeNativeMethods.Gdip.GdipDrawString(new HandleRef(this, this.NativeGraphics), s, s.Length, new HandleRef(font, font.NativeFont), ref layoutRect, new HandleRef(format, handle), new HandleRef(brush, brush.NativeBrush));
         this.CheckErrorStatus(status);
     }
 }
Beispiel #12
0
 internal static extern int GdipGetRegionBounds(HandleRef region, HandleRef graphics, ref GPRECTF gprectf);
Beispiel #13
0
 internal static extern int GdipCombineRegionRect(HandleRef region, ref GPRECTF gprectf, CombineMode mode);
Beispiel #14
0
 internal static extern int GdipCreateRegionRect(ref GPRECTF gprectf, out IntPtr region);
Beispiel #15
0
 internal static extern int GdipCreateMatrix3(ref GPRECTF rect, HandleRef dstplg, out IntPtr matrix);
        /**
         * Get source rectangle
         */
        private RectangleF _GetRectangle() {
            GPRECTF rect = new GPRECTF();

            int status = SafeNativeMethods.Gdip.GdipGetLineRect(new HandleRef(this, this.NativeBrush), ref rect);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);
     
            return rect.ToRectangleF();
        }
        public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
                                   LinearGradientMode linearGradientMode)
        {   
            //validate the LinearGradientMode enum
            //valid values are 0x0 to 0x3
            if (!ClientUtils.IsEnumValid(linearGradientMode, unchecked((int)linearGradientMode), (int)LinearGradientMode.Horizontal, (int)LinearGradientMode.BackwardDiagonal)){
                throw new InvalidEnumArgumentException("linearGradientMode", unchecked((int)linearGradientMode), typeof(LinearGradientMode));
            }

            //validate the rect
            if (rect.Width == 0.0 || rect.Height == 0.0) {
                throw new ArgumentException(SR.GetString(SR.GdiplusInvalidRectangle, rect.ToString()));
            }

            IntPtr brush = IntPtr.Zero;

            GPRECTF gprectf = new GPRECTF(rect);
            int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRect(ref gprectf,
                                                             color1.ToArgb(),
                                                             color2.ToArgb(),
                                                             unchecked((int) linearGradientMode),
                                                             (int)WrapMode.Tile,
                                                             out brush);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeBrushInternal(brush);
        }
 public Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
 {
     int num;
     if ((text == null) || (text.Length == 0))
     {
         return new Region[0];
     }
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     int status = SafeNativeMethods.Gdip.GdipGetStringFormatMeasurableCharacterRangeCount(new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), out num);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     IntPtr[] region = new IntPtr[num];
     GPRECTF gprectf = new GPRECTF(layoutRect);
     Region[] regionArray = new Region[num];
     for (int i = 0; i < num; i++)
     {
         regionArray[i] = new Region();
         region[i] = regionArray[i].nativeRegion;
     }
     status = SafeNativeMethods.Gdip.GdipMeasureCharacterRanges(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref gprectf, new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), num, region);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return regionArray;
 }
 public RectangleF[] GetRegionScans(Matrix matrix)
 {
     RectangleF[] efArray;
     if (matrix == null)
     {
         throw new ArgumentNullException("matrix");
     }
     int count = 0;
     int status = SafeNativeMethods.Gdip.GdipGetRegionScansCount(new HandleRef(this, this.nativeRegion), out count, new HandleRef(matrix, matrix.nativeMatrix));
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     int num3 = Marshal.SizeOf(typeof(GPRECTF));
     IntPtr rects = Marshal.AllocHGlobal((int) (num3 * count));
     try
     {
         status = SafeNativeMethods.Gdip.GdipGetRegionScans(new HandleRef(this, this.nativeRegion), rects, out count, new HandleRef(matrix, matrix.nativeMatrix));
         if (status != 0)
         {
             throw SafeNativeMethods.Gdip.StatusException(status);
         }
         GPRECTF gprectf = new GPRECTF();
         efArray = new RectangleF[count];
         for (int i = 0; i < count; i++)
         {
             efArray[i] = ((GPRECTF) UnsafeNativeMethods.PtrToStructure((IntPtr) (((long) rects) + (num3 * i)), typeof(GPRECTF))).ToRectangleF();
         }
     }
     finally
     {
         Marshal.FreeHGlobal(rects);
     }
     return efArray;
 }
 public SizeF MeasureString(string text, Font font, PointF origin, StringFormat stringFormat)
 {
     int num;
     int num2;
     if ((text == null) || (text.Length == 0))
     {
         return new SizeF(0f, 0f);
     }
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     GPRECTF layoutRect = new GPRECTF();
     GPRECTF boundingBox = new GPRECTF();
     layoutRect.X = origin.X;
     layoutRect.Y = origin.Y;
     layoutRect.Width = 0f;
     layoutRect.Height = 0f;
     int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref layoutRect, new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), ref boundingBox, out num, out num2);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return boundingBox.SizeF;
 }
        /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.DrawString5"]/*' />
        /// <devdoc>
        /// </devdoc>
        public void DrawString(String s, Font font, Brush brush, 
                               RectangleF layoutRectangle, StringFormat format) {

            if (brush == null)
                throw new ArgumentNullException("brush");
            
            if (s == null || s.Length == 0) return;
            if (font == null)
                throw new ArgumentNullException("font");

            GPRECTF grf = new GPRECTF(layoutRectangle);
            IntPtr nativeStringFormat = (format == null) ? IntPtr.Zero : format.nativeFormat;
            int status = SafeNativeMethods.Gdip.GdipDrawString(new HandleRef(this, this.NativeGraphics), s, s.Length, new HandleRef(font, font.NativeFont), ref grf, new HandleRef(format, nativeStringFormat), new HandleRef(brush, brush.NativeBrush));

            //check error status sensitive to TS problems
            CheckErrorStatus(status);
        }
 public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
 {
     if ((text == null) || (text.Length == 0))
     {
         charactersFitted = 0;
         linesFilled = 0;
         return new SizeF(0f, 0f);
     }
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     GPRECTF layoutRect = new GPRECTF(0f, 0f, layoutArea.Width, layoutArea.Height);
     GPRECTF boundingBox = new GPRECTF();
     int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref layoutRect, new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), ref boundingBox, out charactersFitted, out linesFilled);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return boundingBox.SizeF;
 }
        /// <include file='doc\Graphics.uex' path='docs/doc[@for="Graphics.MeasureString3"]/*' />
        /// <devdoc>
        /// </devdoc>
        public SizeF MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat) {
            if (text == null || text.Length == 0) {
                return new SizeF(0, 0);
            }

            if (font == null){
                throw new ArgumentNullException("font");
            }

            GPRECTF grfLayout = new GPRECTF(0, 0, layoutArea.Width, layoutArea.Height);
            GPRECTF grfboundingBox = new GPRECTF();
            
            int a, b;
            int status = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), 
                ref grfLayout, 
                new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), 
                ref grfboundingBox, out a, out b);

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }

            return grfboundingBox.SizeF;

        }
Beispiel #24
0
        // float version
        /// <include file='doc\Matrix.uex' path='docs/doc[@for="Matrix.Matrix2"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Drawing.Drawing2D.Matrix'/> class to the geometrical transform
        ///       defined by the specified rectangle and array of points.
        ///    </para>
        /// </devdoc>
        public Matrix(RectangleF rect, PointF[] plgpts) {
            if (plgpts == null) {
                throw new ArgumentNullException("plgpts");
            }
            if (plgpts.Length != 3) {
                throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter);
            }

            IntPtr buf = SafeNativeMethods.Gdip.ConvertPointToMemory(plgpts);

            try {
                IntPtr matrix = IntPtr.Zero;

                GPRECTF gprectf = new GPRECTF(rect);
                int status = SafeNativeMethods.Gdip.GdipCreateMatrix3(ref gprectf, new HandleRef(null, buf), out matrix);

                if (status != SafeNativeMethods.Gdip.Ok) {
                    throw SafeNativeMethods.Gdip.StatusException(status);
                }

                this.nativeMatrix = matrix;
            }
            finally {
                Marshal.FreeHGlobal(buf);
            }
        }
        public void EnumerateMetafile(Metafile metafile, RectangleF destRect,
                                      RectangleF srcRect, GraphicsUnit unit,
                                      EnumerateMetafileProc callback, IntPtr callbackData,
                                      ImageAttributes imageAttr) {
            IntPtr mf = (metafile == null ? IntPtr.Zero : metafile.nativeImage);
            IntPtr ia = (imageAttr == null ? IntPtr.Zero : imageAttr.nativeImageAttributes);

            GPRECTF grfdest = new GPRECTF(destRect);
            GPRECTF grfsrc = new GPRECTF(srcRect);

           int status = SafeNativeMethods.Gdip.GdipEnumerateMetafileSrcRectDestRect(
                                                                        new HandleRef(this, this.NativeGraphics),
                                                                        new HandleRef(metafile, mf),
                                                                        ref grfdest,
                                                                        ref grfsrc,
                                                                        unchecked((int) unit),
                                                                        callback,
                                                                        new HandleRef(null, callbackData),
                                                                        new HandleRef(imageAttr, ia));

            if (status != SafeNativeMethods.Gdip.Ok) {
                throw SafeNativeMethods.Gdip.StatusException(status);
            }
        }
        public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect,
                        MetafileFrameUnit frameUnit, EmfType type, string description)
        {
            IntSecurity.ObjectFromWin32Handle.Demand();
            IntPtr metafile = IntPtr.Zero;
            
            GPRECTF rectf = new GPRECTF(frameRect);
            int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream),
                                                          new HandleRef(null, referenceHdc), 
                                                          unchecked((int)type), 
                                                          ref rectf,
                                                          unchecked((int)frameUnit), 
                                                          description, 
                                                          out metafile);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeImage(metafile);
        }
 // System.Drawing.Graphics
 /// <summary>Measures the specified string when drawn with the specified <see cref="T:System.Drawing.Font" /> and formatted with the specified <see cref="T:System.Drawing.StringFormat" />.</summary>
 /// <returns>This method returns a <see cref="T:System.Drawing.SizeF" /> structure that represents the size, in the units specified by the <see cref="P:System.Drawing.Graphics.PageUnit" /> property, of the string specified in the <paramref name="text" /> parameter as drawn with the <paramref name="font" /> parameter and the <paramref name="stringFormat" /> parameter.</returns>
 /// <param name="text">String to measure. </param>
 /// <param name="font">
 ///   <see cref="T:System.Drawing.Font" /> defines the text format of the string. </param>
 /// <param name="layoutArea">
 ///   <see cref="T:System.Drawing.SizeF" /> structure that specifies the maximum layout area for the text. </param>
 /// <param name="stringFormat">
 ///   <see cref="T:System.Drawing.StringFormat" /> that represents formatting information, such as line spacing, for the string. </param>
 /// <exception cref="T:System.ArgumentException">
 ///   <paramref name="font" /> is null.</exception>
 /// <filterpriority>1</filterpriority>
 public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat)
 {
     if (text == null || text.Length == 0)
     {
         return new SizeF(0f, 0f);
     }
     if (font == null)
     {
         throw new ArgumentNullException("font");
     }
     GPRECTF gPRECTF = new GPRECTF(0f, 0f, layoutArea.Width, layoutArea.Height);
     GPRECTF gPRECTF2 = default(GPRECTF);
     int num2;
     int num3;
     //int num = SafeNativeMethods.Gdip.GdipMeasureString(new HandleRef(this, this.NativeGraphics), text, text.Length, new HandleRef(font, font.NativeFont), ref gPRECTF, new HandleRef(stringFormat, (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat), ref gPRECTF2, out num2, out num3);
     //if (num != 0)
     //{
     //    throw SafeNativeMethods.Gdip.StatusException(num);
     //}
     throw new NotImplementedException();
     return gPRECTF2.SizeF;
 }
        public LinearGradientBrush(RectangleF rect, Color color1, Color color2,
                                 float angle, bool isAngleScaleable)
        {
            IntPtr brush = IntPtr.Zero;

            //validate the rect
            if (rect.Width == 0.0 || rect.Height == 0.0) {
                throw new ArgumentException(SR.GetString(SR.GdiplusInvalidRectangle, rect.ToString()));
            }

            GPRECTF gprectf = new GPRECTF(rect);
            int status = SafeNativeMethods.Gdip.GdipCreateLineBrushFromRectWithAngle(ref gprectf,
                                                                      color1.ToArgb(),
                                                                      color2.ToArgb(),
                                                                      angle,
                                                                      isAngleScaleable,
                                                                      (int)WrapMode.Tile,
                                                                      out brush);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            SetNativeBrushInternal(brush);
        }
 private RectangleF _GetRectangle()
 {
     GPRECTF gprectf = new GPRECTF();
     int status = SafeNativeMethods.Gdip.GdipGetPathGradientRect(new HandleRef(this, base.NativeBrush), ref gprectf);
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     return gprectf.ToRectangleF();
 }
Beispiel #30
0
 internal static extern int GdipAddPathString(HandleRef path, string s, int length,
                                              HandleRef fontFamily, int style, float emSize,
                                              ref GPRECTF layoutRect, HandleRef format);