LibreOffice Module vcl (master)  1
opengl/salbmp.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 #ifndef INCLUDED_VCL_INC_OPENGL_SALBMP_H
21 #define INCLUDED_VCL_INC_OPENGL_SALBMP_H
22 
24 
25 #include <opengl/texture.hxx>
26 
27 #include <salbmp.hxx>
28 
29 #include <memory>
30 
31 struct BitmapBuffer;
32 class BitmapPalette;
33 namespace vcl
34 {
35  class Kernel;
36 }
37 
39 {
40 private:
44  std::shared_ptr<sal_uInt8> mpUserBuffer;
45  sal_uInt16 mnBits;
46  sal_uInt32 mnBytesPerRow;
47  int mnWidth;
48  int mnHeight;
49 
50  virtual void updateChecksum() const override;
51 
52  bool calcChecksumGL(OpenGLTexture& rInputTexture, BitmapChecksum& rChecksum) const;
53 
54 public:
56  virtual ~OpenGLSalBitmap() override;
57 
58 public:
59 
60  // SalBitmap methods
61  bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override;
62  bool Create( const SalBitmap& rSalBmp ) override;
63  bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override;
64  bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) override;
65  virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
66  Size& rSize,
67  bool bMask = false ) override;
68 
69  void Destroy() final override;
70 
71  Size GetSize() const override;
72  sal_uInt16 GetBitCount() const override;
73 
74  BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
75  void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
76 
77  bool GetSystemData( BitmapSystemData& rData ) override;
78 
79  bool ScalingSupported() const override;
80  bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
81  bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
82  bool ConvertToGreyscale() override;
83  bool InterpretAs8Bit() override;
84 
85 public:
86 
87  void Create( const OpenGLTexture& rTex, long nX, long nY, long nWidth, long nHeight );
88  OpenGLTexture& GetTexture() const;
89  const BitmapPalette& GetBitmapPalette() const { return maPalette; }
90 
91 private:
92 
93  GLuint CreateTexture();
94  bool AllocateUserData();
95  void DeallocateUserData();
96  bool ReadTexture();
97 
98 private:
99 
100  bool ImplScaleFilter( const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, GLenum nFilter );
101  static void ImplCreateKernel( const double& fScale, const vcl::Kernel& rKernel, GLfloat*& pWeights, sal_uInt32& aKernelSize );
102  bool ImplScaleConvolution(const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, const vcl::Kernel& rKernel);
103  bool ImplScaleArea( const rtl::Reference< OpenGLContext > &xContext,
104  double rScaleX, double rScaleY );
105 
106 public:
107 
108  void ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag );
109 };
110 
111 #endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
virtual void updateChecksum() const
Definition: salbmp.cxx:34
std::shared_ptr< sal_uInt8 > mpUserBuffer
virtual bool Create(const Size &rSize, sal_uInt16 nBitCount, const BitmapPalette &rPal)=0
sal_uInt16 mnBits
virtual void Destroy()=0
sal_uInt32 mnBytesPerRow
BitmapAccessMode
BmpScaleFlag
Definition: bitmap.hxx:48
OpenGLTexture maTexture
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
unsigned char sal_uInt8
BitmapPalette maPalette