1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salgdi.cxx,v $
10 * $Revision: 1.8.6.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #define _SV_SALGDI_CXX
35 #include <tools/debug.hxx>
36 #include <saldata.hxx>
38 #include <tools/debug.hxx>
40 #include <tools/poly.hxx>
41 #ifndef _RTL_STRINGBUF_HXX
42 #include <rtl/strbuf.hxx>
54 // ClipRegions funktionieren immer noch nicht auf allen getesteten Druckern
55 #define SAL_PRINTER_CLIPPATH 1
56 // #define SAL_PRINTER_POLYPATH 1
58 // =======================================================================
64 // -----------------------------------------------------------------------
68 SalData
* pSalData
= GetSalData();
71 SalIcon
* pIcon
= pSalData
->mpFirstIcon
;
74 SalIcon
* pTmp
= pIcon
->pNext
;
75 WinDestroyPointer( pIcon
->hIcon
);
82 // =======================================================================
84 void ImplSalInitGraphics( Os2SalGraphics
* pData
)
86 GpiCreateLogColorTable( pData
->mhPS
, LCOL_RESET
, LCOLF_RGB
, 0, 0, NULL
);
89 // -----------------------------------------------------------------------
91 void ImplSalDeInitGraphics( Os2SalGraphics
* pData
)
95 // =======================================================================
97 Os2SalGraphics::Os2SalGraphics()
99 for( int i
= 0; i
< MAX_FALLBACK
; ++i
)
102 mpOs2FontData
[ i
] = NULL
;
103 mpOs2FontEntry
[ i
] = NULL
;
113 mnFontMetricCount
= 0;
114 mpFontMetrics
= NULL
;
115 mpClipRectlAry
= NULL
;
118 mpFontKernPairs
= NULL
;
119 mnFontKernPairCount
= 0;
120 mbFontKernInit
= FALSE
;
124 // -----------------------------------------------------------------------
126 Os2SalGraphics::~Os2SalGraphics()
128 Ft2DeleteSetId( mhPS
, LCID_BASE
);
131 delete mpFontMetrics
;
133 if ( mpFontKernPairs
)
134 delete mpFontKernPairs
;
138 // -----------------------------------------------------------------------
140 static SalColor
ImplGetROPSalColor( SalROPColor nROPColor
)
147 nSalColor
= MAKE_SALCOLOR( 0, 0, 0 );
152 nSalColor
= MAKE_SALCOLOR( 255, 255, 255 );
159 // -----------------------------------------------------------------------
161 void Os2SalGraphics::GetResolution( long& rDPIX
, long& rDPIY
)
163 // since OOo asks for DPI, I will query FONT_RES, which seems to be
164 // more correct than _RESOLUTION fields (on my wide screen lcd)
165 // and does not require conversion
166 DevQueryCaps( mhDC
, CAPS_HORIZONTAL_FONT_RES
, 1, &rDPIX
);
167 DevQueryCaps( mhDC
, CAPS_VERTICAL_FONT_RES
, 1, &rDPIY
);
170 // -----------------------------------------------------------------------
172 USHORT
Os2SalGraphics::GetBitCount()
175 DevQueryCaps( mhDC
, CAPS_COLOR_BITCOUNT
, 1, &nBitCount
);
176 return (USHORT
)nBitCount
;
179 // -----------------------------------------------------------------------
181 long Os2SalGraphics::GetGraphicsWidth() const
185 Os2SalFrame
* pFrame
= (Os2SalFrame
*)GetWindowPtr( mhWnd
);
188 if( pFrame
->maGeometry
.nWidth
)
189 return pFrame
->maGeometry
.nWidth
;
192 // TODO: perhaps not needed, maGeometry should always be up-to-date
194 WinQueryWindowRect( mhWnd
, &aRect
);
203 // -----------------------------------------------------------------------
205 void Os2SalGraphics::ResetClipRegion()
207 #ifdef SAL_PRINTER_CLIPPATH
209 GpiSetClipPath( mhPS
, 0, SCP_RESET
);
215 GpiSetClipRegion( mhPS
, NULL
, &hOldRegion
);
217 GpiDestroyRegion( mhPS
, hOldRegion
);
221 // -----------------------------------------------------------------------
223 void Os2SalGraphics::BeginSetClipRegion( ULONG nCount
)
225 mpClipRectlAry
= new RECTL
[ nCount
];
226 mnClipElementCount
= 0;
229 // -----------------------------------------------------------------------
231 BOOL
Os2SalGraphics::unionClipRegion( long nX
, long nY
, long nWidth
, long nHeight
)
233 RECTL
* pClipRect
= &mpClipRectlAry
[ mnClipElementCount
];
234 pClipRect
->xLeft
= nX
;
235 pClipRect
->yTop
= mnHeight
- nY
;
236 pClipRect
->xRight
= nX
+ nWidth
;
237 pClipRect
->yBottom
= mnHeight
- (nY
+ nHeight
);
238 mnClipElementCount
++;
243 // -----------------------------------------------------------------------
245 bool Os2SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon
& )
247 // TODO: implement and advertise OutDevSupport_B2DClip support
251 // -----------------------------------------------------------------------
253 void Os2SalGraphics::EndSetClipRegion()
255 #ifdef SAL_PRINTER_CLIPPATH
258 GpiSetClipPath( mhPS
, 0, SCP_RESET
);
259 GpiBeginPath( mhPS
, 1L );
261 for( int i
= 0; i
< mnClipElementCount
; i
++ )
264 RECTL
* pClipRect
= &mpClipRectlAry
[ i
];
266 aPt
.x
= pClipRect
->xLeft
;
267 aPt
.y
= pClipRect
->yTop
-1;
268 Ft2Move( mhPS
, &aPt
);
270 aPt
.x
= pClipRect
->xRight
-1;
271 aPt
.y
= pClipRect
->yBottom
;
273 Ft2Box( mhPS
, DRO_OUTLINE
, &aPt
, 0, 0 );
277 GpiSetClipPath( mhPS
, 1L, SCP_ALTERNATE
| SCP_AND
);
282 HRGN hClipRegion
= GpiCreateRegion( mhPS
,
287 GpiSetClipRegion( mhPS
, hClipRegion
, &hOldRegion
);
289 GpiDestroyRegion( mhPS
, hOldRegion
);
292 delete [] mpClipRectlAry
;
295 // -----------------------------------------------------------------------
297 void Os2SalGraphics::SetLineColor()
303 // -----------------------------------------------------------------------
305 void Os2SalGraphics::SetLineColor( SalColor nSalColor
)
310 lb
.lColor
= RGBCOLOR( SALCOLOR_RED( nSalColor
),
311 SALCOLOR_GREEN( nSalColor
),
312 SALCOLOR_BLUE( nSalColor
) );
324 // -----------------------------------------------------------------------
326 void Os2SalGraphics::SetFillColor()
332 // -----------------------------------------------------------------------
334 void Os2SalGraphics::SetFillColor( SalColor nSalColor
)
339 ab
.lColor
= RGBCOLOR( SALCOLOR_RED( nSalColor
),
340 SALCOLOR_GREEN( nSalColor
),
341 SALCOLOR_BLUE( nSalColor
) );
353 // -----------------------------------------------------------------------
355 void Os2SalGraphics::SetXORMode( bool bSet
, bool )
358 LONG nMixMode
= bSet
? FM_XOR
: FM_OVERPAINT
;
360 // set mix mode for lines
362 lb
.usMixMode
= nMixMode
;
369 // set mix mode for areas
371 ab
.usMixMode
= nMixMode
;
378 // set mix mode for text
380 cb
.usMixMode
= nMixMode
;
388 // -----------------------------------------------------------------------
390 void Os2SalGraphics::SetROPLineColor( SalROPColor nROPColor
)
392 SetLineColor( ImplGetROPSalColor( nROPColor
) );
395 // -----------------------------------------------------------------------
397 void Os2SalGraphics::SetROPFillColor( SalROPColor nROPColor
)
399 SetFillColor( ImplGetROPSalColor( nROPColor
) );
402 // -----------------------------------------------------------------------
404 void Os2SalGraphics::drawPixel( long nX
, long nY
)
412 Ft2SetPel( mhPS
, &aPt
);
415 // -----------------------------------------------------------------------
417 void Os2SalGraphics::drawPixel( long nX
, long nY
, SalColor nSalColor
)
428 lb
.lColor
= RGBCOLOR( SALCOLOR_RED( nSalColor
),
429 SALCOLOR_GREEN( nSalColor
),
430 SALCOLOR_BLUE( nSalColor
) );
437 // set color of pixel
441 Ft2SetPel( mhPS
, &aPt
);
451 // -----------------------------------------------------------------------
453 void Os2SalGraphics::drawLine( long nX1
, long nY1
, long nX2
, long nY2
)
455 // OS2 zeichnet den Endpunkt mit
459 Ft2Move( mhPS
, &aPt
);
462 GpiLine( mhPS
, &aPt
);
465 // -----------------------------------------------------------------------
467 void Os2SalGraphics::drawRect( long nX
, long nY
, long nWidth
, long nHeight
)
475 lControl
= DRO_OUTLINEFILL
;
482 lControl
= DRO_OUTLINE
;
489 Ft2Move( mhPS
, &aPt
);
490 aPt
.x
= nX
+ nWidth
- 1;
491 aPt
.y
= TY( nY
+ nHeight
- 1 );
492 Ft2Box( mhPS
, lControl
, &aPt
, 0, 0 );
495 // -----------------------------------------------------------------------
497 void Os2SalGraphics::drawPolyLine( ULONG nPoints
, const SalPoint
* pPtAry
)
499 // convert all points to sys orientation
500 POINTL
* pOS2PtAry
= new POINTL
[ nPoints
];
501 POINTL
* pTempOS2PtAry
= pOS2PtAry
;
502 const SalPoint
* pTempPtAry
= pPtAry
;
503 ULONG nTempPoints
= nPoints
;
504 long nHeight
= mnHeight
- 1;
506 while( nTempPoints
-- )
508 (*pTempOS2PtAry
).x
= (*pTempPtAry
).mnX
;
509 (*pTempOS2PtAry
).y
= nHeight
- (*pTempPtAry
).mnY
;
514 Ft2Move( mhPS
, pOS2PtAry
);
515 GpiPolyLine( mhPS
, nPoints
, pOS2PtAry
);
519 // -----------------------------------------------------------------------
521 void Os2SalGraphics::drawPolygon( ULONG nPoints
, const SalPoint
* pPtAry
)
526 aPolygon
.aPointl
= new POINTL
[ nPoints
];
527 aPolygon
.ulPoints
= nPoints
;
529 // convert all points to sys orientation
530 POINTL
* pTempOS2PtAry
= aPolygon
.aPointl
;
531 const SalPoint
* pTempPtAry
= pPtAry
;
532 ULONG nTempPoints
= nPoints
;
533 long nHeight
= mnHeight
- 1;
535 while( nTempPoints
-- )
537 (*pTempOS2PtAry
).x
= (*pTempPtAry
).mnX
;
538 (*pTempOS2PtAry
).y
= nHeight
- (*pTempPtAry
).mnY
;
543 // Innenleben zeichnen
546 #ifdef SAL_PRINTER_POLYPATH
549 Ft2BeginPath( mhPS
, 1 );
550 Ft2Move( mhPS
, aPolygon
.aPointl
);
551 Ft2PolyLine( mhPS
, aPolygon
.ulPoints
, aPolygon
.aPointl
);
553 Ft2FillPath( mhPS
, 1, 0 );
557 Ft2Move( mhPS
, aPolygon
.aPointl
);
558 Ft2PolyLine( mhPS
, aPolygon
.ulPoints
, aPolygon
.aPointl
);
564 ULONG nOptions
= POLYGON_ALTERNATE
;
567 nOptions
|= POLYGON_BOUNDARY
;
569 nOptions
|= POLYGON_NOBOUNDARY
;
571 Ft2Move( mhPS
, aPolygon
.aPointl
);
572 GpiPolygons( mhPS
, 1, &aPolygon
, nOptions
, POLYGON_EXCL
);
579 Ft2Move( mhPS
, aPolygon
.aPointl
);
580 GpiPolyLine( mhPS
, nPoints
, aPolygon
.aPointl
);
584 delete [] aPolygon
.aPointl
;
587 // -----------------------------------------------------------------------
589 void Os2SalGraphics::drawPolyPolygon( ULONG nPoly
, const ULONG
* pPoints
,
590 PCONSTSALPOINT
* pPtAry
)
593 long nHeight
= mnHeight
- 1;
594 PM_POLYGON
* aPolygonAry
= new PM_POLYGON
[ nPoly
];
596 for( i
= 0; i
< nPoly
; i
++ )
598 const SalPoint
* pTempPtAry
= (const SalPoint
*)pPtAry
[ i
];
601 ULONG nTempPoints
= pPoints
[ i
];
602 POINTL
* pTempOS2PtAry
= new POINTL
[ nTempPoints
];
604 // convert all points to sys orientation
605 aPolygonAry
[ i
].ulPoints
= nTempPoints
;
606 aPolygonAry
[ i
].aPointl
= pTempOS2PtAry
;
608 while( nTempPoints
-- )
610 (*pTempOS2PtAry
).x
= (*pTempPtAry
).mnX
;
611 (*pTempOS2PtAry
).y
= nHeight
- (*pTempPtAry
).mnY
;
617 // Innenleben zeichnen
620 #ifdef SAL_PRINTER_POLYPATH
623 Ft2BeginPath( mhPS
, 1 );
624 for ( i
= 0; i
< nPoly
; i
++ )
626 Ft2Move( mhPS
, aPolygonAry
[i
].aPointl
);
627 Ft2PolyLine( mhPS
, aPolygonAry
[i
].ulPoints
, aPolygonAry
[i
].aPointl
);
630 Ft2FillPath( mhPS
, 1, 0 );
635 ULONG nOptions
= POLYGON_ALTERNATE
;
638 nOptions
|= POLYGON_BOUNDARY
;
640 nOptions
|= POLYGON_NOBOUNDARY
;
642 Ft2Move( mhPS
, aPolygonAry
[ 0 ].aPointl
);
643 GpiPolygons( mhPS
, nPoly
, aPolygonAry
, nOptions
, POLYGON_EXCL
);
650 for( i
= 0; i
< nPoly
; i
++ )
652 Ft2Move( mhPS
, aPolygonAry
[ i
].aPointl
);
653 GpiPolyLine( mhPS
, aPolygonAry
[ i
].ulPoints
, aPolygonAry
[ i
].aPointl
);
659 for( i
= 0; i
< nPoly
; i
++ )
660 delete [] aPolygonAry
[ i
].aPointl
;
661 delete [] aPolygonAry
;
664 // -----------------------------------------------------------------------
666 bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon
&, double /*fTransparency*/ )
668 // TODO: implement and advertise OutDevSupport_B2DDraw support
672 // -----------------------------------------------------------------------
674 bool Os2SalGraphics::drawPolyLine(
675 const basegfx::B2DPolygon
& /*rPolygon*/,
676 const basegfx::B2DVector
& /*rLineWidths*/,
677 basegfx::B2DLineJoin
/*eLineJoin*/)
683 // -----------------------------------------------------------------------
685 sal_Bool
Os2SalGraphics::drawPolyLineBezier( ULONG nPoints
, const SalPoint
* pPtAry
, const BYTE
* pFlgAry
)
690 // -----------------------------------------------------------------------
692 sal_Bool
Os2SalGraphics::drawPolygonBezier( ULONG nPoints
, const SalPoint
* pPtAry
, const BYTE
* pFlgAry
)
697 // -----------------------------------------------------------------------
699 sal_Bool
Os2SalGraphics::drawPolyPolygonBezier( ULONG nPoly
, const ULONG
* pPoints
,
700 const SalPoint
* const* pPtAry
, const BYTE
* const* pFlgAry
)
705 // =======================================================================
707 // MAXIMUM BUFSIZE EQ 0xFFFF
708 #define POSTSCRIPT_BUFSIZE 0x4000
709 // we only try to get the BoundingBox in the first 4096 bytes
710 #define POSTSCRIPT_BOUNDINGSEARCH 0x1000
712 static BYTE
* ImplSearchEntry( BYTE
* pSource
, BYTE
* pDest
, ULONG nComp
, ULONG nSize
)
714 while ( nComp
-- >= nSize
)
717 for ( i
= 0; i
< nSize
; i
++ )
719 if ( ( pSource
[i
]&~0x20 ) != ( pDest
[i
]&~0x20 ) )
730 static BOOL
ImplGetBoundingBox( double* nNumb
, BYTE
* pSource
, ULONG nSize
)
732 BOOL bRetValue
= FALSE
;
733 BYTE
* pDest
= ImplSearchEntry( pSource
, (BYTE
*)"%%BoundingBox:", nSize
, 14 );
736 nNumb
[0] = nNumb
[1] = nNumb
[2] = nNumb
[3] = 0;
739 int nSizeLeft
= nSize
- ( pDest
- pSource
);
740 if ( nSizeLeft
> 100 )
741 nSizeLeft
= 100; // only 100 bytes following the bounding box will be checked
744 for ( i
= 0; ( i
< 4 ) && nSizeLeft
; i
++ )
747 BOOL bDivision
= FALSE
;
748 BOOL bNegative
= FALSE
;
751 while ( ( --nSizeLeft
) && ( *pDest
== ' ' ) || ( *pDest
== 0x9 ) ) pDest
++;
753 while ( nSizeLeft
&& ( nByte
!= ' ' ) && ( nByte
!= 0x9 ) && ( nByte
!= 0xd ) && ( nByte
!= 0xa ) )
767 if ( ( nByte
< '0' ) || ( nByte
> '9' ) )
768 nSizeLeft
= 1; // error parsing the bounding box values
774 nNumb
[i
] += nByte
- '0';
782 nNumb
[i
] = -nNumb
[i
];
783 if ( bDivision
&& ( nDivision
!= 1 ) )
784 nNumb
[i
] /= nDivision
;
793 static void ImplWriteDouble( BYTE
** pBuf
, double nNumber
)
795 // *pBuf += sprintf( (char*)*pBuf, "%f", nNumber );
799 *(*pBuf
)++ = (BYTE
)'-';
802 ULONG nTemp
= (ULONG
)nNumber
;
803 const String
aNumber1( nTemp
);
804 ULONG nLen
= aNumber1
.Len();
806 for ( USHORT n
= 0; n
< nLen
; n
++ )
807 *(*pBuf
)++ = aNumber1
[ n
];
809 nTemp
= (ULONG
)( ( nNumber
- nTemp
) * 100000 );
812 *(*pBuf
)++ = (BYTE
)'.';
813 const String
aNumber2( nTemp
);
815 ULONG nLen
= aNumber2
.Len();
818 for ( n
= 0; n
< ( 5 - nLen
); n
++ )
820 *(*pBuf
)++ = (BYTE
)'0';
823 for ( USHORT n
= 0; n
< nLen
; n
++ )
825 *(*pBuf
)++ = aNumber2
[ n
];
832 inline void ImplWriteString( BYTE
** pBuf
, const char* sString
)
834 strcpy( (char*)*pBuf
, sString
);
835 *pBuf
+= strlen( sString
);
838 BOOL
Os2SalGraphics::drawEPS( long nX
, long nY
, long nWidth
, long nHeight
, void* pPtr
, ULONG nSize
)
845 if ( !(DevQueryCaps( mhDC
, CAPS_TECHNOLOGY
, 1, &nLong
) &&
846 (CAPS_TECH_POSTSCRIPT
== nLong
)) )
849 BYTE
* pBuf
= new BYTE
[ POSTSCRIPT_BUFSIZE
];
850 double nBoundingBox
[4];
852 if ( pBuf
&& ImplGetBoundingBox( nBoundingBox
, (BYTE
*)pPtr
, nSize
) )
854 LONG pOS2DXAry
[4]; // hack -> print always 2 white space
858 PCH pStr
= (PCH
) " ";
859 for( long i
= 0; i
< 4; i
++ )
861 Ft2CharStringPosAt( mhPS
, &aPt
, NULL
, 0, 2, (PCH
)pStr
,(PLONG
)&pOS2DXAry
[0] );
863 OStringBuffer
aBuf( POSTSCRIPT_BUFSIZE
);
865 // reserve place for a USHORT
868 // #107797# Write out EPS encapsulation header
869 // ----------------------------------------------------------------------------------
871 // directly taken from the PLRM 3.0, p. 726. Note:
872 // this will definitely cause problems when
873 // recursively creating and embedding PostScript files
874 // in OOo, since we use statically-named variables
875 // here (namely, b4_Inc_state_salWin, dict_count_salWin and
876 // op_count_salWin). Currently, I have no idea on how to
877 // work around that, except from scanning and
878 // interpreting the EPS for unused identifiers.
880 // append the real text
881 aBuf
.append( "\n\n/b4_Inc_state_salWin save def\n"
882 "/dict_count_salWin countdictstack def\n"
883 "/op_count_salWin count 1 sub def\n"
886 "0 setgray 0 setlinecap\n"
887 "1 setlinewidth 0 setlinejoin\n"
888 "10 setmiterlimit [] 0 setdash newpath\n"
889 "/languagelevel where\n"
891 " pop languagelevel\n"
894 " false setstrokeadjust false setoverprint\n"
899 // #i10737# Apply clipping manually
900 // ----------------------------------------------------------------------------------
902 // Windows seems to ignore any clipping at the HDC,
903 // when followed by a POSTSCRIPT_PASSTHROUGH
905 // Check whether we've got a clipping, consisting of
906 // exactly one rect (other cases should be, but aren't
907 // handled currently)
909 // TODO: Handle more than one rectangle here (take
910 // care, the buffer can handle only POSTSCRIPT_BUFSIZE
912 if ( mhRegion
!= 0 &&
913 mpStdClipRgnData
!= NULL
&&
914 mpClipRgnData
== mpStdClipRgnData
&&
915 mpClipRgnData
->rdh
.nCount
== 1 )
917 RECT
* pRect
= &(mpClipRgnData
->rdh
.rcBound
);
919 aBuf
.append( "\nnewpath\n" );
920 aBuf
.append( pRect
->left
);
922 aBuf
.append( pRect
->top
);
923 aBuf
.append( " moveto\n" );
924 aBuf
.append( pRect
->right
);
926 aBuf
.append( pRect
->top
);
927 aBuf
.append( " lineto\n" );
928 aBuf
.append( pRect
->right
);
930 aBuf
.append( pRect
->bottom
);
931 aBuf
.append( " lineto\n" );
932 aBuf
.append( pRect
->left
);
934 aBuf
.append( pRect
->bottom
);
935 aBuf
.append( " lineto\n"
942 // #107797# Write out buffer
943 // ----------------------------------------------------------------------------------
944 *((USHORT
*)aBuf
.getStr()) = (USHORT
)( aBuf
.getLength() - 2 );
945 //Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
946 DevEscape( mhDC
, DEVESC_RAWDATA
, aBuf
.getLength(),
947 (PBYTE
)aBuf
.getStr(), 0, NULL
);
949 double dM11
= nWidth
/ ( nBoundingBox
[2] - nBoundingBox
[0] );
950 double dM22
= - ( nHeight
/ (nBoundingBox
[1] - nBoundingBox
[3] ) );
952 // reserve a USHORT again
954 aBuf
.append( "\n\n[" );
956 aBuf
.append( " 0 0 " );
959 aBuf
.append( nX
- ( dM11
* nBoundingBox
[0] ) );
961 aBuf
.append( nY
- ( dM22
* nBoundingBox
[3] ) );
962 aBuf
.append( "] concat\n"
963 "%%BeginDocument:\n" );
964 *((USHORT
*)aBuf
.getStr()) = (USHORT
)( aBuf
.getLength() - 2 );
965 DevEscape( mhDC
, DEVESC_RAWDATA
, aBuf
.getLength(),
966 (PBYTE
)aBuf
.getStr(), 0, NULL
);
969 ImplWriteString( &pTemp
, "save\n[ " );
970 ImplWriteDouble( &pTemp
, dM11
);
971 ImplWriteDouble( &pTemp
, 0 );
972 ImplWriteDouble( &pTemp
, 0 );
973 ImplWriteDouble( &pTemp
, dM22
);
974 ImplWriteDouble( &pTemp
, nX
- ( dM11
* nBoundingBox
[0] ) );
975 ImplWriteDouble( &pTemp
, mnHeight
- nY
- ( dM22
* nBoundingBox
[3] ) );
976 ImplWriteString( &pTemp
, "] concat /showpage {} def\n" );
978 if ( DevEscape( mhDC
, DEVESC_RAWDATA
, pTemp
- pBuf
,
979 (PBYTE
)pBuf
, 0, NULL
) == DEV_OK
)
982 UINT32 nToDo
= nSize
;
985 while( nToDo
&& bRet
)
988 if ( nToDo
< nDoNow
)
991 if ( DevEscape( mhDC
, DEVESC_RAWDATA
, nDoNow
, (PBYTE
)pPtr
+ nSize
- nToDo
,
999 strcpy ( (char*)pBuf
, "\nrestore\n" );
1000 if ( DevEscape( mhDC
, DEVESC_RAWDATA
, 9, (PBYTE
)pBuf
,
1001 0, NULL
) == DEV_OK
) bRet
= TRUE
;
1004 // #107797# Write out EPS encapsulation footer
1005 // ----------------------------------------------------------------------------------
1006 // reserve a USHORT again
1007 aBuf
.setLength( 2 );
1008 aBuf
.append( "%%EndDocument\n"
1009 "count op_count_salWin sub {pop} repeat\n"
1010 "countdictstack dict_count_salWin sub {end} repeat\n"
1011 "b4_Inc_state_salWin restore\n\n" );
1012 *((USHORT
*)aBuf
.getStr()) = (USHORT
)( aBuf
.getLength() - 2 );
1013 DevEscape( mhDC
, DEVESC_RAWDATA
, aBuf
.getLength(),
1014 (PBYTE
)aBuf
.getStr(), 0, NULL
);
1024 * IsNativeControlSupported()
1026 * Returns TRUE if the platform supports native
1027 * drawing of the control defined by nPart
1029 BOOL
Os2SalGraphics::IsNativeControlSupported( ControlType nType
, ControlPart nPart
)
1034 // -----------------------------------------------------------------------
1036 SystemGraphicsData
Os2SalGraphics::GetGraphicsData() const
1038 SystemGraphicsData aRes
;
1039 aRes
.nSize
= sizeof(aRes
);
1046 // -----------------------------------------------------------------------