37 : maTimer(
"vcl::Animation")
41 , mbIsInAnimation(false)
42 , mbLoopTerminated(false)
48 : maBitmapEx(rAnimation.maBitmapEx)
49 , maTimer(
"vcl::Animation")
50 , maGlobalSize(rAnimation.maGlobalSize)
52 , mnFrameIndex(rAnimation.mnFrameIndex)
53 , mbIsInAnimation(false)
54 , mbLoopTerminated(rAnimation.mbLoopTerminated)
56 for (
auto const& rFrame : rAnimation.
maFrames)
71 if (
this != &rAnimation)
93 [](
const std::unique_ptr<AnimationFrame>& pAnim1,
94 const std::unique_ptr<AnimationFrame>& pAnim2) ->
bool {
95 return *pAnim1 == *pAnim2;
120 [&aRect](
const std::unique_ptr<AnimationFrame>& pAnim) ->
bool {
121 return pAnim->meDisposal == Disposal::Back
122 && tools::Rectangle{ pAnim->maPositionPixel,
132 for (
auto const& pAnimationFrame :
maFrames)
134 nSizeBytes += pAnimationFrame->maBitmapEx.GetSizeBytes();
146 UInt32ToSVBT32(
maFrames.size(), aBT32);
176 auto itAnimView = std::find_if(
178 [&rOut, nRendererId](
const std::unique_ptr<AnimationRenderer>& pRenderer) ->
bool {
179 return pRenderer->matches(&rOut, nRendererId);
184 if ((*itAnimView)->getOriginPosition() == rDestPt
185 && (*itAnimView)->getOutSizePix() == rOut.
LogicToPixel(rDestSz))
187 (*itAnimView)->repaint();
205 nRendererId, pFirstFrameOutDev));
214 Draw(rOut, rDestPt, rDestSz);
226 [=](
const std::unique_ptr<AnimationRenderer>& pRenderer) ->
bool {
227 return pRenderer->matches(pOut, nRendererId);
254 maFrames[0]->maBitmapEx.Draw(&rOut, rDestPt, rDestSz);
287 std::vector<std::unique_ptr<AnimationData>> aDataItems;
291 aDataItems.emplace_back(rItem->createAnimationData());
302 if (!pDataItem->mpRendererData)
305 pDataItem->maOriginStartPt, pDataItem->maStartSize,
306 pDataItem->mnRendererId);
308 maRenderers.push_back(std::unique_ptr<AnimationRenderer>(pRenderer));
315 pRenderer->
pause(pDataItem->mbIsPaused);
325 if (!pCurrentFrameBmp)
347 [
this](
const auto& pRenderer) { pRenderer->draw(mnFrameIndex); });
354 [](
const auto& pRenderer) { return pRenderer->isMarked(); });
368 [](
const auto& pRenderer) { return !pRenderer->isMarked(); });
373 [](
const auto& pRenderer) { pRenderer->setMarked(false); });
379 [](
const auto& pRenderer) { return !pRenderer->isPaused(); });
384 const size_t nAnimCount = maFrames.size();
388 bool bIsAnyRendererActive =
true;
390 if (maNotifyLink.IsSet())
392 maNotifyLink.Call(
this);
394 PruneMarkedRenderers();
395 bIsAnyRendererActive = IsAnyRendererActive();
398 if (maRenderers.empty())
400 else if (!bIsAnyRendererActive)
401 ImplRestartTimer(10);
403 RenderNextFrameInAllRenderers();
477 for (
size_t i = 0,
n =
maFrames.size(); (
i <
n) && bRet; ++
i)
478 bRet =
maFrames[
i]->maBitmapEx.Convert(eConversion);
494 for (
size_t i = 0,
n =
maFrames.size(); (
i <
n) && bRet; ++
i)
520 for (
size_t i = 0,
n =
maFrames.size(); (
i <
n) && bRet; ++
i)
545 for (
size_t i = 0,
n =
maFrames.size(); (
i <
n) && bRet; ++
i)
567 short nChannelGPercent,
short nChannelBPercent,
double fGamma,
bool bInvert)
578 for (
size_t i = 0,
n =
maFrames.size(); (
i <
n) && bRet; ++
i)
580 bRet =
maFrames[
i]->maBitmapEx.Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent,
581 nChannelGPercent, nChannelBPercent, fGamma, bInvert);
584 maBitmapEx.
Adjust(nLuminancePercent, nContrastPercent, nChannelRPercent, nChannelGPercent,
585 nChannelBPercent, fGamma, bInvert);
594 const sal_uInt32 nDummy32 = 0;
609 const sal_uInt16 nRest =
nCount -
i - 1;
619 : rAnimationFrame.
mnWait);
637 sal_uInt32 nAnimMagic1, nAnimMagic2;
639 bool bReadAnimations =
false;
642 nStmPos = rIStm.
Tell();
649 if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.
GetError())
650 bReadAnimations =
true;
656 nStmPos = rIStm.
Tell();
659 if ((nAnimMagic1 == 0x5344414e) && (nAnimMagic2 == 0x494d4931) && !rIStm.
GetError())
660 bReadAnimations =
true;
693 rAnimation.
Insert(aAnimationFrame);
694 }
while (nTmp16 && !rIStm.
GetError());
705 : mpRenderContext(nullptr)
706 , mpRendererData(nullptr)
SvStream & ReadAnimation(SvStream &rIStm, Animation &rAnimation)
SvStream & WriteAnimation(SvStream &rOStm, const Animation &rAnimation)
IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer *, void)
#define ANIMATION_TIMEOUT_ON_CLICK
#define BITMAP_CHECKSUM_SIZE
sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]
sal_uInt64 BitmapChecksum
void BCToBCOA(BitmapChecksum n, BitmapChecksumOctetArray p)
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
void setMarked(bool bIsMarked)
void pause(bool bIsPaused)
void Replace(const AnimationFrame &rNewAnimationBmp, sal_uInt16 nAnimation)
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
const BitmapEx & GetBitmapEx() const
bool IsTransparent() const
void Convert(BmpConversion eConversion)
static SAL_DLLPRIVATE sal_uLong gAnimationRendererCount
SAL_DLLPRIVATE std::vector< std::unique_ptr< AnimationData > > CreateAnimationDataItems()
bool ReduceColors(sal_uInt16 nNewColorCount)
SAL_DLLPRIVATE void PopulateRenderers()
std::vector< std::unique_ptr< AnimationRenderer > > maRenderers
SAL_DLLPRIVATE void RenderNextFrameInAllRenderers()
SAL_DLLPRIVATE bool IsAnyRendererActive()
void Mirror(BmpMirrorFlags nMirrorFlags)
void SetLoopCount(const sal_uInt32 nLoopCount)
Animation & operator=(const Animation &rAnimation)
const AnimationFrame & Get(sal_uInt16 nAnimation) const
bool operator==(const Animation &rAnimation) const
SAL_DLLPRIVATE void PruneMarkedRenderers()
void Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma=1.0, bool bInvert=false)
bool Insert(const AnimationFrame &rAnimationFrame)
sal_uLong GetSizeBytes() const
std::vector< std::unique_ptr< AnimationFrame > > maFrames
SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout)
bool IsInAnimation() const
BitmapChecksum GetChecksum() const
bool Start(OutputDevice &rOutDev, const Point &rDestPt, const Size &rDestSz, tools::Long nRendererId, OutputDevice *pFirstFrameOutDev)
void Stop(const OutputDevice *pOutDev=nullptr, tools::Long nRendererId=0)
bool Invert()
Perform the Invert operation on every pixel.
sal_Int64 GetSizeBytes() const
bool Convert(BmpConversion eConversion)
Convert bitmap format.
BitmapChecksum GetChecksum() const
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
Bitmap GetBitmap(Color aTransparentReplaceColor) const
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
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.
static bool Filter(BitmapEx &rBmpEx, BitmapFilter const &rFilter)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
GDIMetaFile * GetConnectMetaFile() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
OutDevType GetOutDevType() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvStream & ReadCharAsBool(bool &rBool)
void SetEndian(SvStreamEndian SvStreamEndian)
SvStream & WriteBool(bool b)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStreamEndian GetEndian() const
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
::std::size_t mnLoopCount
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
TOOLS_DLLPUBLIC std::size_t write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream &rStrm, std::string_view rStr)