/usr/include/ipebitmap.h is in libipe-dev 7.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | // -*- C++ -*-
// --------------------------------------------------------------------
// Bitmaps
// --------------------------------------------------------------------
/*
This file is part of the extensible drawing editor Ipe.
Copyright (C) 1993-2011 Otfried Cheong
Ipe is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
As a special exception, you have permission to link Ipe with the
CGAL library and distribute executables, as long as you follow the
requirements of the Gnu General Public License in regard to all of
the software in the executable aside from CGAL.
Ipe is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with Ipe; if not, you can find it at
"http://www.gnu.org/copyleft/gpl.html", or write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef IPEBITMAP_H
#define IPEBITMAP_H
#include "ipebase.h"
#include "ipexml.h"
// --------------------------------------------------------------------
namespace ipe {
class Bitmap {
public:
enum TFilter { EDirect, EFlateDecode, EDCTDecode };
enum TColorSpace { EDeviceRGB, EDeviceGray, EDeviceCMYK };
class MRenderData {
public:
virtual ~MRenderData();
};
Bitmap();
Bitmap(int width, int height,
TColorSpace colorSpace, int bitsPerComponent,
Buffer data, TFilter filter, bool deflate = false);
Bitmap(const XmlAttributes &attr, String data);
Bitmap(const XmlAttributes &attr, Buffer data);
Bitmap(const Bitmap &rhs);
~Bitmap();
Bitmap &operator=(const Bitmap &rhs);
void saveAsXml(Stream &stream, int id, int pdfObjNum = -1) const;
inline bool isNull() const;
bool equal(Bitmap rhs) const;
inline TColorSpace colorSpace() const;
inline TFilter filter() const;
inline int components() const;
inline int bitsPerComponent() const;
inline int width() const;
inline int height() const;
int colorKey() const;
void setColorKey(int key);
inline const char *data() const;
inline int size() const;
inline int objNum() const;
inline void setObjNum(int objNum) const;
inline MRenderData *renderData() const;
void setRenderData(MRenderData *data) const;
Buffer pixelData() const;
inline bool operator==(const Bitmap &rhs) const;
inline bool operator!=(const Bitmap &rhs) const;
inline bool operator<(const Bitmap &rhs) const;
private:
int init(const XmlAttributes &attr);
void computeChecksum();
private:
struct Imp {
int iRefCount;
TColorSpace iColorSpace;
int iBitsPerComponent;
int iWidth;
int iHeight;
int iComponents;
int iColorKey;
Buffer iData;
TFilter iFilter;
int iChecksum;
mutable int iObjNum; // Object number (e.g. in PDF file)
mutable MRenderData *iRender; // cached pixmap to render it fast
};
Imp *iImp;
};
// --------------------------------------------------------------------
//! Is this a null bitmap?
inline bool Bitmap::isNull() const
{
return (iImp == 0);
}
//! Return the color space of the image.
inline Bitmap::TColorSpace Bitmap::colorSpace() const
{
return iImp->iColorSpace;
}
//! Return number of components per pixel.
inline int Bitmap::components() const
{
return iImp->iComponents;
}
//! Return the number of bits per component.
inline int Bitmap::bitsPerComponent() const
{
return iImp->iBitsPerComponent;
}
//! Return width of pixel array.
inline int Bitmap::width() const
{
return iImp->iWidth;
}
//! Return height of pixel array.
inline int Bitmap::height() const
{
return iImp->iHeight;
}
//! Return the data filter of the image data.
inline Bitmap::TFilter Bitmap::filter() const
{
return iImp->iFilter;
}
//! Return a pointer to the image data (in PDF arrangement).
inline const char *Bitmap::data() const
{
return iImp->iData.data();
}
//! Return size (number of bytes) of image data (in PDF arrangement).
inline int Bitmap::size() const
{
return iImp->iData.size();
}
//! Return object number of the bitmap.
inline int Bitmap::objNum() const
{
return iImp->iObjNum;
}
//! Set object number of the bitmap.
inline void Bitmap::setObjNum(int objNum) const
{
iImp->iObjNum = objNum;
}
//! Return cached bitmap for rendering.
inline Bitmap::MRenderData *Bitmap::renderData() const
{
return iImp->iRender;
}
//! Two bitmaps are equal if they share the same data.
inline bool Bitmap::operator==(const Bitmap &rhs) const
{
return iImp == rhs.iImp;
}
//! Two bitmaps are equal if they share the same data.
inline bool Bitmap::operator!=(const Bitmap &rhs) const
{
return iImp != rhs.iImp;
}
//! Less operator, to be able to sort bitmaps.
/*! The checksum is used, when it is equal, the shared address.
This guarantees that bitmaps that are == (share their implementation)
are next to each other, and blocks of them are next to blocks that
are identical in contents. */
inline bool Bitmap::operator<(const Bitmap &rhs) const
{
return (iImp->iChecksum < rhs.iImp->iChecksum ||
(iImp->iChecksum == rhs.iImp->iChecksum && iImp < rhs.iImp));
}
} // namespace
// --------------------------------------------------------------------
#endif
|