LibreOffice Module vcl (master) 1
Animation.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 <algorithm>
21#include <sal/config.h>
22
23#include <tools/stream.hxx>
25#include <sal/log.hxx>
26
28#include <vcl/outdev.hxx>
29#include <vcl/dibtools.hxx>
31
33
35
37 : maTimer("vcl::Animation")
38 , mnLoopCount(0)
39 , mnLoops(0)
40 , mnFrameIndex(0)
41 , mbIsInAnimation(false)
42 , mbLoopTerminated(false)
43{
44 maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
45}
46
48 : maBitmapEx(rAnimation.maBitmapEx)
49 , maTimer("vcl::Animation")
50 , maGlobalSize(rAnimation.maGlobalSize)
51 , mnLoopCount(rAnimation.mnLoopCount)
52 , mnFrameIndex(rAnimation.mnFrameIndex)
53 , mbIsInAnimation(false)
54 , mbLoopTerminated(rAnimation.mbLoopTerminated)
55{
56 for (auto const& rFrame : rAnimation.maFrames)
57 maFrames.emplace_back(new AnimationFrame(*rFrame));
58
59 maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
61}
62
64{
66 Stop();
67}
68
70{
71 if (this != &rAnimation)
72 {
73 Clear();
74
75 for (auto const& i : rAnimation.maFrames)
76 maFrames.emplace_back(new AnimationFrame(*i));
77
78 maGlobalSize = rAnimation.maGlobalSize;
79 maBitmapEx = rAnimation.maBitmapEx;
80 mnLoopCount = rAnimation.mnLoopCount;
81 mnFrameIndex = rAnimation.mnFrameIndex;
84 }
85 return *this;
86}
87
88bool Animation::operator==(const Animation& rAnimation) const
89{
90 return maFrames.size() == rAnimation.maFrames.size() && maBitmapEx == rAnimation.maBitmapEx
91 && maGlobalSize == rAnimation.maGlobalSize
92 && std::equal(maFrames.begin(), maFrames.end(), rAnimation.maFrames.begin(),
93 [](const std::unique_ptr<AnimationFrame>& pAnim1,
94 const std::unique_ptr<AnimationFrame>& pAnim2) -> bool {
95 return *pAnim1 == *pAnim2;
96 });
97}
98
100{
101 maTimer.Stop();
102 mbIsInAnimation = false;
103 maGlobalSize = Size();
105 maFrames.clear();
106 maRenderers.clear();
107}
108
110{
112
113 // If some small bitmap needs to be replaced by the background,
114 // we need to be transparent, in order to be displayed correctly
115 // as the application (?) does not invalidate on non-transparent
116 // graphics due to performance reasons.
117
118 return maBitmapEx.IsAlpha()
119 || std::any_of(maFrames.begin(), maFrames.end(),
120 [&aRect](const std::unique_ptr<AnimationFrame>& pAnim) -> bool {
121 return pAnim->meDisposal == Disposal::Back
122 && tools::Rectangle{ pAnim->maPositionPixel,
123 pAnim->maSizePixel }
124 != aRect;
125 });
126}
127
129{
130 sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes();
131
132 for (auto const& pAnimationFrame : maFrames)
133 {
134 nSizeBytes += pAnimationFrame->maBitmapEx.GetSizeBytes();
135 }
136
137 return nSizeBytes;
138}
139
141{
142 SVBT32 aBT32;
145
146 UInt32ToSVBT32(maFrames.size(), aBT32);
147 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
148
149 Int32ToSVBT32(maGlobalSize.Width(), aBT32);
150 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
151
152 Int32ToSVBT32(maGlobalSize.Height(), aBT32);
153 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
154
155 for (auto const& i : maFrames)
156 {
157 BCToBCOA(i->GetChecksum(), aBCOA);
158 nCrc = vcl_get_checksum(nCrc, aBCOA, BITMAP_CHECKSUM_SIZE);
159 }
160
161 return nCrc;
162}
163
164bool Animation::Start(OutputDevice& rOut, const Point& rDestPt, const Size& rDestSz,
165 tools::Long nRendererId, OutputDevice* pFirstFrameOutDev)
166{
167 bool bRet = false;
168
169 if (!maFrames.empty())
170 {
173 {
174 bool differs = true;
175
176 auto itAnimView = std::find_if(
177 maRenderers.begin(), maRenderers.end(),
178 [&rOut, nRendererId](const std::unique_ptr<AnimationRenderer>& pRenderer) -> bool {
179 return pRenderer->matches(&rOut, nRendererId);
180 });
181
182 if (itAnimView != maRenderers.end())
183 {
184 if ((*itAnimView)->getOriginPosition() == rDestPt
185 && (*itAnimView)->getOutSizePix() == rOut.LogicToPixel(rDestSz))
186 {
187 (*itAnimView)->repaint();
188 differs = false;
189 }
190 else
191 {
192 maRenderers.erase(itAnimView);
193 }
194 }
195
196 if (maRenderers.empty())
197 {
198 maTimer.Stop();
199 mbIsInAnimation = false;
200 mnFrameIndex = 0;
201 }
202
203 if (differs)
204 maRenderers.emplace_back(new AnimationRenderer(this, &rOut, rDestPt, rDestSz,
205 nRendererId, pFirstFrameOutDev));
206
207 if (!mbIsInAnimation)
208 {
210 mbIsInAnimation = true;
211 }
212 }
213 else
214 Draw(rOut, rDestPt, rDestSz);
215
216 bRet = true;
217 }
218
219 return bRet;
220}
221
222void Animation::Stop(const OutputDevice* pOut, tools::Long nRendererId)
223{
224 maRenderers.erase(
225 std::remove_if(maRenderers.begin(), maRenderers.end(),
226 [=](const std::unique_ptr<AnimationRenderer>& pRenderer) -> bool {
227 return pRenderer->matches(pOut, nRendererId);
228 }),
229 maRenderers.end());
230
231 if (maRenderers.empty())
232 {
233 maTimer.Stop();
234 mbIsInAnimation = false;
235 }
236}
237
238void Animation::Draw(OutputDevice& rOut, const Point& rDestPt) const
239{
240 Draw(rOut, rDestPt, rOut.PixelToLogic(maGlobalSize));
241}
242
243void Animation::Draw(OutputDevice& rOut, const Point& rDestPt, const Size& rDestSz) const
244{
245 const size_t nCount = maFrames.size();
246
247 if (!nCount)
248 return;
249
250 AnimationFrame* pObj = maFrames[std::min(mnFrameIndex, nCount - 1)].get();
251
252 if (rOut.GetConnectMetaFile() || (rOut.GetOutDevType() == OUTDEV_PRINTER))
253 {
254 maFrames[0]->maBitmapEx.Draw(&rOut, rDestPt, rDestSz);
255 }
256 else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait)
257 {
258 pObj->maBitmapEx.Draw(&rOut, rDestPt, rDestSz);
259 }
260 else
261 {
262 const size_t nOldPos = mnFrameIndex;
264 const_cast<Animation*>(this)->mnFrameIndex = nCount - 1;
265
266 {
267 AnimationRenderer{ const_cast<Animation*>(this), &rOut, rDestPt, rDestSz, 0 };
268 }
269
270 const_cast<Animation*>(this)->mnFrameIndex = nOldPos;
271 }
272}
273
274namespace
275{
276constexpr sal_uLong constMinTimeout = 2;
277}
278
280{
281 maTimer.SetTimeout(std::max(nTimeout, constMinTimeout) * 10);
282 maTimer.Start();
283}
284
285std::vector<std::unique_ptr<AnimationData>> Animation::CreateAnimationDataItems()
286{
287 std::vector<std::unique_ptr<AnimationData>> aDataItems;
288
289 for (auto const& rItem : maRenderers)
290 {
291 aDataItems.emplace_back(rItem->createAnimationData());
292 }
293
294 return aDataItems;
295}
296
298{
299 for (auto& pDataItem : CreateAnimationDataItems())
300 {
301 AnimationRenderer* pRenderer = nullptr;
302 if (!pDataItem->mpRendererData)
303 {
304 pRenderer = new AnimationRenderer(this, pDataItem->mpRenderContext,
305 pDataItem->maOriginStartPt, pDataItem->maStartSize,
306 pDataItem->mnRendererId);
307
308 maRenderers.push_back(std::unique_ptr<AnimationRenderer>(pRenderer));
309 }
310 else
311 {
312 pRenderer = static_cast<AnimationRenderer*>(pDataItem->mpRendererData);
313 }
314
315 pRenderer->pause(pDataItem->mbIsPaused);
316 pRenderer->setMarked(true);
317 }
318}
319
321{
322 AnimationFrame* pCurrentFrameBmp
323 = (++mnFrameIndex < maFrames.size()) ? maFrames[mnFrameIndex].get() : nullptr;
324
325 if (!pCurrentFrameBmp)
326 {
327 if (mnLoops == 1)
328 {
329 Stop();
330 mbLoopTerminated = true;
331 mnFrameIndex = maFrames.size() - 1;
332 maBitmapEx = maFrames[mnFrameIndex]->maBitmapEx;
333 return;
334 }
335 else
336 {
337 if (mnLoops)
338 mnLoops--;
339
340 mnFrameIndex = 0;
341 pCurrentFrameBmp = maFrames[mnFrameIndex].get();
342 }
343 }
344
345 // Paint all views.
346 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
347 [this](const auto& pRenderer) { pRenderer->draw(mnFrameIndex); });
348 /*
349 * If a view is marked, remove the view, because
350 * area of output lies out of display area of window.
351 * Mark state is set from view itself.
352 */
353 auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
354 [](const auto& pRenderer) { return pRenderer->isMarked(); });
355 maRenderers.erase(removeStart, maRenderers.cend());
356
357 // stop or restart timer
358 if (maRenderers.empty())
359 Stop();
360 else
361 ImplRestartTimer(pCurrentFrameBmp->mnWait);
362}
363
365{
366 // delete all unmarked views
367 auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
368 [](const auto& pRenderer) { return !pRenderer->isMarked(); });
369 maRenderers.erase(removeStart, maRenderers.cend());
370
371 // reset marked state
372 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
373 [](const auto& pRenderer) { pRenderer->setMarked(false); });
374}
375
377{
378 return std::any_of(maRenderers.cbegin(), maRenderers.cend(),
379 [](const auto& pRenderer) { return !pRenderer->isPaused(); });
380}
381
382IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
383{
384 const size_t nAnimCount = maFrames.size();
385
386 if (nAnimCount)
387 {
388 bool bIsAnyRendererActive = true;
389
390 if (maNotifyLink.IsSet())
391 {
392 maNotifyLink.Call(this);
393 PopulateRenderers();
394 PruneMarkedRenderers();
395 bIsAnyRendererActive = IsAnyRendererActive();
396 }
397
398 if (maRenderers.empty())
399 Stop();
400 else if (!bIsAnyRendererActive)
401 ImplRestartTimer(10);
402 else
403 RenderNextFrameInAllRenderers();
404 }
405 else
406 {
407 Stop();
408 }
409}
410
412{
413 bool bRet = false;
414
415 if (!IsInAnimation())
416 {
417 tools::Rectangle aGlobalRect(Point(), maGlobalSize);
418
420 = aGlobalRect.Union(tools::Rectangle(rStepBmp.maPositionPixel, rStepBmp.maSizePixel))
421 .GetSize();
422 maFrames.emplace_back(new AnimationFrame(rStepBmp));
423
424 // As a start, we make the first BitmapEx the replacement BitmapEx
425 if (maFrames.size() == 1)
426 maBitmapEx = rStepBmp.maBitmapEx;
427
428 bRet = true;
429 }
430
431 return bRet;
432}
433
434const AnimationFrame& Animation::Get(sal_uInt16 nAnimation) const
435{
436 SAL_WARN_IF((nAnimation >= maFrames.size()), "vcl", "No object at this position");
437 return *maFrames[nAnimation];
438}
439
440void Animation::Replace(const AnimationFrame& rNewAnimationFrame, sal_uInt16 nAnimation)
441{
442 SAL_WARN_IF((nAnimation >= maFrames.size()), "vcl", "No object at this position");
443
444 maFrames[nAnimation].reset(new AnimationFrame(rNewAnimationFrame));
445
446 // If we insert at first position we also need to
447 // update the replacement BitmapEx
448 if ((!nAnimation && (!mbLoopTerminated || (maFrames.size() == 1)))
449 || ((nAnimation == maFrames.size() - 1) && mbLoopTerminated))
450 {
451 maBitmapEx = rNewAnimationFrame.maBitmapEx;
452 }
453}
454
455void Animation::SetLoopCount(const sal_uInt32 nLoopCount)
456{
457 mnLoopCount = nLoopCount;
459}
460
462{
464 mbLoopTerminated = false;
465}
466
468{
469 SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
470
471 bool bRet;
472
473 if (!IsInAnimation() && !maFrames.empty())
474 {
475 bRet = true;
476
477 for (size_t i = 0, n = maFrames.size(); (i < n) && bRet; ++i)
478 bRet = maFrames[i]->maBitmapEx.Convert(eConversion);
479
480 maBitmapEx.Convert(eConversion);
481 }
482}
483
484bool Animation::ReduceColors(sal_uInt16 nNewColorCount)
485{
486 SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
487
488 bool bRet;
489
490 if (!IsInAnimation() && !maFrames.empty())
491 {
492 bRet = true;
493
494 for (size_t i = 0, n = maFrames.size(); (i < n) && bRet; ++i)
495 {
497 BitmapColorQuantizationFilter(nNewColorCount));
498 }
499
501 }
502 else
503 {
504 bRet = false;
505 }
506
507 return bRet;
508}
509
511{
512 SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
513
514 bool bRet;
515
516 if (!IsInAnimation() && !maFrames.empty())
517 {
518 bRet = true;
519
520 for (size_t i = 0, n = maFrames.size(); (i < n) && bRet; ++i)
521 bRet = maFrames[i]->maBitmapEx.Invert();
522
524 }
525 else
526 bRet = false;
527
528 return bRet;
529}
530
532{
533 SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
534
535 bool bRet;
536
537 if (IsInAnimation() || maFrames.empty())
538 return;
539
540 bRet = true;
541
542 if (nMirrorFlags == BmpMirrorFlags::NONE)
543 return;
544
545 for (size_t i = 0, n = maFrames.size(); (i < n) && bRet; ++i)
546 {
547 AnimationFrame* pCurrentFrameBmp = maFrames[i].get();
548 bRet = pCurrentFrameBmp->maBitmapEx.Mirror(nMirrorFlags);
549 if (bRet)
550 {
551 if (nMirrorFlags & BmpMirrorFlags::Horizontal)
552 pCurrentFrameBmp->maPositionPixel.setX(maGlobalSize.Width()
553 - pCurrentFrameBmp->maPositionPixel.X()
554 - pCurrentFrameBmp->maSizePixel.Width());
555
556 if (nMirrorFlags & BmpMirrorFlags::Vertical)
557 pCurrentFrameBmp->maPositionPixel.setY(maGlobalSize.Height()
558 - pCurrentFrameBmp->maPositionPixel.Y()
559 - pCurrentFrameBmp->maSizePixel.Height());
560 }
561 }
562
563 maBitmapEx.Mirror(nMirrorFlags);
564}
565
566void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
567 short nChannelGPercent, short nChannelBPercent, double fGamma, bool bInvert)
568{
569 SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
570
571 bool bRet;
572
573 if (IsInAnimation() || maFrames.empty())
574 return;
575
576 bRet = true;
577
578 for (size_t i = 0, n = maFrames.size(); (i < n) && bRet; ++i)
579 {
580 bRet = maFrames[i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent,
581 nChannelGPercent, nChannelBPercent, fGamma, bInvert);
582 }
583
584 maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
585 nChannelBPercent, fGamma, bInvert);
586}
587
588SvStream& WriteAnimation(SvStream& rOStm, const Animation& rAnimation)
589{
590 const sal_uInt16 nCount = rAnimation.Count();
591
592 if (nCount)
593 {
594 const sal_uInt32 nDummy32 = 0;
595
596 // If no BitmapEx was set we write the first Bitmap of
597 // the Animation
598 if (rAnimation.GetBitmapEx().GetBitmap().IsEmpty())
599 WriteDIBBitmapEx(rAnimation.Get(0).maBitmapEx, rOStm);
600 else
601 WriteDIBBitmapEx(rAnimation.GetBitmapEx(), rOStm);
602
603 // Write identifier ( SDANIMA1 )
604 rOStm.WriteUInt32(0x5344414e).WriteUInt32(0x494d4931);
605
606 for (sal_uInt16 i = 0; i < nCount; i++)
607 {
608 const AnimationFrame& rAnimationFrame = rAnimation.Get(i);
609 const sal_uInt16 nRest = nCount - i - 1;
610
611 // Write AnimationFrame
612 WriteDIBBitmapEx(rAnimationFrame.maBitmapEx, rOStm);
613 tools::GenericTypeSerializer aSerializer(rOStm);
614 aSerializer.writePoint(rAnimationFrame.maPositionPixel);
615 aSerializer.writeSize(rAnimationFrame.maSizePixel);
616 aSerializer.writeSize(rAnimation.maGlobalSize);
617 rOStm.WriteUInt16((ANIMATION_TIMEOUT_ON_CLICK == rAnimationFrame.mnWait)
618 ? 65535
619 : rAnimationFrame.mnWait);
620 rOStm.WriteUInt16(static_cast<sal_uInt16>(rAnimationFrame.meDisposal));
621 rOStm.WriteBool(rAnimationFrame.mbUserInput);
622 rOStm.WriteUInt32(rAnimation.mnLoopCount);
623 rOStm.WriteUInt32(nDummy32); // Unused
624 rOStm.WriteUInt32(nDummy32); // Unused
625 rOStm.WriteUInt32(nDummy32); // Unused
627 rOStm.WriteUInt16(nRest); // Count of remaining structures
628 }
629 }
630
631 return rOStm;
632}
633
635{
636 sal_uLong nStmPos;
637 sal_uInt32 nAnimMagic1, nAnimMagic2;
638 SvStreamEndian nOldFormat = rIStm.GetEndian();
639 bool bReadAnimations = false;
640
641 rIStm.SetEndian(SvStreamEndian::LITTLE);
642 nStmPos = rIStm.Tell();
643 rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
644
645 rAnimation.Clear();
646
647 // If the BitmapEx at the beginning have already been read (by Graphic)
648 // we can start reading the AnimationFrames right away
649 if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
650 bReadAnimations = true;
651 // Else, we try reading the Bitmap(-Ex)
652 else
653 {
654 rIStm.Seek(nStmPos);
655 ReadDIBBitmapEx(rAnimation.maBitmapEx, rIStm);
656 nStmPos = rIStm.Tell();
657 rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
658
659 if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
660 bReadAnimations = true;
661 else
662 rIStm.Seek(nStmPos);
663 }
664
665 // Read AnimationFrames
666 if (bReadAnimations)
667 {
668 AnimationFrame aAnimationFrame;
669 sal_uInt32 nTmp32;
670 sal_uInt16 nTmp16;
671 bool cTmp;
672
673 do
674 {
675 ReadDIBBitmapEx(aAnimationFrame.maBitmapEx, rIStm);
676 tools::GenericTypeSerializer aSerializer(rIStm);
677 aSerializer.readPoint(aAnimationFrame.maPositionPixel);
678 aSerializer.readSize(aAnimationFrame.maSizePixel);
679 aSerializer.readSize(rAnimation.maGlobalSize);
680 rIStm.ReadUInt16(nTmp16);
681 aAnimationFrame.mnWait = ((65535 == nTmp16) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16);
682 rIStm.ReadUInt16(nTmp16);
683 aAnimationFrame.meDisposal = static_cast<Disposal>(nTmp16);
684 rIStm.ReadCharAsBool(cTmp);
685 aAnimationFrame.mbUserInput = cTmp;
686 rIStm.ReadUInt32(rAnimation.mnLoopCount);
687 rIStm.ReadUInt32(nTmp32); // Unused
688 rIStm.ReadUInt32(nTmp32); // Unused
689 rIStm.ReadUInt32(nTmp32); // Unused
691 rIStm.ReadUInt16(nTmp16); // The rest to read
692
693 rAnimation.Insert(aAnimationFrame);
694 } while (nTmp16 && !rIStm.GetError());
695
696 rAnimation.ResetLoopCount();
697 }
698
699 rIStm.SetEndian(nOldFormat);
700
701 return rIStm;
702}
703
705 : mpRenderContext(nullptr)
706 , mpRendererData(nullptr)
707 , mnRendererId(0)
708 , mbIsPaused(false)
709{
710}
711
712/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Disposal
SvStream & ReadAnimation(SvStream &rIStm, Animation &rAnimation)
Definition: Animation.cxx:634
SvStream & WriteAnimation(SvStream &rOStm, const Animation &rAnimation)
Definition: Animation.cxx:588
IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
Definition: Animation.cxx:382
#define ANIMATION_TIMEOUT_ON_CLICK
Definition: Animation.hxx:28
#define BITMAP_CHECKSUM_SIZE
Definition: checksum.hxx:28
sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]
Definition: checksum.hxx:31
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
void BCToBCOA(BitmapChecksum n, BitmapChecksumOctetArray p)
Definition: checksum.hxx:34
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
Definition: checksum.hxx:72
void setMarked(bool bIsMarked)
void pause(bool bIsPaused)
void Replace(const AnimationFrame &rNewAnimationBmp, sal_uInt16 nAnimation)
Definition: Animation.cxx:440
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
Definition: Animation.cxx:238
const BitmapEx & GetBitmapEx() const
Definition: Animation.hxx:60
bool IsTransparent() const
Definition: Animation.cxx:109
void Convert(BmpConversion eConversion)
Definition: Animation.cxx:467
size_t Count() const
Definition: Animation.hxx:71
static SAL_DLLPRIVATE sal_uLong gAnimationRendererCount
Definition: Animation.hxx:98
SAL_DLLPRIVATE std::vector< std::unique_ptr< AnimationData > > CreateAnimationDataItems()
Definition: Animation.cxx:285
bool ReduceColors(sal_uInt16 nNewColorCount)
Definition: Animation.cxx:484
size_t mnFrameIndex
Definition: Animation.hxx:109
SAL_DLLPRIVATE void PopulateRenderers()
Definition: Animation.cxx:297
std::vector< std::unique_ptr< AnimationRenderer > > maRenderers
Definition: Animation.hxx:101
bool mbIsInAnimation
Definition: Animation.hxx:110
sal_uInt32 mnLoopCount
Definition: Animation.hxx:107
void Clear()
Definition: Animation.cxx:99
BitmapEx maBitmapEx
Definition: Animation.hxx:104
SAL_DLLPRIVATE void RenderNextFrameInAllRenderers()
Definition: Animation.cxx:320
SAL_DLLPRIVATE bool IsAnyRendererActive()
Definition: Animation.cxx:376
Timer maTimer
Definition: Animation.hxx:105
void Mirror(BmpMirrorFlags nMirrorFlags)
Definition: Animation.cxx:531
void SetLoopCount(const sal_uInt32 nLoopCount)
Definition: Animation.cxx:455
Animation & operator=(const Animation &rAnimation)
Definition: Animation.cxx:69
const AnimationFrame & Get(sal_uInt16 nAnimation) const
Definition: Animation.cxx:434
bool operator==(const Animation &rAnimation) const
Definition: Animation.cxx:88
SAL_DLLPRIVATE void PruneMarkedRenderers()
Definition: Animation.cxx:364
Size maGlobalSize
Definition: Animation.hxx:106
bool mbLoopTerminated
Definition: Animation.hxx:111
void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma=1.0, bool bInvert=false)
Definition: Animation.cxx:566
bool Insert(const AnimationFrame &rAnimationFrame)
Definition: Animation.cxx:411
sal_uLong GetSizeBytes() const
Definition: Animation.cxx:128
std::vector< std::unique_ptr< AnimationFrame > > maFrames
Definition: Animation.hxx:100
SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout)
Definition: Animation.cxx:279
sal_uInt32 mnLoops
Definition: Animation.hxx:108
bool IsInAnimation() const
Definition: Animation.hxx:54
void ResetLoopCount()
Definition: Animation.cxx:461
BitmapChecksum GetChecksum() const
Definition: Animation.cxx:140
bool Invert()
Definition: Animation.cxx:510
bool Start(OutputDevice &rOutDev, const Point &rDestPt, const Size &rDestSz, tools::Long nRendererId, OutputDevice *pFirstFrameOutDev)
Definition: Animation.cxx:164
void Stop(const OutputDevice *pOutDev=nullptr, tools::Long nRendererId=0)
Definition: Animation.cxx:222
bool Invert()
Perform the Invert operation on every pixel.
Definition: BitmapEx.cxx:258
sal_Int64 GetSizeBytes() const
Definition: BitmapEx.cxx:229
bool Convert(BmpConversion eConversion)
Convert bitmap format.
Definition: BitmapEx.cxx:383
bool IsAlpha() const
Definition: BitmapEx.cxx:207
BitmapChecksum GetChecksum() const
Definition: BitmapEx.cxx:239
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
Definition: BitmapEx.cxx:268
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:217
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
Definition: BitmapEx.cxx:503
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
void SetEmpty()
Definition: BitmapEx.cxx:191
static bool Filter(BitmapEx &rBmpEx, BitmapFilter const &rFilter)
bool IsEmpty() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
GDIMetaFile * GetConnectMetaFile() const
Definition: outdev.hxx:285
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1110
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
OutDevType GetOutDevType() const
Definition: outdev.hxx:406
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvStream & ReadCharAsBool(bool &rBool)
sal_uInt64 Tell() const
void SetEndian(SvStreamEndian SvStreamEndian)
SvStream & WriteBool(bool b)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStreamEndian GetEndian() const
sal_uInt64 Seek(sal_uInt64 nPos)
ErrCode GetError() const
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
void Stop()
Definition: scheduler.cxx:599
Definition: timer.hxx:27
void SetTimeout(sal_uInt64 nTimeoutMs)
Definition: timer.cxx:90
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
Definition: timer.cxx:83
void readPoint(Point &rPoint)
void writePoint(const Point &rPoint)
void readSize(Size &rSize)
void writeSize(const Size &rSize)
constexpr Size GetSize() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
int nCount
bool WriteDIBBitmapEx(const BitmapEx &rSource, SvStream &rOStm)
Definition: dibtools.cxx:1742
bool ReadDIBBitmapEx(BitmapEx &rTarget, SvStream &rIStm, bool bFileHeader, bool bMSOFormat)
Definition: dibtools.cxx:1623
aCursorMoveIdle Stop()
BmpMirrorFlags
::std::size_t mnLoopCount
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
int i
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
@ OUTDEV_WINDOW
Definition: outdev.hxx:145
@ OUTDEV_PRINTER
Definition: outdev.hxx:145
sal_uInt8 SVBT32[4]
sal_uIntPtr sal_uLong
OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
SvStreamEndian
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream &rStrm, std::string_view rStr)
tools::Long mnWait