bump product version to 6.3.0.0.beta1
[LibreOffice.git] / toolkit / source / awt / vclxbitmap.cxx
blobc5cd50b9ac1b54c2413c140bed91a6158b4718a9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <toolkit/awt/vclxbitmap.hxx>
21 #include <toolkit/helper/macros.hxx>
22 #include <cppuhelper/typeprovider.hxx>
23 #include <cppuhelper/queryinterface.hxx>
24 #include <tools/stream.hxx>
25 #include <rtl/uuid.h>
26 #include <vcl/dibtools.hxx>
27 #include <vcl/BitmapTools.hxx>
30 // class VCLXBitmap
33 // css::uno::XInterface
34 css::uno::Any VCLXBitmap::queryInterface( const css::uno::Type & rType )
36 css::uno::Any aRet = ::cppu::queryInterface( rType,
37 static_cast< css::awt::XBitmap* >(this),
38 static_cast< css::awt::XDisplayBitmap* >(this),
39 static_cast< css::lang::XUnoTunnel* >(this),
40 static_cast< css::lang::XTypeProvider* >(this) );
41 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
44 // css::lang::XUnoTunnel
45 IMPL_XUNOTUNNEL( VCLXBitmap )
47 IMPL_IMPLEMENTATION_ID( VCLXBitmap )
49 // css::lang::XTypeProvider
50 css::uno::Sequence< css::uno::Type > VCLXBitmap::getTypes()
52 static const css::uno::Sequence< css::uno::Type > aTypeList {
53 cppu::UnoType<css::lang::XTypeProvider>::get(),
54 cppu::UnoType<css::awt::XBitmap>::get(),
55 cppu::UnoType<css::awt::XDisplayBitmap>::get()
57 return aTypeList;
61 // css::awt::XBitmap
62 css::awt::Size VCLXBitmap::getSize()
64 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
66 css::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
67 return aSize;
70 css::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB()
72 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
74 SvMemoryStream aMem;
75 WriteDIB(maBitmap.GetBitmap(), aMem, false, true);
76 return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
79 css::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB()
81 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
83 return vcl::bitmap::GetMaskDIB(maBitmap);
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */