diff options
author | Babak Mahbod <bmahbod@openoffice.org> | 2000-11-16 18:53:30 +0000 |
---|---|---|
committer | Babak Mahbod <bmahbod@openoffice.org> | 2000-11-16 18:53:30 +0000 |
commit | 8ba50a7aba3d7609b42b6c862703dcae40787e22 (patch) | |
tree | b574a5bf51485abc69b66085ba2a5243a1baeb40 /vcl | |
parent | 816895c9d20ba258e106b68420b283a8387e614f (diff) |
Added implementation of several new drawing primitives.
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 107 | ||||
-rw-r--r-- | vcl/aqua/source/window/salframe.cxx | 69 |
2 files changed, 143 insertions, 33 deletions
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index c940a75a98b5..94e309e34792 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salgdi.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: pluby $ $Date: 2000-11-02 06:43:26 $ + * last change: $Author: bmahbod $ $Date: 2000-11-16 19:53:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,29 +189,102 @@ void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor ) // ----------------------------------------------------------------------- void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 ) -{ - VCLVIEW hView = maGraphicsData.mhDC; - if ( hView ) - VCLGraphics_drawLine( hView, nX1, nY1, nX2, nY2 ); -} - -// ----------------------------------------------------------------------- + { + VCLVIEW hView = maGraphicsData.mhDC; -void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight ) -{ -} + if ( hView ) + { + VCLGraphics_drawLine ( hView, + nX1, + nY1, + nX2, + nY2 + ); + } // if + } // SalGraphics::DrawLine // ----------------------------------------------------------------------- -void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry ) -{ -} +void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight ) + { + VCLVIEW hView = maGraphicsData.mhDC; + + if ( hView ) + { + VCLGraphics_drawRect ( hView, + nX, + nY, + nWidth, + nHeight + ); + } // if + } // SalGraphics::DrawRect + +// ----------------------------------------------------------------------- + +void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint *pPtAry ) + { + if ( nPoints > 1 ) + { + long i; + long pXPtsArray[nPoints]; + long pYPtsArray[nPoints]; + VCLVIEW hView = maGraphicsData.mhDC; + + for ( i = 0; i < nPoints; i++ ) + { + pXPtsArray[i] = pPtAry[i].mnX; + pYPtsArray[i] = pPtAry[i].mnY; + } // for + + if ( hView ) + { + VCLGraphics_drawPolyLine + ( + hView, + nPoints, + pXPtsArray, + pYPtsArray + ); + } // if + } // if + } // SalGraphics::DrawPolyLine // ----------------------------------------------------------------------- void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry ) -{ -} + { + // Temporary implementation until a proper method + // is determined to do a color polygon fill + + // This implementation is identical to that of + // method SalGraphics::DrawPolyLine + + if ( nPoints > 1 ) + { + long i; + long pXPtsArray[nPoints]; + long pYPtsArray[nPoints]; + VCLVIEW hView = maGraphicsData.mhDC; + + for ( i = 0; i < nPoints; i++ ) + { + pXPtsArray[i] = pPtAry[i].mnX; + pYPtsArray[i] = pPtAry[i].mnY; + } // for + + if ( hView ) + { + VCLGraphics_drawPolyLine + ( + hView, + nPoints, + pXPtsArray, + pYPtsArray + ); + } // if + } // if + } // SalGraphics::DrawPolygon // ----------------------------------------------------------------------- diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index c77ac26825e0..1399301fcd9a 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -2,9 +2,9 @@ * * $RCSfile: salframe.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: pluby $ $Date: 2000-11-16 06:41:23 $ + * last change: $Author: bmahbod $ $Date: 2000-11-16 19:53:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,24 +189,61 @@ void SalFrame::SetIcon( USHORT nIcon ) // ----------------------------------------------------------------------- void SalFrame::Show( BOOL bVisible ) -{ - if ( bVisible ) - VCLWindow_makeKeyAndOrderFront( maFrameData.mhWnd ); - else - VCLWindow_close( maFrameData.mhWnd ); + { + if ( bVisible ) + { + VCLWindow_makeKeyAndOrderFront( maFrameData.mhWnd ); + } // if + else + { + VCLWindow_close( maFrameData.mhWnd ); + } // else - // This is temporary code for testing only and should be removed when - // development of the SalObject class is complete. This code allows - // us to test our SalGraphics drawing methods. + // This is temporary code for testing only and should be removed + // when development of the SalObject class is complete. This code + // allows us to test our SalGraphics drawing methods. - // Get this window's cached handle to its native content view - VCLVIEW hView = VCLWindow_contentView( maFrameData.mhWnd ); + // Get this window's cached handle to its native content view - // Draw a line on the native content view + VCLVIEW hView = VCLWindow_contentView ( maFrameData.mhWnd ); - VCLGraphics_drawLine ( hView, 0L, 0L, 1000L, 1000L ); - VCLGraphics_drawRect ( hView, 75L, 75L, 150L, 150L ); -} + // Draw a line on the native content view + + VCLGraphics_drawLine ( hView, 15L, 15L, 150L, 150L ); + + // Draw a rectangle on the native content view + + VCLGraphics_drawRect ( hView, 200L, 15L, 100L, 150L ); + + // Draw a polygon on the native content view (no color) + + ULONG nPoints = 7; + long pXPtsAry[nPoints]; + long pYPtsAry[nPoints]; + + pXPtsAry[0] = 15; + pYPtsAry[0] = 250; + + pXPtsAry[1] = 145; + pYPtsAry[1] = 250; + + pXPtsAry[2] = 165; + pYPtsAry[2] = 200; + + pXPtsAry[3] = 185; + pYPtsAry[3] = 250; + + pXPtsAry[4] = 325; + pYPtsAry[4] = 250; + + pXPtsAry[5] = 215; + pYPtsAry[5] = 320; + + pXPtsAry[6] = 125; + pYPtsAry[6] = 320; + + VCLGraphics_drawPolyLine ( hView, nPoints, pXPtsAry, pYPtsAry ); + } // SalFrame::Show // ----------------------------------------------------------------------- |