LibreOffice Module sd (master) 1
SlsBitmapCompressor.hxx
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#pragma once
21
22#include <sal/types.h>
23#include <memory>
24
25class BitmapEx;
26
28{
29class BitmapReplacement;
30
35{
36public:
40 virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const = 0;
41
49 virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const = 0;
50
55 virtual bool IsLossless() const = 0;
56
57protected:
59};
60
66{
67public:
68 virtual sal_Int32 GetMemorySize() const { return 0; }
69
70protected:
72};
73
79{
80 class DummyReplacement;
81
82public:
84 virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rpBitmap) const override;
85 virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override;
86 virtual bool IsLossless() const override;
87};
88
95{
96public:
98 virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const override;
99 virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override;
100 virtual bool IsLossless() const override;
101};
102
109{
111 static const sal_Int32 mnWidth = 100;
112
113public:
115 virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rpBitmap) const override;
118 virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override;
119 virtual bool IsLossless() const override;
120};
121
126{
127 class PngReplacement;
128
129public:
130 virtual ~PngCompression() {}
131 virtual std::shared_ptr<BitmapReplacement> Compress(const BitmapEx& rBitmap) const override;
132 virtual BitmapEx Decompress(const BitmapReplacement& rBitmapData) const override;
133 virtual bool IsLossless() const override;
134};
135
136} // end of namespace ::sd::slidesorter::cache
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This interface class provides the minimal method set for classes that implement the compression and d...
virtual bool IsLossless() const =0
Return whether the compression and decompression is lossless.
virtual std::shared_ptr< BitmapReplacement > Compress(const BitmapEx &rBitmap) const =0
Compress the given bitmap into a replacement format that is specific to the compressor class.
virtual BitmapEx Decompress(const BitmapReplacement &rBitmapData) const =0
Decompress the given replacement data into a preview bitmap.
Interface for preview bitmap replacements.
This is another trivial bitmap compressor.
virtual BitmapEx Decompress(const BitmapReplacement &rBitmapData) const override
Decompress the given replacement data into a preview bitmap.
virtual bool IsLossless() const override
Return whether the compression and decompression is lossless.
virtual std::shared_ptr< BitmapReplacement > Compress(const BitmapEx &rBitmap) const override
Compress the given bitmap into a replacement format that is specific to the compressor class.
This dummy replacement simply stores a shared pointer to the original preview bitmap.
This is one trivial bitmap compressor.
virtual bool IsLossless() const override
Return whether the compression and decompression is lossless.
virtual BitmapEx Decompress(const BitmapReplacement &rBitmapData) const override
Decompress the given replacement data into a preview bitmap.
virtual std::shared_ptr< BitmapReplacement > Compress(const BitmapEx &rpBitmap) const override
Compress the given bitmap into a replacement format that is specific to the compressor class.
Compress preview bitmaps using the PNG format.
virtual BitmapEx Decompress(const BitmapReplacement &rBitmapData) const override
Decompress the given replacement data into a preview bitmap.
virtual std::shared_ptr< BitmapReplacement > Compress(const BitmapEx &rBitmap) const override
Compress the given bitmap into a replacement format that is specific to the compressor class.
virtual bool IsLossless() const override
Return whether the compression and decompression is lossless.
Store a scaled down bitmap together with the original size.
Compress a preview bitmap by reducing its resolution.
virtual BitmapEx Decompress(const BitmapReplacement &rBitmapData) const override
Scale the replacement bitmap up to the original size.
virtual bool IsLossless() const override
Return whether the compression and decompression is lossless.
virtual std::shared_ptr< BitmapReplacement > Compress(const BitmapEx &rpBitmap) const override
Compress the given bitmap into a replacement format that is specific to the compressor class.