LibreOffice Module canvas (master)  1
surface.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 
29 
30 #include "pagemanager.hxx"
31 
32 namespace canvas
33 {
40  class Surface
41  {
42  public:
43 
44  Surface( const PageManagerSharedPtr& rPageManager,
45  const std::shared_ptr<IColorBuffer>& rColorBuffer,
46  const ::basegfx::B2IPoint& rPos,
47  const ::basegfx::B2ISize& rSize );
48  ~Surface();
49 
50  void setColorBufferDirty();
51 
63  bool draw( double fAlpha,
64  const ::basegfx::B2DPoint& rPos,
65  const ::basegfx::B2DHomMatrix& rTransform );
66 
84  double fAlpha,
85  const ::basegfx::B2DPoint& rPos,
86  const ::basegfx::B2DRectangle& rArea,
87  const ::basegfx::B2DHomMatrix& rTransform );
88 
104  bool drawWithClip( double fAlpha,
105  const ::basegfx::B2DPoint& rPos,
106  const ::basegfx::B2DPolygon& rClipPoly,
107  const ::basegfx::B2DHomMatrix& rTransform );
108 
109  private:
110  std::shared_ptr<IColorBuffer> mpColorBuffer;
111 
112  // invoking any of the above defined 'draw' methods
113  // will forward primitive commands to the rendermodule.
115 
117 
118  // the offset of this surface with regard to the source
119  // image. if the source image had to be tiled into multiple
120  // surfaces, this offset denotes the relative pixel distance
121  // from the source image's upper, left corner
123 
124  // the size in pixels of this surface. please note that
125  // this size is likely to be smaller than the size of
126  // the colorbuffer we're associated with since we
127  // maybe represent only a part of it.
129 
130  bool mbIsDirty;
131 
132  private:
133  void prepareRendering();
134 
136  basegfx::B2DRectangle getUVCoords( const ::basegfx::B2IPoint& rPos,
137  const ::basegfx::B2ISize& rSize ) const;
138  };
139 
140  typedef std::shared_ptr< Surface > SurfaceSharedPtr;
141 }
142 
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PageManagerSharedPtr mpPageManager
Definition: surface.hxx:114
std::shared_ptr< IColorBuffer > mpColorBuffer
Definition: surface.hxx:110
basegfx::B2DRectangle getUVCoords() const
Definition: surface.cxx:54
::basegfx::B2ISize maSize
Definition: surface.hxx:128
void setColorBufferDirty()
Definition: surface.cxx:49
::basegfx::B2IPoint maSourceOffset
Definition: surface.hxx:122
bool draw(double fAlpha, const ::basegfx::B2DPoint &rPos, const ::basegfx::B2DHomMatrix &rTransform)
Render the surface content to screen.
Definition: surface.cxx:92
std::shared_ptr< PageManager > PageManagerSharedPtr
Definition: pagemanager.hxx:72
bool drawWithClip(double fAlpha, const ::basegfx::B2DPoint &rPos, const ::basegfx::B2DPolygon &rClipPoly, const ::basegfx::B2DHomMatrix &rTransform)
Render the surface content to screen.
Definition: surface.cxx:308
bool drawRectangularArea(double fAlpha, const ::basegfx::B2DPoint &rPos, const ::basegfx::B2DRectangle &rArea, const ::basegfx::B2DHomMatrix &rTransform)
Render the surface content to screen.
Definition: surface.cxx:187
FragmentSharedPtr mpFragment
Definition: surface.hxx:116
Surface(const PageManagerSharedPtr &rPageManager, const std::shared_ptr< IColorBuffer > &rColorBuffer, const ::basegfx::B2IPoint &rPos, const ::basegfx::B2ISize &rSize)
Definition: surface.cxx:30
void prepareRendering()
Definition: surface.cxx:404
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: surface.hxx:140
surfaces denote occupied areas within pages.
Definition: surface.hxx:40
std::shared_ptr< PageFragment > FragmentSharedPtr
Definition: page.hxx:34