1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASEGFX_RASTER_BPIXELRASTER_HXX
21 #define INCLUDED_BASEGFX_RASTER_BPIXELRASTER_HXX
26 #include <sal/types.h>
27 #include <basegfx/pixel/bpixel.hxx>
28 #include <basegfx/basegfxdllapi.h>
35 BPixelRaster(const BPixelRaster
&) = delete;
36 BPixelRaster
& operator=(const BPixelRaster
&) = delete;
42 std::unique_ptr
<BPixel
[]> mpContent
;
48 memset(mpContent
.get(), 0, sizeof(BPixel
) * mnCount
);
51 // constructor/destructor
52 BPixelRaster(sal_uInt32 nWidth
, sal_uInt32 nHeight
)
55 mnCount(nWidth
* nHeight
),
56 mpContent(new BPixel
[mnCount
])
61 // coordinate calcs between X/Y and span
62 sal_uInt32
getIndexFromXY(sal_uInt32 nX
, sal_uInt32 nY
) const { return (nX
+ (nY
* mnWidth
)); }
65 sal_uInt32
getWidth() const { return mnWidth
; }
66 sal_uInt32
getHeight() const { return mnHeight
; }
68 // data access read only
69 const BPixel
& getBPixel(sal_uInt32 nIndex
) const
71 assert(nIndex
< mnCount
&& "Access out of range");
72 return mpContent
[nIndex
];
75 // data access read/write
76 BPixel
& getBPixel(sal_uInt32 nIndex
)
78 assert(nIndex
< mnCount
&& "Access out of range");
79 return mpContent
[nIndex
];
82 } // end of namespace basegfx
84 #endif // INCLUDED_BASEGFX_RASTER_BPIXELRASTER_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */