Line data Source code
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 :
21 : #include "SlsBitmapFactory.hxx"
22 :
23 : #include "PreviewRenderer.hxx"
24 : #include "view/SlideSorterView.hxx"
25 : #include "sdpage.hxx"
26 : #include "Window.hxx"
27 : #include <drawdoc.hxx>
28 : #include "DrawDocShell.hxx"
29 : #include <svx/svdtypes.hxx>
30 : #include <svx/svdpage.hxx>
31 : #include <vcl/bitmapex.hxx>
32 : #include <vcl/bmpacc.hxx>
33 : #include <vcl/pngwrite.hxx>
34 :
35 : namespace sd { namespace slidesorter { namespace view {
36 : class SlideSorterView;
37 : class PageObjectViewObjectContact;
38 : } } }
39 :
40 : namespace sd { namespace slidesorter { namespace cache {
41 :
42 0 : BitmapFactory::BitmapFactory (void)
43 0 : : maRenderer(NULL, false)
44 : {
45 0 : }
46 :
47 :
48 :
49 :
50 0 : BitmapFactory::~BitmapFactory (void)
51 : {
52 0 : }
53 :
54 :
55 :
56 :
57 0 : Bitmap BitmapFactory::CreateBitmap (
58 : const SdPage& rPage,
59 : const Size& rPixelSize,
60 : const bool bDoSuperSampling)
61 : {
62 0 : Size aSize (rPixelSize);
63 0 : if (bDoSuperSampling)
64 : {
65 : // Supersampling factor
66 0 : int aSuperSamplingFactor = 2;
67 0 : aSize.Width() *= aSuperSamplingFactor;
68 0 : aSize.Height() *= aSuperSamplingFactor;
69 : }
70 :
71 : Bitmap aPreview (maRenderer.RenderPage (
72 : &rPage,
73 : aSize,
74 : String(),
75 : true,
76 0 : false).GetBitmapEx().GetBitmap());
77 0 : if (bDoSuperSampling)
78 : {
79 0 : aPreview.Scale(rPixelSize, BMP_SCALE_BEST);
80 : }
81 :
82 0 : return aPreview;
83 : }
84 :
85 :
86 : } } } // end of namespace ::sd::slidesorter::cache
87 :
88 :
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|