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