LibreOffice Module canvas (master)  1
icolorbuffer.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 
24 namespace canvas
25 {
31  struct IColorBuffer
32  {
34  enum class Format
35  {
36  // 32-bit ARGB pixel format with alpha, 8 bits per channel.
37  A8R8G8B8,
38 
39  // 32-bit RGB pixel format, 8 bits per channel.
40  X8R8G8B8
41  };
42 
43  virtual ~IColorBuffer() {}
44 
47  virtual sal_uInt8* lock() const = 0;
48 
51  virtual void unlock() const = 0;
52 
55  virtual sal_uInt32 getWidth() const = 0;
56 
59  virtual sal_uInt32 getHeight() const = 0;
60 
66  virtual sal_uInt32 getStride() const = 0;
67 
70  virtual Format getFormat() const = 0;
71  };
72 }
73 
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_uInt8 * lock() const =0
Get a pointer to the raw memory bits of the pixel.
virtual Format getFormat() const =0
Get format of the color buffer.
virtual sal_uInt32 getWidth() const =0
Get width in pixel.
virtual sal_uInt32 getStride() const =0
Offset, in bytes, between consecutive scan lines of the bitmap.
Format
The underlying pixel format for this buffer.
unsigned char sal_uInt8
Interface for a raw memory pixel container.
virtual sal_uInt32 getHeight() const =0
Get height in pixel.
virtual void unlock() const =0
unlock previous locked buffer