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  ImplAnimView* pView;
173  ImplAnimView* pMatch = nullptr;
174 
175  for (size_t i = 0; i < maViewList.size(); ++i)
176  {
177  pView = maViewList[i].get();
178  if (pView->matches(pOut, nExtraData))
179  {
180  if (pView->getOutPos() == rDestPt
181  && pView->getOutSizePix() == pOut->LogicToPixel(rDestSz))
182  {
183  pView->repaint();
184  pMatch = pView;
185  }
186  else
187  {
188  maViewList.erase(maViewList.begin() + i);
189  pView = nullptr;
190  }
191 
192  break;
193  }
194  }
195 
196  if (maViewList.empty())
197  {
198  maTimer.Stop();
199  mbIsInAnimation = false;
200  mnPos = 0;
201  }
202 
203  if (!pMatch)
204  maViewList.emplace_back(
205  new ImplAnimView(this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev));
206 
207  if (!mbIsInAnimation)
208  {
209  ImplRestartTimer(maList[mnPos]->mnWait);
210  mbIsInAnimation = true;
211  }
212  }
213  else
214  Draw(pOut, rDestPt, rDestSz);
215 
216  bRet = true;
217  }
218 
219  return bRet;
220 }
221 
222 void Animation::Stop(OutputDevice* pOut, long nExtraData)
223 {
224  maViewList.erase(std::remove_if(maViewList.begin(), maViewList.end(),
225  [=](const std::unique_ptr<ImplAnimView>& pAnimView) -> bool {
226  return pAnimView->matches(pOut, nExtraData);
227  }),
228  maViewList.end());
229 
230  if (maViewList.empty())
231  {
232  maTimer.Stop();
233  mbIsInAnimation = false;
234  }
235 }
236 
237 void Animation::Draw(OutputDevice* pOut, const Point& rDestPt) const
238 {
239  Draw(pOut, rDestPt, pOut->PixelToLogic(maGlobalSize));
240 }
241 
242 void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz) const
243 {
244  const size_t nCount = maList.size();
245 
246  if (nCount)
247  {
248  AnimationBitmap* pObj = maList[std::min(mnPos, nCount - 1)].get();
249 
250  if (pOut->GetConnectMetaFile() || (pOut->GetOutDevType() == OUTDEV_PRINTER))
251  maList[0]->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
252  else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait)
253  pObj->maBitmapEx.Draw(pOut, rDestPt, rDestSz);
254  else
255  {
256  const size_t nOldPos = mnPos;
257  if (mbLoopTerminated)
258  const_cast<Animation*>(this)->mnPos = nCount - 1;
259 
260  {
261  ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 };
262  }
263 
264  const_cast<Animation*>(this)->mnPos = nOldPos;
265  }
266  }
267 }
268 
269 namespace
270 {
271 constexpr sal_uLong constMinTimeout = 2;
272 }
273 
275 {
276  maTimer.SetTimeout(std::max(nTimeout, constMinTimeout) * 10);
277  maTimer.Start();
278 }
279 
280 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
281 {
282  const size_t nAnimCount = maList.size();
283 
284  if (nAnimCount)
285  {
286  ImplAnimView* pView;
287  bool bGlobalPause = true;
288 
289  if (maNotifyLink.IsSet())
290  {
291  std::vector<std::unique_ptr<AInfo>> aAInfoList;
292  // create AInfo-List
293  for (auto const& i : maViewList)
294  aAInfoList.emplace_back(i->createAInfo());
295 
296  maNotifyLink.Call(this);
297 
298  // set view state from AInfo structure
299  for (auto& pAInfo : aAInfoList)
300  {
301  if (!pAInfo->pViewData)
302  {
303  pView = new ImplAnimView(this, pAInfo->pOutDev, pAInfo->aStartOrg,
304  pAInfo->aStartSize, pAInfo->nExtraData);
305 
306  maViewList.push_back(std::unique_ptr<ImplAnimView>(pView));
307  }
308  else
309  pView = static_cast<ImplAnimView*>(pAInfo->pViewData);
310 
311  pView->pause(pAInfo->bPause);
312  pView->setMarked(true);
313  }
314 
315  // delete all unmarked views and reset marked state
316  for (size_t i = 0; i < maViewList.size();)
317  {
318  pView = maViewList[i].get();
319  if (!pView->isMarked())
320  {
321  maViewList.erase(maViewList.begin() + i);
322  }
323  else
324  {
325  if (!pView->isPause())
326  bGlobalPause = false;
327 
328  pView->setMarked(false);
329  i++;
330  }
331  }
332  }
333  else
334  bGlobalPause = false;
335 
336  if (maViewList.empty())
337  Stop();
338  else if (bGlobalPause)
339  ImplRestartTimer(10);
340  else
341  {
342  AnimationBitmap* pStepBmp = (++mnPos < maList.size()) ? maList[mnPos].get() : nullptr;
343 
344  if (!pStepBmp)
345  {
346  if (mnLoops == 1)
347  {
348  Stop();
349  mbLoopTerminated = true;
350  mnPos = nAnimCount - 1;
351  maBitmapEx = maList[mnPos]->maBitmapEx;
352  return;
353  }
354  else
355  {
356  if (mnLoops)
357  mnLoops--;
358 
359  mnPos = 0;
360  pStepBmp = maList[mnPos].get();
361  }
362  }
363 
364  // Paint all views; after painting check, if view is
365  // marked; in this case remove view, because area of output
366  // lies out of display area of window; mark state is
367  // set from view itself
368  for (size_t i = 0; i < maViewList.size();)
369  {
370  pView = maViewList[i].get();
371  pView->draw(mnPos);
372 
373  if (pView->isMarked())
374  {
375  maViewList.erase(maViewList.begin() + i);
376  }
377  else
378  i++;
379  }
380 
381  // stop or restart timer
382  if (maViewList.empty())
383  Stop();
384  else
385  ImplRestartTimer(pStepBmp->mnWait);
386  }
387  }
388  else
389  Stop();
390 }
391 
392 bool Animation::Insert(const AnimationBitmap& rStepBmp)
393 {
394  bool bRet = false;
395 
396  if (!IsInAnimation())
397  {
398  tools::Rectangle aGlobalRect(Point(), maGlobalSize);
399 
401  = aGlobalRect.Union(tools::Rectangle(rStepBmp.maPositionPixel, rStepBmp.maSizePixel))
402  .GetSize();
403  maList.emplace_back(new AnimationBitmap(rStepBmp));
404 
405  // As a start, we make the first BitmapEx the replacement BitmapEx
406  if (maList.size() == 1)
407  maBitmapEx = rStepBmp.maBitmapEx;
408 
409  bRet = true;
410  }
411 
412  return bRet;
413 }
414 
415 const AnimationBitmap& Animation::Get(sal_uInt16 nAnimation) const
416 {
417  SAL_WARN_IF((nAnimation >= maList.size()), "vcl", "No object at this position");
418  return *maList[nAnimation];
419 }
420 
421 void Animation::Replace(const AnimationBitmap& rNewAnimationBitmap, sal_uInt16 nAnimation)
422 {
423  SAL_WARN_IF((nAnimation >= maList.size()), "vcl", "No object at this position");
424 
425  maList[nAnimation].reset(new AnimationBitmap(rNewAnimationBitmap));
426 
427  // If we insert at first position we also need to
428  // update the replacement BitmapEx
429  if ((!nAnimation && (!mbLoopTerminated || (maList.size() == 1)))
430  || ((nAnimation == maList.size() - 1) && mbLoopTerminated))
431  {
432  maBitmapEx = rNewAnimationBitmap.maBitmapEx;
433  }
434 }
435 
436 void Animation::SetLoopCount(const sal_uInt32 nLoopCount)
437 {
438  mnLoopCount = nLoopCount;
439  ResetLoopCount();
440 }
441 
443 {
445  mbLoopTerminated = false;
446 }
447 
449 {
450  SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
451 
452  bool bRet;
453 
454  if (!IsInAnimation() && !maList.empty())
455  {
456  bRet = true;
457 
458  for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
459  bRet = maList[i]->maBitmapEx.Convert(eConversion);
460 
461  maBitmapEx.Convert(eConversion);
462  }
463 }
464 
465 bool Animation::ReduceColors(sal_uInt16 nNewColorCount)
466 {
467  SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
468 
469  bool bRet;
470 
471  if (!IsInAnimation() && !maList.empty())
472  {
473  bRet = true;
474 
475  for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
476  {
478  BitmapColorQuantizationFilter(nNewColorCount));
479  }
480 
482  }
483  else
484  {
485  bRet = false;
486  }
487 
488  return bRet;
489 }
490 
492 {
493  SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
494 
495  bool bRet;
496 
497  if (!IsInAnimation() && !maList.empty())
498  {
499  bRet = true;
500 
501  for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
502  bRet = maList[i]->maBitmapEx.Invert();
503 
504  maBitmapEx.Invert();
505  }
506  else
507  bRet = false;
508 
509  return bRet;
510 }
511 
513 {
514  SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
515 
516  bool bRet;
517 
518  if (!IsInAnimation() && !maList.empty())
519  {
520  bRet = true;
521 
522  if (nMirrorFlags != BmpMirrorFlags::NONE)
523  {
524  for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
525  {
526  AnimationBitmap* pStepBmp = maList[i].get();
527  bRet = pStepBmp->maBitmapEx.Mirror(nMirrorFlags);
528  if (bRet)
529  {
530  if (nMirrorFlags & BmpMirrorFlags::Horizontal)
532  - pStepBmp->maPositionPixel.X()
533  - pStepBmp->maSizePixel.Width());
534 
535  if (nMirrorFlags & BmpMirrorFlags::Vertical)
537  - pStepBmp->maPositionPixel.Y()
538  - pStepBmp->maSizePixel.Height());
539  }
540  }
541 
542  maBitmapEx.Mirror(nMirrorFlags);
543  }
544  }
545 }
546 
547 void Animation::Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent,
548  short nChannelGPercent, short nChannelBPercent, double fGamma, bool bInvert)
549 {
550  SAL_WARN_IF(IsInAnimation(), "vcl", "Animation modified while it is animated");
551 
552  bool bRet;
553 
554  if (!IsInAnimation() && !maList.empty())
555  {
556  bRet = true;
557 
558  for (size_t i = 0, n = maList.size(); (i < n) && bRet; ++i)
559  {
560  bRet = maList[i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent,
561  nChannelRPercent, nChannelGPercent,
562  nChannelBPercent, fGamma, bInvert);
563  }
564 
565  maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
566  nChannelBPercent, fGamma, bInvert);
567  }
568 }
569 
570 SvStream& WriteAnimation(SvStream& rOStm, const Animation& rAnimation)
571 {
572  const sal_uInt16 nCount = rAnimation.Count();
573 
574  if (nCount)
575  {
576  const sal_uInt32 nDummy32 = 0;
577 
578  // If no BitmapEx was set we write the first Bitmap of
579  // the Animation
580  if (!rAnimation.GetBitmapEx().GetBitmap())
581  WriteDIBBitmapEx(rAnimation.Get(0).maBitmapEx, rOStm);
582  else
583  WriteDIBBitmapEx(rAnimation.GetBitmapEx(), rOStm);
584 
585  // Write identifier ( SDANIMA1 )
586  rOStm.WriteUInt32(0x5344414e).WriteUInt32(0x494d4931);
587 
588  for (sal_uInt16 i = 0; i < nCount; i++)
589  {
590  const AnimationBitmap& rAnimationBitmap = rAnimation.Get(i);
591  const sal_uInt16 nRest = nCount - i - 1;
592 
593  // Write AnimationBitmap
594  WriteDIBBitmapEx(rAnimationBitmap.maBitmapEx, rOStm);
595  tools::GenericTypeSerializer aSerializer(rOStm);
596  aSerializer.writePoint(rAnimationBitmap.maPositionPixel);
597  aSerializer.writeSize(rAnimationBitmap.maSizePixel);
598  aSerializer.writeSize(rAnimation.maGlobalSize);
599  rOStm.WriteUInt16((ANIMATION_TIMEOUT_ON_CLICK == rAnimationBitmap.mnWait)
600  ? 65535
601  : rAnimationBitmap.mnWait);
602  rOStm.WriteUInt16(static_cast<sal_uInt16>(rAnimationBitmap.meDisposal));
603  rOStm.WriteBool(rAnimationBitmap.mbUserInput);
604  rOStm.WriteUInt32(rAnimation.mnLoopCount);
605  rOStm.WriteUInt32(nDummy32); // Unused
606  rOStm.WriteUInt32(nDummy32); // Unused
607  rOStm.WriteUInt32(nDummy32); // Unused
608  write_uInt16_lenPrefixed_uInt8s_FromOString(rOStm, OString()); // dummy
609  rOStm.WriteUInt16(nRest); // Count of remaining structures
610  }
611  }
612 
613  return rOStm;
614 }
615 
617 {
618  sal_uLong nStmPos;
619  sal_uInt32 nAnimMagic1, nAnimMagic2;
620  SvStreamEndian nOldFormat = rIStm.GetEndian();
621  bool bReadAnimations = false;
622 
623  rIStm.SetEndian(SvStreamEndian::LITTLE);
624  nStmPos = rIStm.Tell();
625  rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
626 
627  rAnimation.Clear();
628 
629  // If the BitmapEx at the beginning have already been read (by Graphic)
630  // we can start reading the AnimationBitmaps right away
631  if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
632  bReadAnimations = true;
633  // Else, we try reading the Bitmap(-Ex)
634  else
635  {
636  rIStm.Seek(nStmPos);
637  ReadDIBBitmapEx(rAnimation.maBitmapEx, rIStm);
638  nStmPos = rIStm.Tell();
639  rIStm.ReadUInt32(nAnimMagic1).ReadUInt32(nAnimMagic2);
640 
641  if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.GetError())
642  bReadAnimations = true;
643  else
644  rIStm.Seek(nStmPos);
645  }
646 
647  // Read AnimationBitmaps
648  if (bReadAnimations)
649  {
650  AnimationBitmap aAnimationBitmap;
651  sal_uInt32 nTmp32;
652  sal_uInt16 nTmp16;
653  bool cTmp;
654 
655  do
656  {
657  ReadDIBBitmapEx(aAnimationBitmap.maBitmapEx, rIStm);
658  tools::GenericTypeSerializer aSerializer(rIStm);
659  aSerializer.readPoint(aAnimationBitmap.maPositionPixel);
660  aSerializer.readSize(aAnimationBitmap.maSizePixel);
661  aSerializer.readSize(rAnimation.maGlobalSize);
662  rIStm.ReadUInt16(nTmp16);
663  aAnimationBitmap.mnWait = ((65535 == nTmp16) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16);
664  rIStm.ReadUInt16(nTmp16);
665  aAnimationBitmap.meDisposal = static_cast<Disposal>(nTmp16);
666  rIStm.ReadCharAsBool(cTmp);
667  aAnimationBitmap.mbUserInput = cTmp;
668  rIStm.ReadUInt32(rAnimation.mnLoopCount);
669  rIStm.ReadUInt32(nTmp32); // Unused
670  rIStm.ReadUInt32(nTmp32); // Unused
671  rIStm.ReadUInt32(nTmp32); // Unused
673  rIStm.ReadUInt16(nTmp16); // The rest to read
674 
675  rAnimation.Insert(aAnimationBitmap);
676  } while (nTmp16 && !rIStm.GetError());
677 
678  rAnimation.ResetLoopCount();
679  }
680 
681  rIStm.SetEndian(nOldFormat);
682 
683  return rIStm;
684 }
685 
687  : pOutDev(nullptr)
688  , pViewData(nullptr)
689  , nExtraData(0)
690  , bPause(false)
691 {
692 }
693 
694 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Point & getOutPos() const
Definition: impanmvw.hxx:85
SvStream & WriteBool(bool b)
long Width() const
OutDevType GetOutDevType() const
Definition: outdev.hxx:522
void SetLoopCount(const sal_uInt32 nLoopCount)
Definition: Animation.cxx:436
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:274
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:570
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)
bool isPause() const
Definition: impanmvw.hxx:90
void Stop(OutputDevice *pOutDev=nullptr, long nExtraData=0)
Definition: Animation.cxx:222
SvStream & ReadCharAsBool(bool &rBool)
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
Definition: Animation.cxx:237
sal_uInt32 mnLoopCount
Definition: Animation.hxx:105
bool ReduceColors(sal_uInt16 nNewColorCount)
Definition: Animation.cxx:465
BitmapChecksum GetChecksum() const
Definition: Animation.cxx:138
sal_uInt64 Seek(sal_uInt64 nPos)
bool matches(OutputDevice *pOut, long nExtraData) const
Definition: impanmvw.cxx:99
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)
void draw(sal_uLong nPos, VirtualDevice *pVDev=nullptr)
Definition: impanmvw.cxx:183
void repaint()
Definition: impanmvw.cxx:306
ErrCode GetError() const
bool ReadDIBBitmapEx(BitmapEx &rTarget, SvStream &rIStm, bool bFileHeader, bool bMSOFormat)
Definition: dibtools.cxx:1740
void setX(long nX)
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:512
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
Definition: bitmapex.cxx:333
Size maGlobalSize
Definition: Animation.hxx:104
Bitmap GetBitmap(const Color *pTransReplaceColor=nullptr) const
Definition: bitmapex.cxx:236
bool Invert()
Definition: Animation.cxx:491
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:1871
void Replace(const AnimationBitmap &rNewAnimationBmp, sal_uInt16 nAnimation)
Definition: Animation.cxx:421
void ResetLoopCount()
Definition: Animation.cxx:442
bool Invert()
Perform the Invert operation on every pixel.
Definition: bitmapex.cxx:318
const Size & getOutSizePix() const
Definition: impanmvw.hxx:87
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:415
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1185
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:940
void Clear()
Definition: Animation.cxx:97
friend SvStream & ReadAnimation(SvStream &rIStream, Animation &rAnimation)
Definition: Animation.cxx:616
SvStreamEndian GetEndian() const
bool operator==(const Animation &rAnimation) const
Definition: Animation.cxx:86
void Stop()
Definition: scheduler.cxx:593
bool Insert(const AnimationBitmap &rAnimationBitmap)
Definition: Animation.cxx:392
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
bool isMarked() const
Definition: impanmvw.hxx:93
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:280
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:448
void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma=1.0, bool bInvert=false)
Definition: Animation.cxx:547
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