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