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