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