LibreOffice Module vcl (master) 1
gdimtf.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <cstdlib>
21#include <memory>
22#include <sal/log.hxx>
23#include <osl/diagnose.h>
25#include <tools/helpers.hxx>
26#include <tools/stream.hxx>
27#include <tools/vcompat.hxx>
28#include <tools/fract.hxx>
29#include <vcl/BitmapPalette.hxx>
30#include <vcl/metaact.hxx>
31#include <vcl/outdev.hxx>
32#include <vcl/window.hxx>
33#include <vcl/virdev.hxx>
34#include <vcl/svapp.hxx>
35#include <vcl/gdimtf.hxx>
36#include <vcl/graphictools.hxx>
38#include <vcl/canvastools.hxx>
39#include <vcl/mtfxmldump.hxx>
40
42
43#include <com/sun/star/beans/XFastPropertySet.hpp>
44#include <com/sun/star/rendering/MtfRenderer.hpp>
45#include <com/sun/star/rendering/XBitmapCanvas.hpp>
46#include <com/sun/star/rendering/XCanvas.hpp>
48
49using namespace com::sun::star;
50
51namespace {
52
53struct ImplColAdjustParam
54{
55 std::unique_ptr<sal_uInt8[]> pMapR;
56 std::unique_ptr<sal_uInt8[]> pMapG;
57 std::unique_ptr<sal_uInt8[]> pMapB;
58};
59
60struct ImplBmpAdjustParam
61{
62 short nLuminancePercent;
63 short nContrastPercent;
64 short nChannelRPercent;
65 short nChannelGPercent;
66 short nChannelBPercent;
67 double fGamma;
68 bool bInvert;
69};
70
71struct ImplColConvertParam
72{
73 MtfConversion eConversion;
74};
75
76struct ImplBmpConvertParam
77{
78 BmpConversion eConversion;
79};
80
81struct ImplColMonoParam
82{
83 Color aColor;
84};
85
86struct ImplBmpMonoParam
87{
88 Color aColor;
89};
90
91struct ImplColReplaceParam
92{
93 std::unique_ptr<sal_uLong[]> pMinR;
94 std::unique_ptr<sal_uLong[]> pMaxR;
95 std::unique_ptr<sal_uLong[]> pMinG;
96 std::unique_ptr<sal_uLong[]> pMaxG;
97 std::unique_ptr<sal_uLong[]> pMinB;
98 std::unique_ptr<sal_uLong[]> pMaxB;
99 const Color * pDstCols;
101};
102
103struct ImplBmpReplaceParam
104{
105 const Color* pSrcCols;
106 const Color* pDstCols;
108};
109
110}
111
113 m_nCurrentActionElement( 0 ),
114 m_aPrefSize ( 1, 1 ),
115 m_pPrev ( nullptr ),
116 m_pNext ( nullptr ),
117 m_pOutDev ( nullptr ),
118 m_bPause ( false ),
119 m_bRecord ( false ),
120 m_bUseCanvas ( false ),
121 m_bSVG ( false )
122{
123}
124
126 m_nCurrentActionElement( rMtf.m_nCurrentActionElement ),
127 m_aPrefMapMode ( rMtf.m_aPrefMapMode ),
128 m_aPrefSize ( rMtf.m_aPrefSize ),
129 m_pPrev ( rMtf.m_pPrev ),
130 m_pNext ( rMtf.m_pNext ),
131 m_pOutDev ( nullptr ),
132 m_bPause ( false ),
133 m_bRecord ( false ),
134 m_bUseCanvas ( rMtf.m_bUseCanvas ),
135 m_bSVG ( rMtf.m_bSVG )
136{
137 for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i )
138 {
139 m_aList.push_back( rMtf.GetAction( i ) );
140 }
141
142 if( rMtf.m_bRecord )
143 {
144 Record( rMtf.m_pOutDev );
145
146 if ( rMtf.m_bPause )
147 Pause( true );
148 }
149}
150
152{
153 Clear();
154}
155
157{
158 MetaAction* pCurrAct;
159
160 // watch for transparent drawing actions
161 for(pCurrAct = const_cast<GDIMetaFile*>(this)->FirstAction();
162 pCurrAct;
163 pCurrAct = const_cast<GDIMetaFile*>(this)->NextAction())
164 {
165 // #i10613# determine if the action is transparency capable
166
167 // #107169# Also examine metafiles with masked bitmaps in
168 // detail. Further down, this is optimized in such a way
169 // that there's no unnecessary painting of masked bitmaps
170 // (which are _always_ subdivided into rectangular regions
171 // of uniform opacity): if a masked bitmap is printed over
172 // empty background, we convert to a plain bitmap with
173 // white background.
174 if (pCurrAct->IsTransparent())
175 return true;
176 }
177
178 return false;
179}
180
182{
183 return m_aList.size();
184}
185
186MetaAction* GDIMetaFile::GetAction( size_t nAction ) const
187{
188 return (nAction < m_aList.size()) ? m_aList[ nAction ].get() : nullptr;
189}
190
192{
194 return m_aList.empty() ? nullptr : m_aList[ 0 ].get();
195}
196
198{
199 return ( m_nCurrentActionElement + 1 < m_aList.size() ) ? m_aList[ ++m_nCurrentActionElement ].get() : nullptr;
200}
201
203{
204 if ( nAction >= m_aList.size() )
205 {
206 return;
207 }
208 //fdo#39995 This doesn't increment the incoming action ref-count nor does it
209 //decrement the outgoing action ref-count
210 std::swap(pAction, m_aList[nAction]);
211}
212
214{
215 if( this != &rMtf )
216 {
217 Clear();
218
219 // Increment RefCount of MetaActions
220 for( size_t i = 0, n = rMtf.GetActionSize(); i < n; ++i )
221 {
222 m_aList.push_back( rMtf.GetAction( i ) );
223 }
224
227 m_pPrev = rMtf.m_pPrev;
228 m_pNext = rMtf.m_pNext;
229 m_pOutDev = nullptr;
230 m_bPause = false;
231 m_bRecord = false;
233 m_bSVG = rMtf.m_bSVG;
234
235 if( rMtf.m_bRecord )
236 {
237 Record( rMtf.m_pOutDev );
238
239 if( rMtf.m_bPause )
240 Pause( true );
241 }
242 }
243
244 return *this;
245}
246
247bool GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const
248{
249 const size_t nObjCount = m_aList.size();
250 bool bRet = false;
251
252 if( this == &rMtf )
253 bRet = true;
254 else if( rMtf.GetActionSize() == nObjCount &&
255 rMtf.GetPrefSize() == m_aPrefSize &&
257 {
258 bRet = true;
259
260 for( size_t n = 0; n < nObjCount; n++ )
261 {
262 if( m_aList[ n ] != rMtf.GetAction( n ) )
263 {
264 bRet = false;
265 break;
266 }
267 }
268 }
269
270 return bRet;
271}
272
274{
275 if( m_bRecord )
276 Stop();
277
278 m_aList.clear();
279}
280
281void GDIMetaFile::Linker( OutputDevice* pOut, bool bLink )
282{
283 if( bLink )
284 {
285 m_pNext = nullptr;
286 m_pPrev = pOut->GetConnectMetaFile();
287 pOut->SetConnectMetaFile( this );
288
289 if( m_pPrev )
290 m_pPrev->m_pNext = this;
291 }
292 else
293 {
294 if( m_pNext )
295 {
297
298 if( m_pPrev )
300 }
301 else
302 {
303 if( m_pPrev )
304 m_pPrev->m_pNext = nullptr;
305
306 pOut->SetConnectMetaFile( m_pPrev );
307 }
308
309 m_pPrev = nullptr;
310 m_pNext = nullptr;
311 }
312}
313
315{
316 if( m_bRecord )
317 Stop();
318
319 m_nCurrentActionElement = m_aList.empty() ? 0 : (m_aList.size() - 1);
320 m_pOutDev = pOut;
321 m_bRecord = true;
322 Linker( pOut, true );
323}
324
326{
327 if (m_bRecord || rMtf.m_bRecord)
328 return;
329
330 MetaAction* pAction = GetCurAction();
331 const size_t nObjCount = m_aList.size();
332
333 rMtf.UseCanvas( rMtf.GetUseCanvas() || m_bUseCanvas );
334 rMtf.setSVG( rMtf.getSVG() || m_bSVG );
335
336 for( size_t nCurPos = m_nCurrentActionElement; nCurPos < nObjCount; nCurPos++ )
337 {
338 if( pAction )
339 {
340 rMtf.AddAction( pAction );
341 }
342
343 pAction = NextAction();
344 }
345}
346
347void GDIMetaFile::Play(OutputDevice& rOut, size_t nPos)
348{
349 if( m_bRecord )
350 return;
351
352 MetaAction* pAction = GetCurAction();
353 const size_t nObjCount = m_aList.size();
354 size_t nSyncCount = rOut.GetSyncCount();
355
356 if( nPos > nObjCount )
357 nPos = nObjCount;
358
359 // #i23407# Set backwards-compatible text language and layout mode
360 // This is necessary, since old metafiles don't even know of these
361 // recent add-ons. Newer metafiles must of course explicitly set
362 // those states.
366
367 SAL_INFO( "vcl.gdi", "GDIMetaFile::Play on device of size: " << rOut.GetOutputSizePixel().Width() << " " << rOut.GetOutputSizePixel().Height());
368
369 if (!ImplPlayWithRenderer(rOut, Point(0,0), rOut.GetOutputSize())) {
370 size_t i = 0;
371 for( size_t nCurPos = m_nCurrentActionElement; nCurPos < nPos; nCurPos++ )
372 {
373 if( pAction )
374 {
375 pAction->Execute(&rOut);
376
377 // flush output from time to time
378 if( i++ > nSyncCount )
379 {
380 rOut.Flush();
381 i = 0;
382 }
383 }
384
385 pAction = NextAction();
386 }
387 }
388 rOut.Pop();
389}
390
391bool GDIMetaFile::ImplPlayWithRenderer(OutputDevice& rOut, const Point& rPos, Size rLogicDestSize)
392{
393 if (!m_bUseCanvas)
394 return false;
395
396 Size rDestSize(rOut.LogicToPixel(rLogicDestSize));
397
398 const vcl::Window* win = rOut.GetOwnerWindow();
399
400 if (!win)
402 if (!win)
404
405 if (!win)
406 return false;
407
408 try
409 {
410 uno::Reference<rendering::XCanvas> xCanvas = win->GetOutDev()->GetCanvas ();
411
412 if (!xCanvas.is())
413 return false;
414
415 Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1);
416 uno::Reference<rendering::XBitmap> xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize));
417 if( xBitmap.is () )
418 {
419 uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY );
420 if( xBitmapCanvas.is() )
421 {
422 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
423 uno::Reference< rendering::XMtfRenderer > xMtfRenderer = rendering::MtfRenderer::createWithBitmapCanvas( xContext, xBitmapCanvas );
424
425 xBitmapCanvas->clear();
426 uno::Reference< beans::XFastPropertySet > xMtfFastPropertySet( xMtfRenderer, uno::UNO_QUERY );
427 if( xMtfFastPropertySet.is() )
428 // set this metafile to the renderer to
429 // speedup things (instead of copying data to
430 // sequence of bytes passed to renderer)
431 xMtfFastPropertySet->setFastPropertyValue( 0, uno::Any( reinterpret_cast<sal_Int64>( this ) ) );
432
433 xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() );
434
435 BitmapEx aBitmapEx;
436 if( aBitmapEx.Create( xBitmapCanvas, aSize ) )
437 {
438 if (rOut.GetMapMode().GetMapUnit() == MapUnit::MapPixel)
439 rOut.DrawBitmapEx( rPos, aBitmapEx );
440 else
441 rOut.DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
442 return true;
443 }
444 }
445 }
446 }
447 catch (const uno::RuntimeException& )
448 {
449 throw; // runtime errors are fatal
450 }
451 catch (const uno::Exception&)
452 {
453 // ignore errors, no way of reporting them here
454 TOOLS_WARN_EXCEPTION("vcl.gdi", "GDIMetaFile::ImplPlayWithRenderer");
455 }
456
457 return false;
458}
459
460void GDIMetaFile::Play(OutputDevice& rOut, const Point& rPos,
461 const Size& rSize)
462{
463 MapMode aDrawMap( GetPrefMapMode() );
464 Size aDestSize(rOut.LogicToPixel(rSize));
465
466 if (aDestSize.Width() <= 0 || aDestSize.Height() <= 0)
467 return;
468
469 if (aDestSize.Width() > std::numeric_limits<sal_Int32>::max() ||
470 aDestSize.Height() > std::numeric_limits<sal_Int32>::max())
471 return;
472
473 GDIMetaFile* pMtf = rOut.GetConnectMetaFile();
474
475 if (ImplPlayWithRenderer(rOut, rPos, rSize))
476 return;
477
478 Size aTmpPrefSize(rOut.LogicToPixel(GetPrefSize(), aDrawMap));
479
480 if( !aTmpPrefSize.Width() )
481 aTmpPrefSize.setWidth( aDestSize.Width() );
482
483 if( !aTmpPrefSize.Height() )
484 aTmpPrefSize.setHeight( aDestSize.Height() );
485
486 Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() );
487 Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() );
488
489 aScaleX *= aDrawMap.GetScaleX();
490 aScaleY *= aDrawMap.GetScaleY();
491 // try reducing inaccurary first and abandon if the scaling
492 // still cannot be achieved
493 if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()))
494 aScaleX.ReduceInaccurate(10);
495 if (TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
496 aScaleY.ReduceInaccurate(10);
497 if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()) ||
498 TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
499 {
500 SAL_WARN("vcl", "GDIMetaFile Scaling is too high");
501 return;
502 }
503
504 aDrawMap.SetScaleX(aScaleX);
505 aDrawMap.SetScaleY(aScaleY);
506
507 // #i47260# Convert logical output position to offset within
508 // the metafile's mapmode. Therefore, disable pixel offset on
509 // outdev, it's inverse mnOutOffLogicX/Y is calculated for a
510 // different mapmode (the one currently set on rOut, that is)
511 // - thus, aDrawMap's origin would generally be wrong. And
512 // even _if_ aDrawMap is similar to pOutDev's current mapmode,
513 // it's _still_ undesirable to have pixel offset unequal zero,
514 // because one would still get round-off errors (the
515 // round-trip error for LogicToPixel( PixelToLogic() ) was the
516 // reason for having pixel offset in the first place).
517 const Size& rOldOffset(rOut.GetPixelOffset());
518 const Size aEmptySize;
519 rOut.SetPixelOffset(aEmptySize);
520 aDrawMap.SetOrigin(rOut.PixelToLogic(rOut.LogicToPixel(rPos), aDrawMap));
521 rOut.SetPixelOffset(rOldOffset);
522
523 rOut.Push();
524
525 bool bIsRecord = (pMtf && pMtf->IsRecord());
526 rOut.SetMetafileMapMode(aDrawMap, bIsRecord);
527
528 // #i23407# Set backwards-compatible text language and layout mode
529 // This is necessary, since old metafiles don't even know of these
530 // recent add-ons. Newer metafiles must of course explicitly set
531 // those states.
534
535 Play(rOut);
536
537 rOut.Pop();
538}
539
540void GDIMetaFile::Pause( bool _bPause )
541{
542 if( !m_bRecord )
543 return;
544
545 if( _bPause )
546 {
547 if( !m_bPause )
548 Linker( m_pOutDev, false );
549 }
550 else
551 {
552 if( m_bPause )
553 Linker( m_pOutDev, true );
554 }
555
556 m_bPause = _bPause;
557}
558
560{
561 if( m_bRecord )
562 {
563 m_bRecord = false;
564
565 if( !m_bPause )
566 Linker( m_pOutDev, false );
567 else
568 m_bPause = false;
569 }
570}
571
573{
574 if( !m_bRecord )
576}
577
579{
580 if( !m_bRecord )
581 if ( m_nCurrentActionElement > 0 )
583}
584
586{
587 m_aList.push_back( pAction );
588
589 if( m_pPrev )
590 {
591 m_pPrev->AddAction( pAction );
592 }
593}
594
595void GDIMetaFile::AddAction(const rtl::Reference<MetaAction>& pAction, size_t nPos)
596{
597 if ( nPos < m_aList.size() )
598 {
599 m_aList.insert( m_aList.begin() + nPos, pAction );
600 }
601 else
602 {
603 m_aList.push_back( pAction );
604 }
605
606 if( m_pPrev )
607 {
608 m_pPrev->AddAction( pAction, nPos );
609 }
610}
611
613{
614 m_aList.push_back( pAction );
615}
616
618{
619 const Size aOldPrefSize( GetPrefSize() );
620 tools::Long nMoveX, nMoveY;
621 double fScaleX, fScaleY;
622
623 if( nMirrorFlags & BmpMirrorFlags::Horizontal )
624 {
625 nMoveX = std::abs( aOldPrefSize.Width() ) - 1;
626 fScaleX = -1.0;
627 }
628 else
629 {
630 nMoveX = 0;
631 fScaleX = 1.0;
632 }
633
634 if( nMirrorFlags & BmpMirrorFlags::Vertical )
635 {
636 nMoveY = std::abs( aOldPrefSize.Height() ) - 1;
637 fScaleY = -1.0;
638 }
639 else
640 {
641 nMoveY = 0;
642 fScaleY = 1.0;
643 }
644
645 if( ( fScaleX != 1.0 ) || ( fScaleY != 1.0 ) )
646 {
647 Scale( fScaleX, fScaleY );
648 Move( nMoveX, nMoveY );
649 SetPrefSize( aOldPrefSize );
650 }
651}
652
654{
655 const Size aBaseOffset( nX, nY );
656 Size aOffset( aBaseOffset );
658
659 aMapVDev->EnableOutput( false );
660 aMapVDev->SetMapMode( GetPrefMapMode() );
661
662 for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
663 {
664 const MetaActionType nType = pAct->GetType();
665 MetaAction* pModAct;
666
667 if( pAct->GetRefCount() > 1 )
668 {
669 m_aList[ m_nCurrentActionElement ] = pAct->Clone();
670 pModAct = m_aList[ m_nCurrentActionElement ].get();
671 }
672 else
673 pModAct = pAct;
674
675 if( ( MetaActionType::MAPMODE == nType ) ||
678 {
679 pModAct->Execute( aMapVDev.get() );
680 aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() );
681 }
682
683 pModAct->Move( aOffset.Width(), aOffset.Height() );
684 }
685}
686
688{
689 const Size aBaseOffset( nX, nY );
690 Size aOffset( aBaseOffset );
692
693 aMapVDev->EnableOutput( false );
694 aMapVDev->SetReferenceDevice( nDPIX, nDPIY );
695 aMapVDev->SetMapMode( GetPrefMapMode() );
696
697 for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
698 {
699 const MetaActionType nType = pAct->GetType();
700 MetaAction* pModAct;
701
702 if( pAct->GetRefCount() > 1 )
703 {
704 m_aList[ m_nCurrentActionElement ] = pAct->Clone();
705 pModAct = m_aList[ m_nCurrentActionElement ].get();
706 }
707 else
708 pModAct = pAct;
709
710 if( ( MetaActionType::MAPMODE == nType ) ||
713 {
714 pModAct->Execute( aMapVDev.get() );
715 if( aMapVDev->GetMapMode().GetMapUnit() == MapUnit::MapPixel )
716 {
717 aOffset = aMapVDev->LogicToPixel( aBaseOffset, GetPrefMapMode() );
718 MapMode aMap( aMapVDev->GetMapMode() );
719 aOffset.setWidth( static_cast<tools::Long>(aOffset.Width() * static_cast<double>(aMap.GetScaleX())) );
720 aOffset.setHeight( static_cast<tools::Long>(aOffset.Height() * static_cast<double>(aMap.GetScaleY())) );
721 }
722 else
723 aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() );
724 }
725
726 pModAct->Move( aOffset.Width(), aOffset.Height() );
727 }
728}
729
730void GDIMetaFile::ScaleActions(double const fScaleX, double const fScaleY)
731{
732 for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
733 {
734 MetaAction* pModAct;
735
736 if( pAct->GetRefCount() > 1 )
737 {
738 m_aList[ m_nCurrentActionElement ] = pAct->Clone();
739 pModAct = m_aList[ m_nCurrentActionElement ].get();
740 }
741 else
742 pModAct = pAct;
743
744 pModAct->Scale( fScaleX, fScaleY );
745 }
746}
747
748void GDIMetaFile::Scale( double fScaleX, double fScaleY )
749{
750 ScaleActions(fScaleX, fScaleY);
751
752 m_aPrefSize.setWidth( FRound( m_aPrefSize.Width() * fScaleX ) );
754}
755
756void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
757{
758 Scale( static_cast<double>(rScaleX), static_cast<double>(rScaleY) );
759}
760
761void GDIMetaFile::Clip( const tools::Rectangle& i_rClipRect )
762{
763 tools::Rectangle aCurRect( i_rClipRect );
765
766 aMapVDev->EnableOutput( false );
767 aMapVDev->SetMapMode( GetPrefMapMode() );
768
769 for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() )
770 {
771 const MetaActionType nType = pAct->GetType();
772
773 if( ( MetaActionType::MAPMODE == nType ) ||
776 {
777 pAct->Execute( aMapVDev.get() );
778 aCurRect = OutputDevice::LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev->GetMapMode() );
779 }
781 {
782 MetaClipRegionAction* pOldAct = static_cast<MetaClipRegionAction*>(pAct);
783 vcl::Region aNewReg( aCurRect );
784 if( pOldAct->IsClipping() )
785 aNewReg.Intersect( pOldAct->GetRegion() );
786 MetaClipRegionAction* pNewAct = new MetaClipRegionAction( std::move(aNewReg), true );
787 m_aList[ m_nCurrentActionElement ] = pNewAct;
788 }
789 }
790}
791
792Point GDIMetaFile::ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt,
793 const Size& rOffset, double fSin, double fCos )
794{
795 const tools::Long nX = rPt.X() - rRotatePt.X();
796 const tools::Long nY = rPt.Y() - rRotatePt.Y();
797
798 return Point( FRound( fCos * nX + fSin * nY ) + rRotatePt.X() + rOffset.Width(),
799 -FRound( fSin * nX - fCos * nY ) + rRotatePt.Y() + rOffset.Height() );
800}
801
803 const Size& rOffset, double fSin, double fCos )
804{
805 tools::Polygon aRet( rPoly );
806
807 aRet.Rotate( rRotatePt, fSin, fCos );
808 aRet.Move( rOffset.Width(), rOffset.Height() );
809
810 return aRet;
811}
812
814 const Size& rOffset, double fSin, double fCos )
815{
816 tools::PolyPolygon aRet( rPolyPoly );
817
818 aRet.Rotate( rRotatePt, fSin, fCos );
819 aRet.Move( rOffset.Width(), rOffset.Height() );
820
821 return aRet;
822}
823
825 const OutputDevice& rMapDev,
826 const tools::PolyPolygon& rPolyPoly,
827 const Gradient& rGrad )
828{
829 // Generate comment, GradientEx and Gradient actions (within DrawGradient)
831 aVDev->EnableOutput( false );
832 GDIMetaFile aGradMtf;
833
834 aGradMtf.Record( aVDev.get() );
835 aVDev->DrawGradient( rPolyPoly, rGrad );
836 aGradMtf.Stop();
837
838 size_t i, nAct( aGradMtf.GetActionSize() );
839 for( i=0; i < nAct; ++i )
840 {
841 MetaAction* pMetaAct = aGradMtf.GetAction( i );
842 rMtf.AddAction( pMetaAct );
843 }
844}
845
847{
848 nAngle10 %= 3600_deg10;
849 nAngle10 = ( nAngle10 < 0_deg10 ) ? ( Degree10(3599) + nAngle10 ) : nAngle10;
850
851 if( !nAngle10 )
852 return;
853
854 GDIMetaFile aMtf;
856 const double fAngle = toRadians(nAngle10);
857 const double fSin = sin( fAngle );
858 const double fCos = cos( fAngle );
859 tools::Rectangle aRect( Point(), GetPrefSize() );
860 tools::Polygon aPoly( aRect );
861
862 aPoly.Rotate( Point(), fSin, fCos );
863
864 aMapVDev->EnableOutput( false );
865 aMapVDev->SetMapMode( GetPrefMapMode() );
866
867 const tools::Rectangle aNewBound( aPoly.GetBoundRect() );
868
869 const Point aOrigin( GetPrefMapMode().GetOrigin().X(), GetPrefMapMode().GetOrigin().Y() );
870 const Size aOffset( -aNewBound.Left(), -aNewBound.Top() );
871
872 Point aRotAnchor( aOrigin );
873 Size aRotOffset( aOffset );
874
875 for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() )
876 {
877 const MetaActionType nActionType = pAction->GetType();
878
879 switch( nActionType )
880 {
882 {
883 MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
884 aMtf.AddAction( new MetaPixelAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
885 pAct->GetColor() ) );
886 }
887 break;
888
890 {
891 MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction);
892 aMtf.AddAction( new MetaPointAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
893 }
894 break;
895
897 {
898 MetaLineAction* pAct = static_cast<MetaLineAction*>(pAction);
899 aMtf.AddAction( new MetaLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
900 ImplGetRotatedPoint( pAct->GetEndPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
901 pAct->GetLineInfo() ) );
902 }
903 break;
904
906 {
907 MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction);
908 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( tools::Polygon(pAct->GetRect()), aRotAnchor, aRotOffset, fSin, fCos ) ) );
909 }
910 break;
911
913 {
914 MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction);
915 const tools::Polygon aRoundRectPoly( pAct->GetRect(), pAct->GetHorzRound(), pAct->GetVertRound() );
916
917 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aRoundRectPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
918 }
919 break;
920
922 {
923 MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction);
924 const tools::Polygon aEllipsePoly( pAct->GetRect().Center(), pAct->GetRect().GetWidth() >> 1, pAct->GetRect().GetHeight() >> 1 );
925
926 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aEllipsePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
927 }
928 break;
929
931 {
932 MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction);
933 const tools::Polygon aArcPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Arc );
934
935 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aArcPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
936 }
937 break;
938
940 {
941 MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction);
942 const tools::Polygon aPiePoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Pie );
943
944 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aPiePoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
945 }
946 break;
947
949 {
950 MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction);
951 const tools::Polygon aChordPoly( pAct->GetRect(), pAct->GetStartPoint(), pAct->GetEndPoint(), PolyStyle::Chord );
952
953 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( aChordPoly, aRotAnchor, aRotOffset, fSin, fCos ) ) );
954 }
955 break;
956
958 {
959 MetaPolyLineAction* pAct = static_cast<MetaPolyLineAction*>(pAction);
960 aMtf.AddAction( new MetaPolyLineAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->GetLineInfo() ) );
961 }
962 break;
963
965 {
966 MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction);
967 aMtf.AddAction( new MetaPolygonAction( ImplGetRotatedPolygon( pAct->GetPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
968 }
969 break;
970
972 {
973 MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction);
974 aMtf.AddAction( new MetaPolyPolygonAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) );
975 }
976 break;
977
979 {
980 MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction);
981 aMtf.AddAction( new MetaTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
982 pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
983 }
984 break;
985
987 {
988 MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction);
989 aMtf.AddAction( new MetaTextArrayAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
990 pAct->GetText(), pAct->GetDXArray(), pAct->GetKashidaArray(), pAct->GetIndex(), pAct->GetLen() ) );
991 }
992 break;
993
995 {
996 MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction);
997 aMtf.AddAction( new MetaStretchTextAction( ImplGetRotatedPoint( pAct->GetPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
998 pAct->GetWidth(), pAct->GetText(), pAct->GetIndex(), pAct->GetLen() ) );
999 }
1000 break;
1001
1003 {
1004 MetaTextLineAction* pAct = static_cast<MetaTextLineAction*>(pAction);
1005 aMtf.AddAction( new MetaTextLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
1006 pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline(), pAct->GetOverline() ) );
1007 }
1008 break;
1009
1011 {
1012 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
1013 tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetPoint(), pAct->GetSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1014 tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
1015 BitmapEx aBmpEx( pAct->GetBitmap() );
1016
1017 aBmpEx.Rotate( nAngle10, COL_TRANSPARENT );
1018 aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(),
1019 aBmpEx ) );
1020 }
1021 break;
1022
1024 {
1025 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
1026 tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1027 tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
1028 BitmapEx aBmpEx( pAct->GetBitmap() );
1029
1030 aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
1031 aBmpEx.Rotate( nAngle10, COL_TRANSPARENT );
1032
1033 aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
1034 }
1035 break;
1036
1038 {
1039 MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
1040 tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetPoint(), pAct->GetSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1041 tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
1042 BitmapEx aBmpEx( pAct->GetBitmapEx() );
1043
1044 aBmpEx.Rotate( nAngle10, COL_TRANSPARENT );
1045
1046 aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
1047 }
1048 break;
1049
1051 {
1052 MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
1053 tools::Polygon aBmpPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetDestPoint(), pAct->GetDestSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1054 tools::Rectangle aBmpRect( aBmpPoly.GetBoundRect() );
1055 BitmapEx aBmpEx( pAct->GetBitmapEx() );
1056
1057 aBmpEx.Crop( tools::Rectangle( pAct->GetSrcPoint(), pAct->GetSrcSize() ) );
1058 aBmpEx.Rotate( nAngle10, COL_TRANSPARENT );
1059
1060 aMtf.AddAction( new MetaBmpExScaleAction( aBmpRect.TopLeft(), aBmpRect.GetSize(), aBmpEx ) );
1061 }
1062 break;
1063
1065 {
1066 MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
1067
1068 ImplAddGradientEx( aMtf, *aMapVDev,
1069 tools::PolyPolygon(ImplGetRotatedPolygon( tools::Polygon(pAct->GetRect()), aRotAnchor, aRotOffset, fSin, fCos )),
1070 pAct->GetGradient() );
1071 }
1072 break;
1073
1075 {
1076 MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
1077 aMtf.AddAction( new MetaGradientExAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
1078 pAct->GetGradient() ) );
1079 }
1080 break;
1081
1082 // Handle gradientex comment block correctly
1084 {
1085 MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
1086 if( pCommentAct->GetComment() == "XGRAD_SEQ_BEGIN" )
1087 {
1088 int nBeginComments( 1 );
1089 pAction = NextAction();
1090
1091 // skip everything, except gradientex action
1092 while( pAction )
1093 {
1094 const MetaActionType nType = pAction->GetType();
1095
1097 {
1098 // Add rotated gradientex
1099 MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
1100 ImplAddGradientEx( aMtf, *aMapVDev,
1101 ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
1102 pAct->GetGradient() );
1103 }
1104 else if( MetaActionType::COMMENT == nType)
1105 {
1106 MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pAction);
1107 if( pAct->GetComment() == "XGRAD_SEQ_END" )
1108 {
1109 // handle nested blocks
1110 --nBeginComments;
1111
1112 // gradientex comment block: end reached, done.
1113 if( !nBeginComments )
1114 break;
1115 }
1116 else if( pAct->GetComment() == "XGRAD_SEQ_BEGIN" )
1117 {
1118 // handle nested blocks
1119 ++nBeginComments;
1120 }
1121
1122 }
1123
1124 pAction =NextAction();
1125 }
1126 }
1127 else
1128 {
1129 bool bPathStroke = (pCommentAct->GetComment() == "XPATHSTROKE_SEQ_BEGIN");
1130 if ( bPathStroke || pCommentAct->GetComment() == "XPATHFILL_SEQ_BEGIN" )
1131 {
1132 if ( pCommentAct->GetDataSize() )
1133 {
1134 SvMemoryStream aMemStm( const_cast<sal_uInt8 *>(pCommentAct->GetData()), pCommentAct->GetDataSize(), StreamMode::READ );
1135 SvMemoryStream aDest;
1136 if ( bPathStroke )
1137 {
1138 SvtGraphicStroke aStroke;
1139 ReadSvtGraphicStroke( aMemStm, aStroke );
1140 tools::Polygon aPath;
1141 aStroke.getPath( aPath );
1142 aStroke.setPath( ImplGetRotatedPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
1143 WriteSvtGraphicStroke( aDest, aStroke );
1144 aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0,
1145 static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
1146 }
1147 else
1148 {
1149 SvtGraphicFill aFill;
1150 ReadSvtGraphicFill( aMemStm, aFill );
1151 tools::PolyPolygon aPath;
1152 aFill.getPath( aPath );
1153 aFill.setPath( ImplGetRotatedPolyPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) );
1154 WriteSvtGraphicFill( aDest, aFill );
1155 aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0,
1156 static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) );
1157 }
1158 }
1159 }
1160 else if ( pCommentAct->GetComment() == "XPATHSTROKE_SEQ_END"
1161 || pCommentAct->GetComment() == "XPATHFILL_SEQ_END" )
1162 {
1163 pAction->Execute( aMapVDev.get() );
1164 aMtf.AddAction( pAction );
1165 }
1166 }
1167 }
1168 break;
1169
1171 {
1172 MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
1173 Hatch aHatch( pAct->GetHatch() );
1174
1175 aHatch.SetAngle( aHatch.GetAngle() + nAngle10 );
1176 aMtf.AddAction( new MetaHatchAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
1177 aHatch ) );
1178 }
1179 break;
1180
1182 {
1183 MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction);
1184 aMtf.AddAction( new MetaTransparentAction( ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ),
1185 pAct->GetTransparence() ) );
1186 }
1187 break;
1188
1190 {
1191 MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pAction);
1192 GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() );
1193 tools::Polygon aMtfPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetPoint(), pAct->GetSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1194 tools::Rectangle aMtfRect( aMtfPoly.GetBoundRect() );
1195
1196 aTransMtf.Rotate( nAngle10 );
1197 aMtf.AddAction( new MetaFloatTransparentAction( aTransMtf, aMtfRect.TopLeft(), aMtfRect.GetSize(),
1198 pAct->GetGradient() ) );
1199 }
1200 break;
1201
1203 {
1204 MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
1205 GDIMetaFile aEPSMtf( pAct->GetSubstitute() );
1206 tools::Polygon aEPSPoly( ImplGetRotatedPolygon( tools::Polygon(tools::Rectangle( pAct->GetPoint(), pAct->GetSize() )), aRotAnchor, aRotOffset, fSin, fCos ) );
1207 tools::Rectangle aEPSRect( aEPSPoly.GetBoundRect() );
1208
1209 aEPSMtf.Rotate( nAngle10 );
1210 aMtf.AddAction( new MetaEPSAction( aEPSRect.TopLeft(), aEPSRect.GetSize(),
1211 pAct->GetLink(), aEPSMtf ) );
1212 }
1213 break;
1214
1216 {
1217 MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction);
1218
1219 if( pAct->IsClipping() && pAct->GetRegion().HasPolyPolygonOrB2DPolyPolygon() )
1220 aMtf.AddAction( new MetaClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( pAct->GetRegion().GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ), true ) );
1221 else
1222 {
1223 aMtf.AddAction( pAction );
1224 }
1225 }
1226 break;
1227
1229 {
1230 MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction);
1232 ImplGetRotatedPolygon( tools::Polygon(pAct->GetRect()), aRotAnchor,
1233 aRotOffset, fSin, fCos )) ) );
1234 }
1235 break;
1236
1238 {
1240 const vcl::Region& rRegion = pAct->GetRegion();
1241
1242 if( rRegion.HasPolyPolygonOrB2DPolyPolygon() )
1243 aMtf.AddAction( new MetaISectRegionClipRegionAction( vcl::Region( ImplGetRotatedPolyPolygon( rRegion.GetAsPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ) ) ) );
1244 else
1245 {
1246 aMtf.AddAction( pAction );
1247 }
1248 }
1249 break;
1250
1252 {
1253 MetaRefPointAction* pAct = static_cast<MetaRefPointAction*>(pAction);
1254 aMtf.AddAction( new MetaRefPointAction( ImplGetRotatedPoint( pAct->GetRefPoint(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->IsSetting() ) );
1255 }
1256 break;
1257
1259 {
1260 MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
1261 vcl::Font aFont( pAct->GetFont() );
1262
1263 aFont.SetOrientation( aFont.GetOrientation() + nAngle10 );
1264 aMtf.AddAction( new MetaFontAction( std::move(aFont) ) );
1265 }
1266 break;
1267
1276 {
1277 OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" );
1278 }
1279 break;
1280
1281 default:
1282 {
1283 pAction->Execute( aMapVDev.get() );
1284 aMtf.AddAction( pAction );
1285
1286 // update rotation point and offset, if necessary
1287 if( ( MetaActionType::MAPMODE == nActionType ) ||
1288 ( MetaActionType::PUSH == nActionType ) ||
1289 ( MetaActionType::POP == nActionType ) )
1290 {
1291 aRotAnchor = OutputDevice::LogicToLogic( aOrigin, m_aPrefMapMode, aMapVDev->GetMapMode() );
1292 aRotOffset = OutputDevice::LogicToLogic( aOffset, m_aPrefMapMode, aMapVDev->GetMapMode() );
1293 }
1294 }
1295 break;
1296 }
1297 }
1298
1300 aMtf.m_aPrefSize = aNewBound.GetSize();
1301
1302 *this = aMtf;
1303
1304}
1305
1306static void ImplActionBounds( tools::Rectangle& o_rOutBounds,
1307 const tools::Rectangle& i_rInBounds,
1308 const std::vector<tools::Rectangle>& i_rClipStack )
1309{
1310 tools::Rectangle aBounds( i_rInBounds );
1311 if( ! i_rInBounds.IsEmpty() && ! i_rClipStack.empty() && ! i_rClipStack.back().IsEmpty() )
1312 aBounds.Intersection( i_rClipStack.back() );
1313 if( aBounds.IsEmpty() )
1314 return;
1315
1316 if( ! o_rOutBounds.IsEmpty() )
1317 o_rOutBounds.Union( aBounds );
1318 else
1319 o_rOutBounds = aBounds;
1320}
1321
1323{
1324 ScopedVclPtrInstance< VirtualDevice > aMapVDev( i_rReference );
1325
1326 aMapVDev->EnableOutput( false );
1327 aMapVDev->SetMapMode( GetPrefMapMode() );
1328
1329 std::vector<tools::Rectangle> aClipStack( 1, tools::Rectangle() );
1330 std::vector<vcl::PushFlags> aPushFlagStack;
1331
1332 tools::Rectangle aBound;
1334
1335 for(sal_uLong a(0); a < nCount; a++)
1336 {
1337 MetaAction* pAction = GetAction(a);
1338 const MetaActionType nActionType = pAction->GetType();
1339
1340 switch( nActionType )
1341 {
1343 {
1344 MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
1345 ImplActionBounds( aBound,
1346 tools::Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ),
1347 aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
1348 aClipStack );
1349 }
1350 break;
1351
1353 {
1354 MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction);
1355 ImplActionBounds( aBound,
1356 tools::Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ),
1357 aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ),
1358 aClipStack );
1359 }
1360 break;
1361
1363 {
1364 MetaLineAction* pAct = static_cast<MetaLineAction*>(pAction);
1365 Point aP1( pAct->GetStartPoint() ), aP2( pAct->GetEndPoint() );
1366 tools::Rectangle aRect( aP1, aP2 );
1367 aRect.Normalize();
1368
1369 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1370 }
1371 break;
1372
1374 {
1375 MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction);
1376 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1377 }
1378 break;
1379
1381 {
1382 MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction);
1383 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1384 }
1385 break;
1386
1388 {
1389 MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction);
1390 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1391 }
1392 break;
1393
1395 {
1396 MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction);
1397 // FIXME: this is imprecise
1398 // e.g. for small arcs the whole rectangle is WAY too large
1399 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1400 }
1401 break;
1402
1404 {
1405 MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction);
1406 // FIXME: this is imprecise
1407 // e.g. for small arcs the whole rectangle is WAY too large
1408 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1409 }
1410 break;
1411
1413 {
1414 MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction);
1415 // FIXME: this is imprecise
1416 // e.g. for small arcs the whole rectangle is WAY too large
1417 ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1418 }
1419 break;
1420
1422 {
1423 MetaPolyLineAction* pAct = static_cast<MetaPolyLineAction*>(pAction);
1424 tools::Rectangle aRect( pAct->GetPolygon().GetBoundRect() );
1425
1426 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1427 }
1428 break;
1429
1431 {
1432 MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction);
1433 tools::Rectangle aRect( pAct->GetPolygon().GetBoundRect() );
1434 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1435 }
1436 break;
1437
1439 {
1440 MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction);
1441 tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
1442 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1443 }
1444 break;
1445
1447 {
1448 MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction);
1449 tools::Rectangle aRect;
1450 // hdu said base = index
1451 aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() );
1452 Point aPt( pAct->GetPoint() );
1453 aRect.Move( aPt.X(), aPt.Y() );
1454 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1455 }
1456 break;
1457
1459 {
1460 MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction);
1461 tools::Rectangle aRect;
1462 // hdu said base = index
1463 aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
1464 0, pAct->GetDXArray(), pAct->GetKashidaArray() );
1465 Point aPt( pAct->GetPoint() );
1466 aRect.Move( aPt.X(), aPt.Y() );
1467 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1468 }
1469 break;
1470
1472 {
1473 MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction);
1474 tools::Rectangle aRect;
1475 // hdu said base = index
1476 aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(),
1477 pAct->GetWidth() );
1478 Point aPt( pAct->GetPoint() );
1479 aRect.Move( aPt.X(), aPt.Y() );
1480 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1481 }
1482 break;
1483
1485 {
1486 MetaTextLineAction* pAct = static_cast<MetaTextLineAction*>(pAction);
1487 // measure a test string to get ascend and descent right
1488 static constexpr OUStringLiteral pStr = u"\u00c4g";
1489 OUString aStr( pStr );
1490
1491 tools::Rectangle aRect;
1492 aMapVDev->GetTextBoundRect( aRect, aStr, 0, 0, aStr.getLength() );
1493 Point aPt( pAct->GetStartPoint() );
1494 aRect.Move( aPt.X(), aPt.Y() );
1495 aRect.SetRight( aRect.Left() + pAct->GetWidth() );
1496 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1497 }
1498 break;
1499
1501 {
1502 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
1503 tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
1504 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1505 }
1506 break;
1507
1509 {
1510 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
1511 tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
1512 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1513 }
1514 break;
1515
1517 {
1518 MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
1519 tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
1520 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1521 }
1522 break;
1523
1525 {
1526 MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
1527 tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
1528 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1529 }
1530 break;
1531
1533 {
1534 MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
1535 tools::Rectangle aRect( pAct->GetRect() );
1536 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1537 }
1538 break;
1539
1541 {
1542 MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
1543 tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
1544 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1545 }
1546 break;
1547
1549 {
1550 // nothing to do
1551 };
1552 break;
1553
1555 {
1556 MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
1557 tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
1558 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1559 }
1560 break;
1561
1563 {
1564 MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction);
1565 tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() );
1566 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1567 }
1568 break;
1569
1571 {
1572 MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pAction);
1573 // MetaFloatTransparentAction is defined limiting its content Metafile
1574 // to its geometry definition(Point, Size), so use these directly
1575 const tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
1576 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1577 }
1578 break;
1579
1581 {
1582 MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
1583 tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() );
1584 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1585 }
1586 break;
1587
1589 {
1590 MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction);
1591 if( pAct->IsClipping() )
1592 aClipStack.back() = OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() );
1593 else
1594 aClipStack.back() = tools::Rectangle();
1595 }
1596 break;
1597
1599 {
1600 MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction);
1601 tools::Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) );
1602 if( aClipStack.back().IsEmpty() )
1603 aClipStack.back() = aRect;
1604 else
1605 aClipStack.back().Intersection( aRect );
1606 }
1607 break;
1608
1610 {
1612 tools::Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) );
1613 if( aClipStack.back().IsEmpty() )
1614 aClipStack.back() = aRect;
1615 else
1616 aClipStack.back().Intersection( aRect );
1617 }
1618 break;
1619
1621 {
1622 MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction);
1623 tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
1624 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1625 }
1626 break;
1627
1629 {
1630 MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction);
1631 tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) );
1632 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1633 }
1634 break;
1635
1637 {
1638 MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction);
1639 tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) );
1640 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1641 }
1642 break;
1643
1645 {
1646 MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
1647 tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
1648 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1649 }
1650 break;
1651
1653 {
1654 MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
1655 tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() );
1656 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1657 }
1658 break;
1659
1661 {
1662 MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction);
1663 tools::Rectangle aRect( pAct->GetRect() );
1664 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1665 }
1666 break;
1667
1669 {
1670 MetaTextRectAction* pAct = static_cast<MetaTextRectAction*>(pAction);
1671 tools::Rectangle aRect( pAct->GetRect() );
1672 ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack );
1673 }
1674 break;
1675
1677 {
1678 MetaMoveClipRegionAction* pAct = static_cast<MetaMoveClipRegionAction*>(pAction);
1679 if( ! aClipStack.back().IsEmpty() )
1680 {
1681 Size aDelta( pAct->GetHorzMove(), pAct->GetVertMove() );
1682 aDelta = OutputDevice::LogicToLogic( aDelta, aMapVDev->GetMapMode(), GetPrefMapMode() );
1683 aClipStack.back().Move( aDelta.Width(), aDelta.Width() );
1684 }
1685 }
1686 break;
1687
1688 default:
1689 {
1690 pAction->Execute( aMapVDev.get() );
1691
1692 if( nActionType == MetaActionType::PUSH )
1693 {
1694 MetaPushAction* pAct = static_cast<MetaPushAction*>(pAction);
1695 aPushFlagStack.push_back( pAct->GetFlags() );
1696 if( aPushFlagStack.back() & vcl::PushFlags::CLIPREGION )
1697 {
1698 tools::Rectangle aRect( aClipStack.back() );
1699 aClipStack.push_back( aRect );
1700 }
1701 }
1702 else if( nActionType == MetaActionType::POP )
1703 {
1704 // sanity check
1705 if( ! aPushFlagStack.empty() )
1706 {
1707 if( aPushFlagStack.back() & vcl::PushFlags::CLIPREGION )
1708 {
1709 if( aClipStack.size() > 1 )
1710 aClipStack.pop_back();
1711 }
1712 aPushFlagStack.pop_back();
1713 }
1714 }
1715 }
1716 break;
1717 }
1718 }
1719 return aBound;
1720}
1721
1722Color GDIMetaFile::ImplColAdjustFnc( const Color& rColor, const void* pColParam )
1723{
1724 return Color( ColorAlpha, rColor.GetAlpha(),
1725 static_cast<const ImplColAdjustParam*>(pColParam)->pMapR[ rColor.GetRed() ],
1726 static_cast<const ImplColAdjustParam*>(pColParam)->pMapG[ rColor.GetGreen() ],
1727 static_cast<const ImplColAdjustParam*>(pColParam)->pMapB[ rColor.GetBlue() ] );
1728
1729}
1730
1731BitmapEx GDIMetaFile::ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
1732{
1733 const ImplBmpAdjustParam* p = static_cast<const ImplBmpAdjustParam*>(pBmpParam);
1734 BitmapEx aRet( rBmpEx );
1735
1736 aRet.Adjust( p->nLuminancePercent, p->nContrastPercent,
1737 p->nChannelRPercent, p->nChannelGPercent, p->nChannelBPercent,
1738 p->fGamma, p->bInvert );
1739
1740 return aRet;
1741}
1742
1743Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam )
1744{
1745 sal_uInt8 cLum = rColor.GetLuminance();
1746
1747 if( MtfConversion::N1BitThreshold == static_cast<const ImplColConvertParam*>(pColParam)->eConversion )
1748 cLum = ( cLum < 128 ) ? 0 : 255;
1749
1750 return Color( ColorAlpha, rColor.GetAlpha(), cLum, cLum, cLum );
1751}
1752
1753BitmapEx GDIMetaFile::ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
1754{
1755 BitmapEx aRet( rBmpEx );
1756
1757 aRet.Convert( static_cast<const ImplBmpConvertParam*>(pBmpParam)->eConversion );
1758
1759 return aRet;
1760}
1761
1762Color GDIMetaFile::ImplColMonoFnc( const Color&, const void* pColParam )
1763{
1764 return static_cast<const ImplColMonoParam*>(pColParam)->aColor;
1765}
1766
1767BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
1768{
1769 BitmapPalette aPal( 3 );
1770 aPal[ 0 ] = COL_BLACK;
1771 aPal[ 1 ] = COL_WHITE;
1772 aPal[ 2 ] = static_cast<const ImplBmpMonoParam*>(pBmpParam)->aColor;
1773
1774 Bitmap aBmp(rBmpEx.GetSizePixel(), vcl::PixelFormat::N8_BPP, &aPal);
1775 aBmp.Erase( static_cast<const ImplBmpMonoParam*>(pBmpParam)->aColor );
1776
1777 if( rBmpEx.IsAlpha() )
1778 return BitmapEx( aBmp, rBmpEx.GetAlphaMask() );
1779 else
1780 return BitmapEx( aBmp );
1781}
1782
1783Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam )
1784{
1785 const sal_uLong nR = rColor.GetRed(), nG = rColor.GetGreen(), nB = rColor.GetBlue();
1786
1787 for( sal_uLong i = 0; i < static_cast<const ImplColReplaceParam*>(pColParam)->nCount; i++ )
1788 {
1789 if( ( static_cast<const ImplColReplaceParam*>(pColParam)->pMinR[ i ] <= nR ) &&
1790 ( static_cast<const ImplColReplaceParam*>(pColParam)->pMaxR[ i ] >= nR ) &&
1791 ( static_cast<const ImplColReplaceParam*>(pColParam)->pMinG[ i ] <= nG ) &&
1792 ( static_cast<const ImplColReplaceParam*>(pColParam)->pMaxG[ i ] >= nG ) &&
1793 ( static_cast<const ImplColReplaceParam*>(pColParam)->pMinB[ i ] <= nB ) &&
1794 ( static_cast<const ImplColReplaceParam*>(pColParam)->pMaxB[ i ] >= nB ) )
1795 {
1796 return static_cast<const ImplColReplaceParam*>(pColParam)->pDstCols[ i ];
1797 }
1798 }
1799
1800 return rColor;
1801}
1802
1803BitmapEx GDIMetaFile::ImplBmpReplaceFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
1804{
1805 const ImplBmpReplaceParam* p = static_cast<const ImplBmpReplaceParam*>(pBmpParam);
1806 BitmapEx aRet( rBmpEx );
1807
1808 aRet.Replace( p->pSrcCols, p->pDstCols, p->nCount );
1809
1810 return aRet;
1811}
1812
1813void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pColParam,
1814 BmpExchangeFnc pFncBmp, const void* pBmpParam )
1815{
1816 GDIMetaFile aMtf;
1817
1818 aMtf.m_aPrefSize = m_aPrefSize;
1821 aMtf.m_bSVG = m_bSVG;
1822
1823 for( MetaAction* pAction = FirstAction(); pAction; pAction = NextAction() )
1824 {
1825 const MetaActionType nType = pAction->GetType();
1826
1827 switch( nType )
1828 {
1830 {
1831 MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction);
1832 aMtf.push_back( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ) );
1833 }
1834 break;
1835
1837 {
1838 MetaLineColorAction* pAct = static_cast<MetaLineColorAction*>(pAction);
1839
1840 if( pAct->IsSetting() )
1841 pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), true );
1842
1843 aMtf.push_back( pAct );
1844 }
1845 break;
1846
1848 {
1849 MetaFillColorAction* pAct = static_cast<MetaFillColorAction*>(pAction);
1850
1851 if( pAct->IsSetting() )
1852 pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), true );
1853
1854 aMtf.push_back( pAct );
1855 }
1856 break;
1857
1859 {
1860 MetaTextColorAction* pAct = static_cast<MetaTextColorAction*>(pAction);
1861 aMtf.push_back( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ) );
1862 }
1863 break;
1864
1866 {
1867 MetaTextFillColorAction* pAct = static_cast<MetaTextFillColorAction*>(pAction);
1868
1869 if( pAct->IsSetting() )
1870 pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), true );
1871
1872 aMtf.push_back( pAct );
1873 }
1874 break;
1875
1877 {
1878 MetaTextLineColorAction* pAct = static_cast<MetaTextLineColorAction*>(pAction);
1879
1880 if( pAct->IsSetting() )
1881 pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), true );
1882
1883 aMtf.push_back( pAct );
1884 }
1885 break;
1886
1888 {
1889 MetaOverlineColorAction* pAct = static_cast<MetaOverlineColorAction*>(pAction);
1890
1891 if( pAct->IsSetting() )
1892 pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), true );
1893
1894 aMtf.push_back( pAct );
1895 }
1896 break;
1897
1899 {
1900 MetaFontAction* pAct = static_cast<MetaFontAction*>(pAction);
1901 vcl::Font aFont( pAct->GetFont() );
1902
1903 aFont.SetColor( pFncCol( aFont.GetColor(), pColParam ) );
1904 aFont.SetFillColor( pFncCol( aFont.GetFillColor(), pColParam ) );
1905 aMtf.push_back( new MetaFontAction( std::move(aFont) ) );
1906 }
1907 break;
1908
1910 {
1911 MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction);
1912 Wallpaper aWall( pAct->GetWallpaper() );
1913 const tools::Rectangle& rRect = pAct->GetRect();
1914
1915 aWall.SetColor( pFncCol( aWall.GetColor(), pColParam ) );
1916
1917 if( aWall.IsBitmap() )
1918 aWall.SetBitmap( pFncBmp( aWall.GetBitmap(), pBmpParam ) );
1919
1920 if( aWall.IsGradient() )
1921 {
1922 Gradient aGradient( aWall.GetGradient() );
1923
1924 aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
1925 aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
1926 aWall.SetGradient( aGradient );
1927 }
1928
1929 aMtf.push_back( new MetaWallpaperAction( rRect, std::move(aWall) ) );
1930 }
1931 break;
1932
1936 {
1937 OSL_FAIL( "Don't use bitmap actions of this type in metafiles!" );
1938 }
1939 break;
1940
1942 {
1943 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
1944 aMtf.push_back( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(),
1945 pFncBmp( BitmapEx(pAct->GetBitmap()), pBmpParam ).GetBitmap() ) );
1946 }
1947 break;
1948
1950 {
1951 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
1952 aMtf.push_back( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
1953 pAct->GetSrcPoint(), pAct->GetSrcSize(),
1954 pFncBmp( BitmapEx(pAct->GetBitmap()), pBmpParam ).GetBitmap() )
1955 );
1956 }
1957 break;
1958
1960 {
1961 MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction);
1962 aMtf.push_back( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(),
1963 pFncBmp( pAct->GetBitmapEx(), pBmpParam ) )
1964 );
1965 }
1966 break;
1967
1969 {
1970 MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction);
1971 aMtf.push_back( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
1972 pAct->GetSrcPoint(), pAct->GetSrcSize(),
1973 pFncBmp( pAct->GetBitmapEx(), pBmpParam ) )
1974 );
1975 }
1976 break;
1977
1979 {
1980 MetaMaskScaleAction* pAct = static_cast<MetaMaskScaleAction*>(pAction);
1981 aMtf.push_back( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(),
1982 pAct->GetBitmap(),
1983 pFncCol( pAct->GetColor(), pColParam ) )
1984 );
1985 }
1986 break;
1987
1989 {
1990 MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction);
1991 aMtf.push_back( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
1992 pAct->GetSrcPoint(), pAct->GetSrcSize(),
1993 pAct->GetBitmap(),
1994 pFncCol( pAct->GetColor(), pColParam ) )
1995 );
1996 }
1997 break;
1998
2000 {
2001 MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction);
2002 Gradient aGradient( pAct->GetGradient() );
2003
2004 aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
2005 aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
2006 aMtf.push_back( new MetaGradientAction( pAct->GetRect(), std::move(aGradient) ) );
2007 }
2008 break;
2009
2011 {
2012 MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction);
2013 Gradient aGradient( pAct->GetGradient() );
2014
2015 aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
2016 aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
2017 aMtf.push_back( new MetaGradientExAction( pAct->GetPolyPolygon(), std::move(aGradient) ) );
2018 }
2019 break;
2020
2022 {
2023 MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction);
2024 Hatch aHatch( pAct->GetHatch() );
2025
2026 aHatch.SetColor( pFncCol( aHatch.GetColor(), pColParam ) );
2027 aMtf.push_back( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ) );
2028 }
2029 break;
2030
2032 {
2033 MetaFloatTransparentAction* pAct = static_cast<MetaFloatTransparentAction*>(pAction);
2034 GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() );
2035
2036 aTransMtf.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam );
2037 aMtf.push_back( new MetaFloatTransparentAction( aTransMtf,
2038 pAct->GetPoint(), pAct->GetSize(),
2039 pAct->GetGradient() )
2040 );
2041 }
2042 break;
2043
2045 {
2046 MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction);
2047 GDIMetaFile aSubst( pAct->GetSubstitute() );
2048
2049 aSubst.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam );
2050 aMtf.push_back( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(),
2051 pAct->GetLink(), aSubst )
2052 );
2053 }
2054 break;
2055
2056 default:
2057 {
2058 aMtf.push_back( pAction );
2059 }
2060 break;
2061 }
2062 }
2063
2064 *this = aMtf;
2065}
2066
2067void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
2068 short nChannelRPercent, short nChannelGPercent,
2069 short nChannelBPercent, double fGamma, bool bInvert, bool msoBrightness )
2070{
2071 // nothing to do? => return quickly
2072 if( !(nLuminancePercent || nContrastPercent ||
2073 nChannelRPercent || nChannelGPercent || nChannelBPercent ||
2074 ( fGamma != 1.0 ) || bInvert) )
2075 return;
2076
2077 double fM, fROff, fGOff, fBOff, fOff;
2078 ImplColAdjustParam aColParam;
2079 ImplBmpAdjustParam aBmpParam;
2080
2081 aColParam.pMapR.reset(new sal_uInt8[ 256 ]);
2082 aColParam.pMapG.reset(new sal_uInt8[ 256 ]);
2083 aColParam.pMapB.reset(new sal_uInt8[ 256 ]);
2084
2085 // calculate slope
2086 if( nContrastPercent >= 0 )
2087 fM = 128.0 / ( 128.0 - 1.27 * MinMax( nContrastPercent, 0, 100 ) );
2088 else
2089 fM = ( 128.0 + 1.27 * MinMax( nContrastPercent, -100, 0 ) ) / 128.0;
2090
2091 if(!msoBrightness)
2092 // total offset = luminance offset + contrast offset
2093 fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55 + 128.0 - fM * 128.0;
2094 else
2095 fOff = MinMax( nLuminancePercent, -100, 100 ) * 2.55;
2096
2097 // channel offset = channel offset + total offset
2098 fROff = nChannelRPercent * 2.55 + fOff;
2099 fGOff = nChannelGPercent * 2.55 + fOff;
2100 fBOff = nChannelBPercent * 2.55 + fOff;
2101
2102 // calculate gamma value
2103 fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
2104 const bool bGamma = ( fGamma != 1.0 );
2105
2106 // create mapping table
2107 for( tools::Long nX = 0; nX < 256; nX++ )
2108 {
2109 if(!msoBrightness)
2110 {
2111 aColParam.pMapR[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( nX * fM + fROff ), 0, 255 ));
2112 aColParam.pMapG[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( nX * fM + fGOff ), 0, 255 ));
2113 aColParam.pMapB[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( nX * fM + fBOff ), 0, 255 ));
2114 }
2115 else
2116 {
2117 aColParam.pMapR[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( (nX+fROff/2-128) * fM + 128 + fROff/2 ), 0, 255 ));
2118 aColParam.pMapG[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( (nX+fGOff/2-128) * fM + 128 + fGOff/2 ), 0, 255 ));
2119 aColParam.pMapB[ nX ] = static_cast<sal_uInt8>(MinMax( FRound( (nX+fBOff/2-128) * fM + 128 + fBOff/2 ), 0, 255 ));
2120 }
2121 if( bGamma )
2122 {
2123 aColParam.pMapR[ nX ] = GAMMA( aColParam.pMapR[ nX ], fGamma );
2124 aColParam.pMapG[ nX ] = GAMMA( aColParam.pMapG[ nX ], fGamma );
2125 aColParam.pMapB[ nX ] = GAMMA( aColParam.pMapB[ nX ], fGamma );
2126 }
2127
2128 if( bInvert )
2129 {
2130 aColParam.pMapR[ nX ] = ~aColParam.pMapR[ nX ];
2131 aColParam.pMapG[ nX ] = ~aColParam.pMapG[ nX ];
2132 aColParam.pMapB[ nX ] = ~aColParam.pMapB[ nX ];
2133 }
2134 }
2135
2136 aBmpParam.nLuminancePercent = nLuminancePercent;
2137 aBmpParam.nContrastPercent = nContrastPercent;
2138 aBmpParam.nChannelRPercent = nChannelRPercent;
2139 aBmpParam.nChannelGPercent = nChannelGPercent;
2140 aBmpParam.nChannelBPercent = nChannelBPercent;
2141 aBmpParam.fGamma = fGamma;
2142 aBmpParam.bInvert = bInvert;
2143
2144 // do color adjustment
2145 ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
2146}
2147
2149{
2150 ImplColConvertParam aColParam;
2151 ImplBmpConvertParam aBmpParam;
2152
2153 aColParam.eConversion = eConversion;
2154 aBmpParam.eConversion = ( MtfConversion::N1BitThreshold == eConversion ) ? BmpConversion::N1BitThreshold : BmpConversion::N8BitGreys;
2155
2156 ImplExchangeColors( ImplColConvertFnc, &aColParam, ImplBmpConvertFnc, &aBmpParam );
2157}
2158
2159void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pReplaceColors, sal_uLong nColorCount )
2160{
2161 ImplColReplaceParam aColParam;
2162 ImplBmpReplaceParam aBmpParam;
2163
2164 aColParam.pMinR.reset(new sal_uLong[ nColorCount ]);
2165 aColParam.pMaxR.reset(new sal_uLong[ nColorCount ]);
2166 aColParam.pMinG.reset(new sal_uLong[ nColorCount ]);
2167 aColParam.pMaxG.reset(new sal_uLong[ nColorCount ]);
2168 aColParam.pMinB.reset(new sal_uLong[ nColorCount ]);
2169 aColParam.pMaxB.reset(new sal_uLong[ nColorCount ]);
2170
2171 for( sal_uLong i = 0; i < nColorCount; i++ )
2172 {
2173 tools::Long nVal;
2174
2175 nVal = pSearchColors[ i ].GetRed();
2176 aColParam.pMinR[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) ));
2177 aColParam.pMaxR[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) ));
2178
2179 nVal = pSearchColors[ i ].GetGreen();
2180 aColParam.pMinG[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) ));
2181 aColParam.pMaxG[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) ));
2182
2183 nVal = pSearchColors[ i ].GetBlue();
2184 aColParam.pMinB[ i ] = static_cast<sal_uLong>(std::max( nVal, tools::Long(0) ));
2185 aColParam.pMaxB[ i ] = static_cast<sal_uLong>(std::min( nVal, tools::Long(255) ));
2186 }
2187
2188 aColParam.pDstCols = pReplaceColors;
2189 aColParam.nCount = nColorCount;
2190
2191 aBmpParam.pSrcCols = pSearchColors;
2192 aBmpParam.pDstCols = pReplaceColors;
2193 aBmpParam.nCount = nColorCount;
2194
2195 ImplExchangeColors( ImplColReplaceFnc, &aColParam, ImplBmpReplaceFnc, &aBmpParam );
2196};
2197
2199{
2200 GDIMetaFile aRet( *this );
2201
2202 ImplColMonoParam aColParam;
2203 ImplBmpMonoParam aBmpParam;
2204
2205 aColParam.aColor = rColor;
2206 aBmpParam.aColor = rColor;
2207
2208 aRet.ImplExchangeColors( ImplColMonoFnc, &aColParam, ImplBmpMonoFnc, &aBmpParam );
2209
2210 return aRet;
2211}
2212
2214{
2215 sal_uLong nSizeBytes = 0;
2216
2217 for( size_t i = 0, nObjCount = GetActionSize(); i < nObjCount; ++i )
2218 {
2219 MetaAction* pAction = GetAction( i );
2220
2221 // default action size is set to 32 (=> not the exact value)
2222 nSizeBytes += 32;
2223
2224 // add sizes for large action content
2225 switch( pAction->GetType() )
2226 {
2227 case MetaActionType::BMP: nSizeBytes += static_cast<MetaBmpAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2228 case MetaActionType::BMPSCALE: nSizeBytes += static_cast<MetaBmpScaleAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2229 case MetaActionType::BMPSCALEPART: nSizeBytes += static_cast<MetaBmpScalePartAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2230
2231 case MetaActionType::BMPEX: nSizeBytes += static_cast<MetaBmpExAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
2232 case MetaActionType::BMPEXSCALE: nSizeBytes += static_cast<MetaBmpExScaleAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
2233 case MetaActionType::BMPEXSCALEPART: nSizeBytes += static_cast<MetaBmpExScalePartAction*>( pAction )->GetBitmapEx().GetSizeBytes(); break;
2234
2235 case MetaActionType::MASK: nSizeBytes += static_cast<MetaMaskAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2236 case MetaActionType::MASKSCALE: nSizeBytes += static_cast<MetaMaskScaleAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2237 case MetaActionType::MASKSCALEPART: nSizeBytes += static_cast<MetaMaskScalePartAction*>( pAction )->GetBitmap().GetSizeBytes(); break;
2238
2239 case MetaActionType::POLYLINE: nSizeBytes += static_cast<MetaPolyLineAction*>( pAction )->GetPolygon().GetSize() * sizeof( Point ); break;
2240 case MetaActionType::POLYGON: nSizeBytes += static_cast<MetaPolygonAction*>( pAction )->GetPolygon().GetSize() * sizeof( Point ); break;
2242 {
2243 const tools::PolyPolygon& rPolyPoly = static_cast<MetaPolyPolygonAction*>( pAction )->GetPolyPolygon();
2244
2245 for( sal_uInt16 n = 0; n < rPolyPoly.Count(); ++n )
2246 nSizeBytes += ( rPolyPoly[ n ].GetSize() * sizeof( Point ) );
2247 }
2248 break;
2249
2250 case MetaActionType::TEXT: nSizeBytes += static_cast<MetaTextAction*>( pAction )->GetText().getLength() * sizeof( sal_Unicode ); break;
2251 case MetaActionType::STRETCHTEXT: nSizeBytes += static_cast<MetaStretchTextAction*>( pAction )->GetText().getLength() * sizeof( sal_Unicode ); break;
2252 case MetaActionType::TEXTRECT: nSizeBytes += static_cast<MetaTextRectAction*>( pAction )->GetText().getLength() * sizeof( sal_Unicode ); break;
2254 {
2255 MetaTextArrayAction* pTextArrayAction = static_cast<MetaTextArrayAction*>(pAction);
2256
2257 nSizeBytes += ( pTextArrayAction->GetText().getLength() * sizeof( sal_Unicode ) );
2258
2259 if( !pTextArrayAction->GetDXArray().empty() )
2260 nSizeBytes += ( pTextArrayAction->GetLen() << 2 );
2261 }
2262 break;
2263 default: break;
2264 }
2265 }
2266
2267 return nSizeBytes;
2268}
2269
2270bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConversion, BmpScaleFlag nScaleFlag) const
2271{
2272 // initialization seems to be complicated but is used to avoid rounding errors
2274 // set Enable to tease the rendering down the code paths which use B2DPolygon and
2275 // avoid integer overflows on scaling tools::Polygon, e.g. moz1545040-1.svg
2276 // note: this is similar to DocumentToGraphicRenderer::renderToGraphic
2277 aVDev->SetAntialiasing(AntialiasingFlags::Enable | aVDev->GetAntialiasing());
2278 const Point aNullPt;
2279 const Point aTLPix( aVDev->LogicToPixel( aNullPt, GetPrefMapMode() ) );
2280 const Point aBRPix( aVDev->LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) );
2281 Size aDrawSize( aVDev->LogicToPixel( GetPrefSize(), GetPrefMapMode() ) );
2282 Size aSizePix( std::abs( aBRPix.X() - aTLPix.X() ) + 1, std::abs( aBRPix.Y() - aTLPix.Y() ) + 1 );
2283 sal_uInt32 nMaximumExtent = 512;
2284
2285 if (!rBitmapEx.IsEmpty())
2286 rBitmapEx.SetEmpty();
2287
2288 // determine size that has the same aspect ratio as image size and
2289 // fits into the rectangle determined by nMaximumExtent
2290 if ( aSizePix.Width() && aSizePix.Height()
2291 && ( sal::static_int_cast< tools::ULong >(aSizePix.Width()) >
2292 nMaximumExtent ||
2293 sal::static_int_cast< tools::ULong >(aSizePix.Height()) >
2294 nMaximumExtent ) )
2295 {
2296 const Size aOldSizePix( aSizePix );
2297 double fWH = static_cast< double >( aSizePix.Width() ) / aSizePix.Height();
2298
2299 if ( fWH <= 1.0 )
2300 {
2301 aSizePix.setWidth( FRound( nMaximumExtent * fWH ) );
2302 aSizePix.setHeight( nMaximumExtent );
2303 }
2304 else
2305 {
2306 aSizePix.setWidth( nMaximumExtent );
2307 aSizePix.setHeight( FRound( nMaximumExtent / fWH ) );
2308 }
2309
2310 aDrawSize.setWidth( FRound( ( static_cast< double >( aDrawSize.Width() ) * aSizePix.Width() ) / aOldSizePix.Width() ) );
2311 aDrawSize.setHeight( FRound( ( static_cast< double >( aDrawSize.Height() ) * aSizePix.Height() ) / aOldSizePix.Height() ) );
2312 }
2313
2314 // draw image(s) into VDev and get resulting image
2315 // do it 4x larger to be able to scale it down & get beautiful antialias
2316 Size aAntialiasSize(aSizePix.Width() * 4, aSizePix.Height() * 4);
2317 if (aVDev->SetOutputSizePixel(aAntialiasSize))
2318 {
2319 // antialias: provide 4x larger size, and then scale down the result
2320 Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4);
2321
2322 // draw metafile into VDev
2323 const_cast<GDIMetaFile *>(this)->WindStart();
2324 const_cast<GDIMetaFile *>(this)->Play(*aVDev, Point(), aAntialias);
2325
2326 // get paint bitmap
2327 BitmapEx aBitmap( aVDev->GetBitmapEx( aNullPt, aVDev->GetOutputSizePixel() ) );
2328
2329 // scale down the image to the desired size - use the input scaler for the scaling operation
2330 aBitmap.Scale(aDrawSize, nScaleFlag);
2331
2332 // convert to desired bitmap color format
2333 Size aSize(aBitmap.GetSizePixel());
2334 if (aSize.Width() && aSize.Height())
2335 aBitmap.Convert(eColorConversion);
2336
2337 rBitmapEx = aBitmap;
2338 }
2339
2340 return !rBitmapEx.IsEmpty();
2341}
2342
2343void GDIMetaFile::UseCanvas( bool _bUseCanvas )
2344{
2345 m_bUseCanvas = _bUseCanvas;
2346}
2347
2348void GDIMetaFile::dumpAsXml(const char* pFileName) const
2349{
2350 SvFileStream aStream(pFileName ? OUString::fromUtf8(pFileName) : OUString("file:///tmp/metafile.xml"),
2351 StreamMode::STD_READWRITE | StreamMode::TRUNC);
2352 assert(aStream.good());
2353 MetafileXmlDump aDumper;
2354 aDumper.dump(*this, aStream);
2355}
2356
2357/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool TooLargeScaleForMapMode(const Fraction &rScale, int nDPI)
static vcl::Window * GetActiveTopWindow()
Get the "active" top window.
Definition: svapp.cxx:1105
static vcl::Window * GetFirstTopLevelWindow()
Get the first top-level window of the application.
Definition: svapp.cxx:1061
const AlphaMask & GetAlphaMask() const
Definition: bitmapex.hxx:71
sal_Int64 GetSizeBytes() const
Definition: BitmapEx.cxx:229
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
Definition: BitmapEx.cxx:305
bool Convert(BmpConversion eConversion)
Convert bitmap format.
Definition: BitmapEx.cxx:383
bool IsAlpha() const
Definition: BitmapEx.cxx:207
bool Rotate(Degree10 nAngle10, const Color &rFillColor)
Rotate bitmap by the specified angle.
Definition: BitmapEx.cxx:325
bool IsEmpty() const
Definition: BitmapEx.cxx:186
void Replace(const Color &rSearchColor, const Color &rReplaceColor)
Replace all pixel having the search color with the specified color.
Definition: BitmapEx.cxx:482
bool Create(const css::uno::Reference< css::rendering::XBitmapCanvas > &xBitmapCanvas, const Size &rSize)
populate from a canvas implementation
Definition: BitmapEx.cxx:622
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
Definition: BitmapEx.cxx:363
bool Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma=1.0, bool bInvert=false, bool msoBrightness=false)
Change various global color characteristics.
Definition: BitmapEx.cxx:494
const Size & GetSizePixel() const
Definition: bitmapex.hxx:73
void SetEmpty()
Definition: BitmapEx.cxx:191
Size GetSizePixel() const
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: bitmappaint.cxx:34
sal_uInt8 GetLuminance() const
sal_uInt8 GetBlue() const
sal_uInt8 GetAlpha() const
sal_uInt8 GetRed() const
sal_uInt8 GetGreen() const
void ReduceInaccurate(unsigned nSignificantBits)
bool m_bPause
Definition: gdimtf.hxx:66
bool HasTransparentActions() const
Definition: gdimtf.cxx:156
GDIMetaFile & operator=(const GDIMetaFile &rMtf)
Definition: gdimtf.cxx:213
size_t GetActionSize() const
Definition: gdimtf.cxx:181
static SAL_DLLPRIVATE tools::Polygon ImplGetRotatedPolygon(const tools::Polygon &rPoly, const Point &rRotatePt, const Size &rOffset, double fSin, double fCos)
Definition: gdimtf.cxx:802
static SAL_DLLPRIVATE BitmapEx ImplBmpConvertFnc(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition: gdimtf.cxx:1753
void Move(tools::Long nX, tools::Long nY)
Definition: gdimtf.cxx:653
void WindStart()
Definition: gdimtf.cxx:572
void Scale(double fScaleX, double fScaleY)
Definition: gdimtf.cxx:748
static SAL_DLLPRIVATE Color ImplColConvertFnc(const Color &rColor, const void *pColParam)
Definition: gdimtf.cxx:1743
SAL_DLLPRIVATE void ImplExchangeColors(ColorExchangeFnc pFncCol, const void *pColParam, BmpExchangeFnc pFncBmp, const void *pBmpParam)
Definition: gdimtf.cxx:1813
bool m_bUseCanvas
Definition: gdimtf.hxx:68
size_t m_nCurrentActionElement
Definition: gdimtf.hxx:59
void push_back(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:612
void Stop()
Definition: gdimtf.cxx:559
void Clip(const tools::Rectangle &)
Definition: gdimtf.cxx:761
static SAL_DLLPRIVATE BitmapEx ImplBmpAdjustFnc(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition: gdimtf.cxx:1731
~GDIMetaFile()
Definition: gdimtf.cxx:151
void Pause(bool bPause)
Definition: gdimtf.cxx:540
const Size & GetPrefSize() const
Definition: gdimtf.hxx:176
tools::Rectangle GetBoundRect(OutputDevice &i_rReference) const
Definition: gdimtf.cxx:1322
void Rotate(Degree10 nAngle10)
Definition: gdimtf.cxx:846
void Mirror(BmpMirrorFlags nMirrorFlags)
Definition: gdimtf.cxx:617
bool IsRecord() const
Definition: gdimtf.hxx:146
MetaAction * GetAction(size_t nAction) const
Definition: gdimtf.cxx:186
MetaAction * GetCurAction() const
Definition: gdimtf.hxx:174
static SAL_DLLPRIVATE BitmapEx ImplBmpReplaceFnc(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition: gdimtf.cxx:1803
GDIMetaFile * m_pNext
Definition: gdimtf.hxx:64
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:585
static SAL_DLLPRIVATE Point ImplGetRotatedPoint(const Point &rPt, const Point &rRotatePt, const Size &rOffset, double fSin, double fCos)
Definition: gdimtf.cxx:792
GDIMetaFile * m_pPrev
Definition: gdimtf.hxx:63
void UseCanvas(bool _bUseCanvas)
Definition: gdimtf.cxx:2343
::std::vector< rtl::Reference< MetaAction > > m_aList
Definition: gdimtf.hxx:58
sal_uLong GetSizeBytes() const
Definition: gdimtf.cxx:2213
void setSVG(bool bNew)
Definition: gdimtf.hxx:195
static SAL_DLLPRIVATE tools::PolyPolygon ImplGetRotatedPolyPolygon(const tools::PolyPolygon &rPoly, const Point &rRotatePt, const Size &rOffset, double fSin, double fCos)
Definition: gdimtf.cxx:813
MetaAction * NextAction()
Definition: gdimtf.cxx:197
VclPtr< OutputDevice > m_pOutDev
Definition: gdimtf.hxx:65
bool operator==(const GDIMetaFile &rMtf) const
Definition: gdimtf.cxx:247
void Clear()
Definition: gdimtf.cxx:273
void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent=0, short nChannelGPercent=0, short nChannelBPercent=0, double fGamma=1.0, bool bInvert=false, bool msoBrightness=false)
Definition: gdimtf.cxx:2067
void Convert(MtfConversion eConversion)
Definition: gdimtf.cxx:2148
MetaAction * FirstAction()
Definition: gdimtf.cxx:191
bool m_bSVG
Definition: gdimtf.hxx:71
static SAL_DLLPRIVATE void ImplAddGradientEx(GDIMetaFile &rMtf, const OutputDevice &rMapDev, const tools::PolyPolygon &rPolyPoly, const Gradient &rGrad)
Definition: gdimtf.cxx:824
static SAL_DLLPRIVATE Color ImplColReplaceFnc(const Color &rColor, const void *pColParam)
Definition: gdimtf.cxx:1783
void ScaleActions(double fScaleX, double fScaleY)
Definition: gdimtf.cxx:730
GDIMetaFile GetMonochromeMtf(const Color &rCol) const
Definition: gdimtf.cxx:2198
bool getSVG() const
Definition: gdimtf.hxx:194
void Play(GDIMetaFile &rMtf)
Definition: gdimtf.cxx:325
bool GetUseCanvas() const
Definition: gdimtf.hxx:191
void ReplaceColors(const Color *pSearchColors, const Color *rReplaceColors, sal_uLong nColorCount)
Definition: gdimtf.cxx:2159
void dumpAsXml(const char *pFileName=nullptr) const
Dumps the meta actions as XML in metafile.xml.
Definition: gdimtf.cxx:2348
void Record(OutputDevice *pOutDev)
Definition: gdimtf.cxx:314
static SAL_DLLPRIVATE Color ImplColMonoFnc(const Color &rColor, const void *pColParam)
Definition: gdimtf.cxx:1762
bool CreateThumbnail(BitmapEx &rBitmapEx, BmpConversion nColorConversion=BmpConversion::N24Bit, BmpScaleFlag nScaleFlag=BmpScaleFlag::BestQuality) const
Creates an antialiased thumbnail.
Definition: gdimtf.cxx:2270
MapMode m_aPrefMapMode
Definition: gdimtf.hxx:61
void ReplaceAction(rtl::Reference< MetaAction > pAction, size_t nAction)
Definition: gdimtf.cxx:202
void WindPrev()
Definition: gdimtf.cxx:578
Size m_aPrefSize
Definition: gdimtf.hxx:62
bool m_bRecord
Definition: gdimtf.hxx:67
void Linker(OutputDevice *pOut, bool bLink)
Definition: gdimtf.cxx:281
const MapMode & GetPrefMapMode() const
Definition: gdimtf.hxx:179
static SAL_DLLPRIVATE BitmapEx ImplBmpMonoFnc(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition: gdimtf.cxx:1767
void SetPrefSize(const Size &rSize)
Definition: gdimtf.hxx:177
SAL_DLLPRIVATE bool ImplPlayWithRenderer(OutputDevice &rOut, const Point &rPos, Size rLogicDestSize)
Definition: gdimtf.cxx:391
static SAL_DLLPRIVATE Color ImplColAdjustFnc(const Color &rColor, const void *pColParam)
Definition: gdimtf.cxx:1722
const Color & GetEndColor() const
const Color & GetStartColor() const
void SetStartColor(const Color &rColor)
void SetEndColor(const Color &rColor)
Definition: hatch.hxx:47
void SetAngle(Degree10 nAngle10)
Definition: gdi/hatch.cxx:74
Degree10 GetAngle() const
Definition: hatch.hxx:68
void SetColor(const Color &rColor)
Definition: gdi/hatch.cxx:64
const Color & GetColor() const
Definition: hatch.hxx:62
bool empty() const
Definition: kernarray.hxx:74
void SetOrigin(const Point &rOrigin)
Definition: mapmod.cxx:138
void SetScaleY(const Fraction &rScaleY)
Definition: mapmod.cxx:150
const Fraction & GetScaleX() const
Definition: mapmod.cxx:185
MapUnit GetMapUnit() const
Definition: mapmod.cxx:181
const Fraction & GetScaleY() const
Definition: mapmod.cxx:187
void SetScaleX(const Fraction &rScaleX)
Definition: mapmod.cxx:144
virtual bool IsTransparent() const
#i10613# Extracted from Printer::GetPreparedMetaFile.
Definition: metaact.hxx:100
MetaActionType GetType() const
Definition: metaact.hxx:96
virtual void Execute(OutputDevice *pOut)
Definition: metaact.cxx:99
virtual void Scale(double fScaleX, double fScaleY)
Definition: metaact.cxx:112
virtual void Move(tools::Long nHorzMove, tools::Long nVertMove)
Definition: metaact.cxx:108
const Point & GetStartPoint() const
Definition: metaact.hxx:308
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:307
const Point & GetEndPoint() const
Definition: metaact.hxx:309
const Bitmap & GetBitmap() const
Definition: metaact.hxx:693
const Point & GetPoint() const
Definition: metaact.hxx:694
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:798
const Point & GetPoint() const
Definition: metaact.hxx:799
const Size & GetSize() const
Definition: metaact.hxx:833
const Point & GetPoint() const
Definition: metaact.hxx:832
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:831
const Point & GetSrcPoint() const
Definition: metaact.hxx:872
const Size & GetDestSize() const
Definition: metaact.hxx:871
const Point & GetDestPoint() const
Definition: metaact.hxx:870
const Size & GetSrcSize() const
Definition: metaact.hxx:873
const BitmapEx & GetBitmapEx() const
Definition: metaact.hxx:869
const Point & GetPoint() const
Definition: metaact.hxx:726
const Size & GetSize() const
Definition: metaact.hxx:727
const Bitmap & GetBitmap() const
Definition: metaact.hxx:725
const Bitmap & GetBitmap() const
Definition: metaact.hxx:762
const Point & GetDestPoint() const
Definition: metaact.hxx:763
const Point & GetSrcPoint() const
Definition: metaact.hxx:765
const Size & GetSrcSize() const
Definition: metaact.hxx:766
const Size & GetDestSize() const
Definition: metaact.hxx:764
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:375
const Point & GetStartPoint() const
Definition: metaact.hxx:376
const Point & GetEndPoint() const
Definition: metaact.hxx:377
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1142
bool IsClipping() const
Definition: metaact.hxx:1143
const sal_uInt8 * GetData() const
Definition: metaact.hxx:1712
const OString & GetComment() const
Definition: metaact.hxx:1709
sal_uInt32 GetDataSize() const
Definition: metaact.hxx:1711
const GDIMetaFile & GetSubstitute() const
Definition: metaact.hxx:1647
const Point & GetPoint() const
Definition: metaact.hxx:1648
const Size & GetSize() const
Definition: metaact.hxx:1649
const GfxLink & GetLink() const
Definition: metaact.hxx:1646
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:277
const Color & GetColor() const
Definition: metaact.hxx:1279
bool IsSetting() const
Definition: metaact.hxx:1280
const Gradient & GetGradient() const
Definition: metaact.hxx:1606
const Size & GetSize() const
Definition: metaact.hxx:1605
const GDIMetaFile & GetGDIMetaFile() const
Definition: metaact.hxx:1603
const Point & GetPoint() const
Definition: metaact.hxx:1604
const vcl::Font & GetFont() const
Definition: metaact.hxx:1472
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1022
const Gradient & GetGradient() const
Definition: metaact.hxx:1023
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1052
const Gradient & GetGradient() const
Definition: metaact.hxx:1053
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1082
const Hatch & GetHatch() const
Definition: metaact.hxx:1083
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1171
const vcl::Region & GetRegion() const
Definition: metaact.hxx:1198
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:187
const Point & GetEndPoint() const
Definition: metaact.hxx:186
const Point & GetStartPoint() const
Definition: metaact.hxx:185
bool IsSetting() const
Definition: metaact.hxx:1253
const Color & GetColor() const
Definition: metaact.hxx:1252
const Point & GetPoint() const
Definition: metaact.hxx:911
const Bitmap & GetBitmap() const
Definition: metaact.hxx:909
const Bitmap & GetBitmap() const
Definition: metaact.hxx:944
const Point & GetPoint() const
Definition: metaact.hxx:946
const Color & GetColor() const
Definition: metaact.hxx:945
const Size & GetSize() const
Definition: metaact.hxx:947
const Bitmap & GetBitmap() const
Definition: metaact.hxx:984
const Point & GetSrcPoint() const
Definition: metaact.hxx:988
const Color & GetColor() const
Definition: metaact.hxx:985
const Size & GetSrcSize() const
Definition: metaact.hxx:989
const Point & GetDestPoint() const
Definition: metaact.hxx:986
const Size & GetDestSize() const
Definition: metaact.hxx:987
tools::Long GetVertMove() const
Definition: metaact.hxx:1226
tools::Long GetHorzMove() const
Definition: metaact.hxx:1225
const Color & GetColor() const
Definition: metaact.hxx:1386
bool IsSetting() const
Definition: metaact.hxx:1389
const Point & GetEndPoint() const
Definition: metaact.hxx:343
const Point & GetStartPoint() const
Definition: metaact.hxx:342
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:341
const Point & GetPoint() const
Definition: metaact.hxx:126
const Color & GetColor() const
Definition: metaact.hxx:127
const Point & GetPoint() const
Definition: metaact.hxx:154
const LineInfo & GetLineInfo() const
Definition: metaact.hxx:409
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:408
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:464
const tools::Polygon & GetPolygon() const
Definition: metaact.hxx:437
vcl::PushFlags GetFlags() const
Definition: metaact.hxx:1497
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:216
bool IsSetting() const
Definition: metaact.hxx:1680
const Point & GetRefPoint() const
Definition: metaact.hxx:1677
sal_uInt32 GetHorzRound() const
Definition: metaact.hxx:247
sal_uInt32 GetVertRound() const
Definition: metaact.hxx:248
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:246
sal_uInt32 GetWidth() const
Definition: metaact.hxx:584
sal_Int32 GetLen() const
Definition: metaact.hxx:586
sal_Int32 GetIndex() const
Definition: metaact.hxx:585
const OUString & GetText() const
Definition: metaact.hxx:583
const Point & GetPoint() const
Definition: metaact.hxx:582
const Point & GetPoint() const
Definition: metaact.hxx:495
sal_Int32 GetLen() const
Definition: metaact.hxx:498
const OUString & GetText() const
Definition: metaact.hxx:496
sal_Int32 GetIndex() const
Definition: metaact.hxx:497
sal_Int32 GetIndex() const
Definition: metaact.hxx:541
const KernArray & GetDXArray() const
Definition: metaact.hxx:543
sal_Int32 GetLen() const
Definition: metaact.hxx:542
const OUString & GetText() const
Definition: metaact.hxx:540
const Point & GetPoint() const
Definition: metaact.hxx:539
const std::vector< sal_Bool > & GetKashidaArray() const
Definition: metaact.hxx:544
const Color & GetColor() const
Definition: metaact.hxx:1306
bool IsSetting() const
Definition: metaact.hxx:1334
const Color & GetColor() const
Definition: metaact.hxx:1331
const Point & GetStartPoint() const
Definition: metaact.hxx:657
tools::Long GetWidth() const
Definition: metaact.hxx:658
FontLineStyle GetUnderline() const
Definition: metaact.hxx:660
FontLineStyle GetOverline() const
Definition: metaact.hxx:661
FontStrikeout GetStrikeout() const
Definition: metaact.hxx:659
bool IsSetting() const
Definition: metaact.hxx:1362
const Color & GetColor() const
Definition: metaact.hxx:1359
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:620
sal_uInt16 GetTransparence() const
Definition: metaact.hxx:1566
const tools::PolyPolygon & GetPolyPolygon() const
Definition: metaact.hxx:1565
const Wallpaper & GetWallpaper() const
Definition: metaact.hxx:1114
const tools::Rectangle & GetRect() const
Definition: metaact.hxx:1113
Class that is used for testing of the decomposition into shapes.
Definition: mtfxmldump.hxx:45
void dump(const GDIMetaFile &rMetaFile, SvStream &rStream)
The actual result that will be used for testing.
Definition: mtfxmldump.cxx:632
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
Size GetOutputSize() const
Definition: outdev.hxx:327
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
Get the output device's DPI x-axis value.
Definition: outdev.hxx:385
GDIMetaFile * GetConnectMetaFile() const
Definition: outdev.hxx:285
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
Definition: bitmapex.cxx:33
SAL_WARN_UNUSED_RESULT Size GetPixelOffset() const
Get the offset in pixel.
Definition: outdev.hxx:1601
virtual void SetMetafileMapMode(const MapMode &rNewMapMode, bool bIsRecord)
Definition: map.cxx:711
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
Definition: outdev.hxx:391
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1110
Size GetOutputSizePixel() const
Definition: outdev.hxx:314
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: map.cxx:1580
void SetPixelOffset(const Size &rOffset)
Set an offset in pixel.
Definition: map.cxx:1822
void SetDigitLanguage(LanguageType)
Definition: text.cxx:71
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
virtual size_t GetSyncCount() const
Definition: outdev.hxx:335
const MapMode & GetMapMode() const
Definition: outdev.hxx:1557
virtual void Flush()
Definition: outdev.hxx:429
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
void Pop()
Definition: stack.cxx:91
css::uno::Reference< css::rendering::XCanvas > GetCanvas() const
request XCanvas render interface
Definition: outdev.cxx:746
void SetLayoutMode(vcl::text::ComplexTextLayoutFlags nTextLayoutMode)
Definition: text.cxx:60
virtual vcl::Window * GetOwnerWindow() const
Get the vcl::Window that this OutputDevice belongs to, if any.
Definition: outdev.hxx:1897
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const void * GetData()
sal_uInt64 Tell() const
bool good() const
Encapsulates geometry and associated attributes of a filled area.
void getPath(tools::PolyPolygon &) const
Query path to fill.
void setPath(const tools::PolyPolygon &rPath)
Set path to fill.
Encapsulates geometry and associated attributes of a graphical 'pen stroke'.
void getPath(tools::Polygon &) const
Query path to stroke.
void setPath(const tools::Polygon &)
Set path to stroke.
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
const BitmapEx & GetBitmap() const
Definition: wall.cxx:184
const Color & GetColor() const
Definition: wall.hxx:71
void SetGradient(const Gradient &rGradient)
Definition: wall.cxx:194
bool IsBitmap() const
Definition: wall.cxx:189
void SetBitmap(const BitmapEx &rBitmap)
Definition: wall.cxx:175
bool IsGradient() const
Definition: wall.cxx:213
Gradient GetGradient() const
Definition: wall.cxx:203
void SetColor(const Color &rColor)
Definition: wall.cxx:156
sal_uInt16 Count() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Rotate(const Point &rCenter, double fSin, double fCos)
tools::Rectangle GetBoundRect() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
tools::Rectangle GetBoundRect() const
void Rotate(const Point &rCenter, double fSin, double fCos)
constexpr Point Center() const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long GetHeight() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
constexpr tools::Long Left() const
constexpr bool IsEmpty() const
void SetOrientation(Degree10 nLineOrientation)
Definition: font/font.cxx:197
void SetFillColor(const Color &)
Definition: font/font.cxx:115
void SetColor(const Color &)
Definition: font/font.cxx:107
const Color & GetColor() const
Definition: font/font.cxx:898
Degree10 GetOrientation() const
Definition: font/font.cxx:920
const Color & GetFillColor() const
Definition: font/font.cxx:899
tools::PolyPolygon GetAsPolyPolygon() const
Definition: region.cxx:1266
void Intersect(const tools::Rectangle &rRegion)
Definition: region.cxx:583
bool HasPolyPolygonOrB2DPolyPolygon() const
Definition: region.hxx:107
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1219
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
ColorAlpha
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
double toRadians(D x)
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
static void ImplActionBounds(tools::Rectangle &o_rOutBounds, const tools::Rectangle &i_rInBounds, const std::vector< tools::Rectangle > &i_rClipStack)
Definition: gdimtf.cxx:1306
Color(* ColorExchangeFnc)(const Color &rColor, const void *pColParam)
Definition: gdimtf.hxx:52
BitmapEx(* BmpExchangeFnc)(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition: gdimtf.hxx:53
MtfConversion
Definition: gdimtf.hxx:46
SvStream & WriteSvtGraphicFill(SvStream &rOStm, const SvtGraphicFill &rClass)
SvStream & ReadSvtGraphicStroke(SvStream &rIStm, SvtGraphicStroke &rClass)
SvStream & ReadSvtGraphicFill(SvStream &rIStm, SvtGraphicFill &rClass)
SvStream & WriteSvtGraphicStroke(SvStream &rOStm, const SvtGraphicStroke &rClass)
tools::Long FRound(double fVal)
std::enable_if< std::is_signed< T >::value||std::is_floating_point< T >::value, long >::type MinMax(T nVal, tools::Long nMin, tools::Long nMax)
BmpMirrorFlags
#define GAMMA(_def_cVal, _def_InvGamma)
void * p
sal_Int64 n
uno_Any a
#define LANGUAGE_SYSTEM
sal_uInt16 nPos
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
MetaActionType
aStr
Reference< XComponentContext > getProcessComponentContext()
int i
long Long
BitmapEx GetBitmapEx(BitmapEx const &rBitmapEx, DrawModeFlags nDrawMode)
Definition: drawmode.cxx:242
geometry::IntegerSize2D integerSize2DFromSize(const Size &rSize)
HashMap_OWString_Interface aMap
#define Y
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
oslFileHandle & pOut