GdiPlusBrush.h
上传用户:jinlangri
上传日期:2022-07-17
资源大小:10774k
文件大小:30k
源码类别:

GDI/图象编程

开发平台:

Visual C++

  1. /**************************************************************************
  2. * Copyright (c) 1998-2000, Microsoft Corp.  All Rights Reserved.
  3. *
  4. * Module Name:
  5. *
  6. *   GdiplusBrush.h
  7. *
  8. * Abstract:
  9. *
  10. *   Brush API related declarations
  11. *
  12. **************************************************************************/
  13. #ifndef _GDIPLUSBRUSH_H
  14. #define _GDIPLUSBRUSH_H
  15. //--------------------------------------------------------------------------
  16. // Abstract base class for various brush types
  17. //--------------------------------------------------------------------------
  18. class GraphicsPath;
  19. class Brush : public GdiplusBase
  20. {
  21. public:
  22.     friend class Pen;
  23.     friend class Graphics;
  24.     virtual ~Brush()
  25.     {
  26.         DllExports::GdipDeleteBrush(nativeBrush);
  27.     }
  28.     virtual Brush* Clone() const
  29.     {
  30.         GpBrush *brush = NULL;
  31.         SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush));
  32.         Brush *newBrush = new Brush(brush, lastResult);
  33.         
  34.         if (newBrush == NULL) 
  35.         {
  36.             DllExports::GdipDeleteBrush(brush);
  37.         }
  38.         return newBrush;
  39.     }
  40.     BrushType GetType() const
  41.     {
  42.         BrushType type = static_cast<BrushType>(-1);
  43.         SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type));
  44.         return type;
  45.     }
  46.     Status GetLastStatus() const
  47.     {
  48.         Status lastStatus = lastResult;
  49.         lastResult = Ok;
  50.         return lastStatus;
  51.     }
  52. protected:
  53.     Brush()
  54.     {
  55.         SetStatus(NotImplemented);
  56.     }
  57. #ifdef DCR_USE_NEW_250932
  58. private:
  59.     Brush(const Brush& brush);
  60.     Brush& operator=(const Brush& brush);
  61. protected:
  62. #else
  63.     Brush(const Brush& brush)
  64.     {
  65.         brush;
  66.         SetStatus(NotImplemented);
  67.     }
  68.     Brush& operator=(const Brush& brush)
  69.     {
  70.         brush;
  71.         SetStatus(NotImplemented);
  72.         return *this;
  73.     }
  74. #endif
  75.     Brush(GpBrush* nativeBrush, Status status)
  76.     {
  77.         lastResult = status;
  78.         SetNativeBrush(nativeBrush);
  79.     }
  80.     VOID SetNativeBrush(GpBrush* nativeBrush)
  81.     {
  82.         this->nativeBrush = nativeBrush;
  83.     }
  84.     Status SetStatus(Status status) const
  85.     {
  86.         if (status != Ok)
  87.             return (lastResult = status);
  88.         else
  89.             return status;
  90.     }
  91.     GpBrush* nativeBrush;
  92.     mutable Status lastResult;
  93. };
  94. //--------------------------------------------------------------------------
  95. // Represent solid fill brush object
  96. //--------------------------------------------------------------------------
  97. class SolidBrush : public Brush
  98. {
  99. public:
  100.     friend class Pen;
  101.     SolidBrush(IN const Color& color)
  102.     {
  103.         GpSolidFill *brush = NULL;
  104.         lastResult = DllExports::GdipCreateSolidFill(color.GetValue(), &brush);
  105.         SetNativeBrush(brush);
  106.     }
  107.     Status GetColor(OUT Color* color) const
  108.     {
  109.         ARGB argb;
  110.         if (color == NULL) 
  111.         {
  112.             return SetStatus(InvalidParameter);
  113.         }
  114.         SetStatus(DllExports::GdipGetSolidFillColor((GpSolidFill*)nativeBrush,
  115.                                                     &argb));
  116.         *color = Color(argb);
  117.         return lastResult;
  118.     }
  119.     Status SetColor(IN const Color& color)
  120.     {
  121.         return SetStatus(DllExports::GdipSetSolidFillColor((GpSolidFill*)nativeBrush, 
  122.                                                            color.GetValue()));
  123.     }
  124. #ifdef DCR_USE_NEW_250932
  125. private:
  126.     SolidBrush(const SolidBrush &);
  127.     SolidBrush& operator=(const SolidBrush &);
  128. #endif
  129. protected:
  130.     SolidBrush()
  131.     {
  132.     }
  133. };
  134. class TextureBrush : public Brush
  135. {
  136. public:
  137.     friend class Pen;
  138.     TextureBrush(IN Image* image, 
  139.                  IN WrapMode wrapMode = WrapModeTile)
  140.     {
  141.         GpTexture *texture = NULL;
  142.         lastResult = DllExports::GdipCreateTexture(
  143.                                                   image->nativeImage,
  144.                                                   wrapMode, &texture);
  145.         SetNativeBrush(texture);
  146.     }
  147.     // When creating a texture brush from a metafile image, the dstRect
  148.     // is used to specify the size that the metafile image should be
  149.     // rendered at in the device units of the destination graphics.
  150.     // It is NOT used to crop the metafile image, so only the width 
  151.     // and height values matter for metafiles.
  152.     TextureBrush(IN Image* image, 
  153.                  IN WrapMode wrapMode,
  154.                  IN const RectF &dstRect)
  155.     {
  156.         GpTexture *texture = NULL;
  157.         lastResult = DllExports::GdipCreateTexture2(
  158.                                                    image->nativeImage,
  159.                                                    wrapMode, 
  160.                                                    dstRect.X, 
  161.                                                    dstRect.Y, 
  162.                                                    dstRect.Width, 
  163.                                                    dstRect.Height,
  164.                                                    &texture);
  165.         SetNativeBrush(texture);
  166.     }
  167.     
  168.     // When creating a texture brush from a metafile image, the dstRect
  169.     // is used to specify the size that the metafile image should be
  170.     // rendered at in the device units of the destination graphics.
  171.     // It is NOT used to crop the metafile image, so only the width 
  172.     // and height values matter for metafiles.
  173.     TextureBrush(IN Image *image, 
  174.                  IN const RectF &dstRect,
  175.                  IN const ImageAttributes *imageAttributes = NULL)
  176.     {
  177.         GpTexture *texture = NULL;
  178.         lastResult = DllExports::GdipCreateTextureIA(
  179.             image->nativeImage,
  180.             (imageAttributes)?imageAttributes->nativeImageAttr:NULL,
  181.             dstRect.X, 
  182.             dstRect.Y, 
  183.             dstRect.Width, 
  184.             dstRect.Height,
  185.             &texture
  186.         );
  187.         SetNativeBrush(texture);
  188.     }
  189.     
  190.     #ifdef DCR_USE_NEW_145138
  191.     TextureBrush(IN Image *image, 
  192.                  IN const Rect &dstRect,
  193.                  IN const ImageAttributes *imageAttributes = NULL)
  194.     {
  195.         GpTexture *texture = NULL;
  196.         lastResult = DllExports::GdipCreateTextureIAI(
  197.             image->nativeImage,
  198.             (imageAttributes)?imageAttributes->nativeImageAttr:NULL,
  199.             dstRect.X, 
  200.             dstRect.Y, 
  201.             dstRect.Width, 
  202.             dstRect.Height,
  203.             &texture
  204.         );
  205.         SetNativeBrush(texture);
  206.     }
  207.     #endif
  208.     // When creating a texture brush from a metafile image, the dstRect
  209.     // is used to specify the size that the metafile image should be
  210.     // rendered at in the device units of the destination graphics.
  211.     // It is NOT used to crop the metafile image, so only the width 
  212.     // and height values matter for metafiles.
  213.     TextureBrush(
  214.         IN Image* image,
  215.         IN WrapMode wrapMode,
  216.         
  217.         #ifdef DCR_USE_NEW_145138       
  218.         const IN Rect &dstRect
  219.         #else
  220.         IN Rect &dstRect
  221.         #endif
  222.     )
  223.     {
  224.         GpTexture *texture = NULL;
  225.         lastResult = DllExports::GdipCreateTexture2I(
  226.                                                     image->nativeImage,
  227.                                                     wrapMode, 
  228.                                                     dstRect.X, 
  229.                                                     dstRect.Y, 
  230.                                                     dstRect.Width, 
  231.                                                     dstRect.Height,
  232.                                                     &texture);
  233.         SetNativeBrush(texture);
  234.     }
  235.     // When creating a texture brush from a metafile image, the dstRect
  236.     // is used to specify the size that the metafile image should be
  237.     // rendered at in the device units of the destination graphics.
  238.     // It is NOT used to crop the metafile image, so only the width 
  239.     // and height values matter for metafiles.
  240.     TextureBrush(IN Image* image, 
  241.                  IN WrapMode wrapMode, 
  242.                  IN REAL dstX, 
  243.                  IN REAL dstY, 
  244.                  IN REAL dstWidth, 
  245.                  IN REAL dstHeight)
  246.     {
  247.         GpTexture *texture = NULL;
  248.         lastResult = DllExports::GdipCreateTexture2(
  249.                                                    image->nativeImage,
  250.                                                    wrapMode, 
  251.                                                    dstX, 
  252.                                                    dstY, 
  253.                                                    dstWidth, 
  254.                                                    dstHeight,
  255.                                                    &texture);
  256.         SetNativeBrush(texture);
  257.     }
  258.     // When creating a texture brush from a metafile image, the dstRect
  259.     // is used to specify the size that the metafile image should be
  260.     // rendered at in the device units of the destination graphics.
  261.     // It is NOT used to crop the metafile image, so only the width 
  262.     // and height values matter for metafiles.
  263.     TextureBrush(IN Image* image, 
  264.                  IN WrapMode wrapMode, 
  265.                  IN INT dstX, 
  266.                  IN INT dstY, 
  267.                  IN INT dstWidth, 
  268.                  IN INT dstHeight)
  269.     {
  270.         GpTexture *texture = NULL;
  271.         lastResult = DllExports::GdipCreateTexture2I(
  272.                                                     image->nativeImage,
  273.                                                     wrapMode, 
  274.                                                     dstX, 
  275.                                                     dstY, 
  276.                                                     dstWidth, 
  277.                                                     dstHeight,
  278.                                                     &texture);
  279.         SetNativeBrush(texture);
  280.     }
  281.     /**
  282.      * Set/get brush transform
  283.      */
  284.     Status SetTransform(IN const Matrix* matrix)
  285.     {
  286.         return SetStatus(DllExports::GdipSetTextureTransform((GpTexture*)nativeBrush, 
  287.                                                              matrix->nativeMatrix));
  288.     }
  289.     Status GetTransform(OUT Matrix* matrix) const
  290.     {
  291.         return SetStatus(DllExports::GdipGetTextureTransform((GpTexture*)nativeBrush, 
  292.                                                              matrix->nativeMatrix));
  293.     }
  294.     Status ResetTransform()
  295.     {
  296.         return SetStatus(DllExports::GdipResetTextureTransform((GpTexture*)nativeBrush));
  297.     }
  298.     Status MultiplyTransform(IN const Matrix* matrix,
  299.                              IN MatrixOrder order = MatrixOrderPrepend)
  300.     {
  301.         return SetStatus(DllExports::GdipMultiplyTextureTransform((GpTexture*)nativeBrush,
  302.                                                                 matrix->nativeMatrix,
  303.                                                                 order));
  304.     }
  305.     Status TranslateTransform(IN REAL dx,
  306.                               IN REAL dy,
  307.                               IN MatrixOrder order = MatrixOrderPrepend)
  308.     {
  309.         return SetStatus(DllExports::GdipTranslateTextureTransform((GpTexture*)nativeBrush,
  310.                                                                dx, dy, order));
  311.     }
  312.     Status ScaleTransform(IN REAL sx, 
  313.                           IN REAL sy,
  314.                           IN MatrixOrder order = MatrixOrderPrepend)
  315.     {
  316.         return SetStatus(DllExports::GdipScaleTextureTransform((GpTexture*)nativeBrush,
  317.                                                              sx, sy, order));
  318.     }
  319.     Status RotateTransform(IN REAL angle, 
  320.                            IN MatrixOrder order = MatrixOrderPrepend)
  321.     {
  322.         return SetStatus(DllExports::GdipRotateTextureTransform((GpTexture*)nativeBrush,
  323.                                                               angle, order));
  324.     }
  325.     /**
  326.      * Set/get brush wrapping mode
  327.      */
  328.     Status SetWrapMode(IN WrapMode wrapMode)
  329.     {
  330.         return SetStatus(DllExports::GdipSetTextureWrapMode((GpTexture*)nativeBrush, 
  331.                                                             wrapMode));
  332.     }
  333.     WrapMode GetWrapMode() const
  334.     {
  335.         WrapMode wrapMode;
  336.         SetStatus(DllExports::GdipGetTextureWrapMode((GpTexture*)nativeBrush, 
  337.                                                      &wrapMode));
  338.         return wrapMode;
  339.     }
  340.     // Get texture brush attributes
  341.     Image *GetImage() const
  342.     {
  343.         GpImage *image;
  344.         SetStatus(DllExports::GdipGetTextureImage((GpTexture *)nativeBrush,
  345.                                                   &image));
  346.         Image *retimage = new Image(image, lastResult);
  347.         if (retimage == NULL) 
  348.         {
  349.             DllExports::GdipDisposeImage(image);
  350.         }
  351.         return retimage;
  352.     }
  353. #ifdef DCR_USE_NEW_250932
  354. private:
  355.     TextureBrush(const TextureBrush &);
  356.     TextureBrush& operator=(const TextureBrush &);
  357. #endif
  358. protected:
  359.     TextureBrush()
  360.     {
  361.     }
  362. };
  363. //--------------------------------------------------------------------------
  364. // Represent line gradient brush object
  365. //--------------------------------------------------------------------------
  366. class LinearGradientBrush : public Brush
  367. {
  368. public:
  369.     friend class Pen;
  370.     LinearGradientBrush(IN const PointF& point1,
  371.                         IN const PointF& point2,
  372.                         IN const Color& color1,
  373.                         IN const Color& color2)
  374.     {
  375.         GpLineGradient *brush = NULL;
  376.         lastResult = DllExports::GdipCreateLineBrush(&point1,
  377.                                                      &point2,
  378.                                                      color1.GetValue(),
  379.                                                      color2.GetValue(),
  380.                                                      WrapModeTile,
  381.                                                      &brush);
  382.         SetNativeBrush(brush);
  383.     }
  384.     LinearGradientBrush(IN const Point& point1,
  385.                         IN const Point& point2,
  386.                         IN const Color& color1,
  387.                         IN const Color& color2)
  388.     {
  389.         GpLineGradient *brush = NULL;
  390.         lastResult = DllExports::GdipCreateLineBrushI(&point1,
  391.                                                       &point2,
  392.                                                       color1.GetValue(),
  393.                                                       color2.GetValue(),
  394.                                                       WrapModeTile,
  395.                                                       &brush);
  396.         SetNativeBrush(brush);
  397.     }
  398.     LinearGradientBrush(IN const RectF& rect,
  399.                         IN const Color& color1,
  400.                         IN const Color& color2,
  401.                         IN LinearGradientMode mode)
  402.     {
  403.         GpLineGradient *brush = NULL;
  404.         lastResult = DllExports::GdipCreateLineBrushFromRect(&rect,
  405.                                                              color1.GetValue(),
  406.                                                              color2.GetValue(),
  407.                                                              mode,
  408.                                                              WrapModeTile,
  409.                                                              &brush);
  410.         SetNativeBrush(brush);
  411.     }
  412.     LinearGradientBrush(IN const Rect& rect,
  413.                         IN const Color& color1,
  414.                         IN const Color& color2,
  415.                         IN LinearGradientMode mode)
  416.     {
  417.         GpLineGradient *brush = NULL;
  418.         lastResult = DllExports::GdipCreateLineBrushFromRectI(&rect,
  419.                                                               color1.GetValue(),
  420.                                                               color2.GetValue(),
  421.                                                               mode,
  422.                                                               WrapModeTile,
  423.                                                               &brush);
  424.         SetNativeBrush(brush);
  425.     }
  426.     LinearGradientBrush(IN const RectF& rect,
  427.                         IN const Color& color1,
  428.                         IN const Color& color2,
  429.                         IN REAL angle,
  430.                         IN BOOL isAngleScalable = FALSE)
  431.     {
  432.         GpLineGradient *brush = NULL;
  433.         lastResult = DllExports::GdipCreateLineBrushFromRectWithAngle(&rect,
  434.                                                                       color1.GetValue(),
  435.                                                                       color2.GetValue(),
  436.                                                                       angle,
  437.                                                                       isAngleScalable,
  438.                                                                       WrapModeTile,
  439.                                                                       &brush);
  440.         SetNativeBrush(brush);
  441.     }
  442.     LinearGradientBrush(IN const Rect& rect,
  443.                         IN const Color& color1,
  444.                         IN const Color& color2,
  445.                         IN REAL angle,
  446.                         IN BOOL isAngleScalable = FALSE)
  447.     {
  448.         GpLineGradient *brush = NULL;
  449.         lastResult = DllExports::GdipCreateLineBrushFromRectWithAngleI(&rect,
  450.                                                                        color1.GetValue(),
  451.                                                                        color2.GetValue(),
  452.                                                                        angle,
  453.                                                                        isAngleScalable,
  454.                                                                        WrapModeTile,
  455.                                                                        &brush);
  456.         SetNativeBrush(brush);
  457.     }
  458.     // Get/set point attributes
  459.     Status SetLinearPoints(IN const PointF& point1, 
  460.                            IN const PointF& point2)
  461.     {
  462.         return SetStatus(DllExports::GdipSetLinePoints((GpLineGradient*)nativeBrush,
  463.                                                        &point1, &point2));
  464.     }
  465.     Status GetLinearPoints(OUT PointF* points) const 
  466.     {
  467.         return SetStatus(DllExports::GdipGetLinePoints((GpLineGradient*) nativeBrush,
  468.                                                        points));
  469.     }
  470.     Status SetLinearPoints(IN const Point& point1, 
  471.                            IN const Point& point2)
  472.     {
  473.         return SetStatus(DllExports::GdipSetLinePointsI((GpLineGradient*)nativeBrush,
  474.                                                         &point1, &point2));
  475.     }
  476.     Status GetLinearPoints(OUT Point* points) const
  477.     {
  478.         return SetStatus(DllExports::GdipGetLinePointsI((GpLineGradient*) nativeBrush,
  479.                                                         points));
  480.     }
  481.     // Get/set color attributes
  482.     Status SetLinearColors(IN const Color& color1, 
  483.                            IN const Color& color2)
  484.     {
  485.         return SetStatus(DllExports::GdipSetLineColors((GpLineGradient*)nativeBrush,
  486.                                                        color1.GetValue(),
  487.                                                        color2.GetValue()));
  488.     }
  489.     Status GetLinearColors(OUT Color* colors) const
  490.     {
  491.         ARGB argb[2];
  492.         if (colors == NULL) 
  493.         {
  494.             return SetStatus(InvalidParameter);
  495.         }
  496.         
  497.         SetStatus(DllExports::GdipGetLineColors((GpLineGradient*) nativeBrush, argb));
  498.         if (lastResult == Ok)
  499.         {
  500.             // use bitwise copy operator for Color copy
  501.             colors[0] = Color(argb[0]);
  502.             colors[1] = Color(argb[1]);
  503.         }
  504.         return lastResult;
  505.     }
  506.     Status GetRectangle(OUT RectF* rect) const
  507.     {
  508.         return SetStatus(DllExports::GdipGetLineRect((GpLineGradient*)nativeBrush, rect));
  509.     }
  510.     // integer version
  511.     Status GetRectangle(OUT Rect* rect) const
  512.     {
  513.         return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect));
  514.     }
  515.     // Gamma correction in interporlation.
  516.     Status SetGammaCorrection(IN BOOL useGammaCorrection)
  517.     {
  518.         return SetStatus(DllExports::GdipSetLineGammaCorrection((GpLineGradient*)nativeBrush,
  519.                     useGammaCorrection));
  520.     }
  521.     
  522.     BOOL GetGammaCorrection() const
  523.     {
  524.         BOOL useGammaCorrection;
  525.         SetStatus(DllExports::GdipGetLineGammaCorrection((GpLineGradient*)nativeBrush,
  526.                     &useGammaCorrection));
  527.         return useGammaCorrection;
  528.     }
  529.     INT GetBlendCount() const
  530.     {
  531.         INT count = 0;
  532.         SetStatus(DllExports::GdipGetLineBlendCount((GpLineGradient*)
  533.                                                     nativeBrush,
  534.                                                     &count));
  535.         return count;
  536.     }
  537.     Status SetBlend(IN const REAL* blendFactors, 
  538.                     IN const REAL* blendPositions,
  539.                     IN INT count)
  540.     {
  541.         return SetStatus(DllExports::GdipSetLineBlend((GpLineGradient*)
  542.                                                       nativeBrush,
  543.                                                       blendFactors,
  544.                                                       blendPositions,
  545.                                                       count));
  546.     }
  547.     Status GetBlend(OUT REAL* blendFactors, 
  548.                     OUT REAL* blendPositions, 
  549.                     IN INT count) const 
  550.     {
  551.         return SetStatus(DllExports::GdipGetLineBlend((GpLineGradient*)nativeBrush,
  552.                                                       blendFactors,
  553.                                                       blendPositions,
  554.                                                       count));
  555.     }
  556.     INT GetInterpolationColorCount() const
  557.     {
  558.         INT count = 0;
  559.         SetStatus(DllExports::GdipGetLinePresetBlendCount((GpLineGradient*)
  560.                                                           nativeBrush,
  561.                                                           &count));
  562.         return count;
  563.     }
  564.     Status SetInterpolationColors(IN const Color* presetColors,
  565.                                   IN const REAL* blendPositions, 
  566.                                   IN INT count)
  567.     {
  568.         if ((count <= 0) || !presetColors)
  569.             return SetStatus(InvalidParameter);
  570.          
  571.         ARGB *argbs = (ARGB*) new BYTE[count*sizeof(ARGB)];
  572.         
  573.         if (argbs)
  574.         {
  575.             for (INT i = 0; i < count; i++)
  576.             {
  577.                 argbs[i] = presetColors[i].GetValue();
  578.             }
  579.             Status status = SetStatus(DllExports::GdipSetLinePresetBlend(
  580.                                                                         (GpLineGradient*) nativeBrush,
  581.                                                                         argbs,
  582.                                                                         blendPositions,
  583.                                                                         count));
  584.             delete [] argbs;
  585.             return status;
  586.         }
  587.         else
  588.         {
  589.             return SetStatus(OutOfMemory);
  590.         }
  591.     }
  592.     Status GetInterpolationColors(OUT Color* presetColors, 
  593.                                   OUT REAL* blendPositions, 
  594.                                   IN INT count) const 
  595.     {
  596.         if ((count <= 0) || !presetColors)
  597.             return SetStatus(InvalidParameter);
  598.         ARGB* argbs = (ARGB*) new BYTE[count*sizeof(ARGB)];
  599.         
  600.         if (!argbs)
  601.         {
  602.             return SetStatus(OutOfMemory);
  603.         }
  604.         Status status = SetStatus(DllExports::GdipGetLinePresetBlend((GpLineGradient*)nativeBrush,
  605.                                                                      argbs,
  606.                                                                      blendPositions,
  607.                                                                      count));
  608.         if (status == Ok) 
  609.         {
  610.             for (INT i = 0; i < count; i++)
  611.             { 
  612.                 presetColors[i] = Color(argbs[i]);
  613.             }
  614.         }
  615.         
  616.         delete [] argbs;
  617.         
  618.         return status;
  619.     }
  620.     Status SetBlendBellShape(IN REAL focus, 
  621.                              IN REAL scale = 1.0)
  622.     {
  623.         return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale));
  624.     }
  625.     #ifdef DCR_USE_NEW_145135
  626.     Status SetBlendTriangularShape(
  627.         IN REAL focus,
  628.         IN REAL scale = 1.0
  629.     )
  630.     #else
  631.     Status SetBlendTrianglarShape(IN REAL focus,
  632.                                   IN REAL scale = 1.0)
  633.     #endif                              
  634.     {
  635.         return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale));
  636.     }
  637.     /**
  638.      * Set/get brush transform
  639.      */
  640.     Status SetTransform(IN const Matrix* matrix)
  641.     {
  642.         return SetStatus(DllExports::GdipSetLineTransform((GpLineGradient*)nativeBrush, 
  643.                                                           matrix->nativeMatrix));
  644.     }
  645.     Status GetTransform(OUT Matrix *matrix) const
  646.     {
  647.         return SetStatus(DllExports::GdipGetLineTransform((GpLineGradient*)nativeBrush, 
  648.                                                           matrix->nativeMatrix));
  649.     }
  650.     Status ResetTransform()
  651.     {
  652.         return SetStatus(DllExports::GdipResetLineTransform((GpLineGradient*)nativeBrush));
  653.     }
  654.     Status MultiplyTransform(IN const Matrix* matrix,
  655.                              IN MatrixOrder order = MatrixOrderPrepend)
  656.     {
  657.         return SetStatus(DllExports::GdipMultiplyLineTransform((GpLineGradient*)nativeBrush,
  658.                                                                 matrix->nativeMatrix,
  659.                                                                 order));
  660.     }
  661.     Status TranslateTransform(IN REAL dx, 
  662.                               IN REAL dy,
  663.                               IN MatrixOrder order = MatrixOrderPrepend)
  664.     {
  665.         return SetStatus(DllExports::GdipTranslateLineTransform((GpLineGradient*)nativeBrush,
  666.                                                                dx, dy, order));
  667.     }
  668.     Status ScaleTransform(IN REAL sx, 
  669.                           IN REAL sy,
  670.                           IN MatrixOrder order = MatrixOrderPrepend)
  671.     {
  672.         return SetStatus(DllExports::GdipScaleLineTransform((GpLineGradient*)nativeBrush,
  673.                                                              sx, sy, order));
  674.     }
  675.     Status RotateTransform(IN REAL angle, 
  676.                            IN MatrixOrder order = MatrixOrderPrepend)
  677.     {
  678.         return SetStatus(DllExports::GdipRotateLineTransform((GpLineGradient*)nativeBrush,
  679.                                                               angle, order));
  680.     }
  681.     /**
  682.      * Set/get brush wrapping mode
  683.      */
  684.     Status SetWrapMode(IN WrapMode wrapMode)
  685.     {
  686.         return SetStatus(DllExports::GdipSetLineWrapMode((GpLineGradient*)nativeBrush, 
  687.                                                          wrapMode));
  688.     }
  689.     WrapMode GetWrapMode() const
  690.     {
  691.         WrapMode wrapMode;
  692.         SetStatus(DllExports::GdipGetLineWrapMode((GpLineGradient*)
  693.                                                   nativeBrush, 
  694.                                                   &wrapMode));
  695.         return wrapMode;
  696.     }
  697. #ifdef DCR_USE_NEW_250932
  698. private:
  699.     LinearGradientBrush(const LinearGradientBrush &);
  700.     LinearGradientBrush& operator=(const LinearGradientBrush &);
  701. #endif
  702. protected:
  703.     LinearGradientBrush()
  704.     {
  705.     }
  706. };
  707. //--------------------------------------------------------------------------
  708. // PathGradientBrush object is defined
  709. // in gdipluspath.h.
  710. //--------------------------------------------------------------------------
  711. //--------------------------------------------------------------------------
  712. // Represent hatch brush object
  713. //--------------------------------------------------------------------------
  714. class HatchBrush : public Brush
  715. {
  716. public:
  717.     friend class Pen;
  718.     // Constructors
  719.     HatchBrush(IN HatchStyle hatchStyle, 
  720.                IN const Color& foreColor,
  721.                IN const Color& backColor = Color())
  722.     {
  723.         GpHatch *brush = NULL;
  724.         lastResult = DllExports::GdipCreateHatchBrush(hatchStyle, 
  725.                                                       foreColor.GetValue(), 
  726.                                                       backColor.GetValue(),
  727.                                                       &brush);
  728.         SetNativeBrush(brush);
  729.     }
  730.     HatchStyle GetHatchStyle() const
  731.     {
  732.         HatchStyle hatchStyle;
  733.         SetStatus(DllExports::GdipGetHatchStyle((GpHatch*)nativeBrush, 
  734.                                                 &hatchStyle));
  735.         return hatchStyle;
  736.     }
  737.     
  738.     Status GetForegroundColor(OUT Color* color) const
  739.     {
  740.         ARGB argb;
  741.         if (color == NULL) 
  742.         {
  743.             return SetStatus(InvalidParameter);
  744.         }
  745.         
  746.         Status status = SetStatus(DllExports::GdipGetHatchForegroundColor(
  747.                                                         (GpHatch*)nativeBrush, 
  748.                                                         &argb));
  749.         color->SetValue(argb);
  750.         return status;
  751.     }
  752.     Status GetBackgroundColor(OUT Color *color) const
  753.     {
  754.         ARGB argb;
  755.         
  756.         if (color == NULL) 
  757.         {
  758.             return SetStatus(InvalidParameter);
  759.         }
  760.         Status status = SetStatus(DllExports::GdipGetHatchBackgroundColor(
  761.                                                         (GpHatch*)nativeBrush,
  762.                                                         &argb));
  763.         color->SetValue(argb);
  764.         
  765.         return status;
  766.     }
  767. #ifdef DCR_USE_NEW_250932
  768. private:
  769.     HatchBrush(const HatchBrush &);
  770.     HatchBrush& operator=(const HatchBrush &);
  771. #endif
  772. protected:
  773.     HatchBrush()
  774.     {
  775.     }
  776. };
  777. #endif