imagewrapper.cxx (6d739b60) imagewrapper.cxx (45fd3b9a)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 17 unchanged lines hidden (view full) ---

26
27#include <classes/imagewrapper.hxx>
28#include <osl/mutex.hxx>
29#include <vcl/svapp.hxx>
30#include <vcl/bitmap.hxx>
31#include <vcl/bitmapex.hxx>
32#include <tools/stream.hxx>
33#include <cppuhelper/typeprovider.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 17 unchanged lines hidden (view full) ---

26
27#include <classes/imagewrapper.hxx>
28#include <osl/mutex.hxx>
29#include <vcl/svapp.hxx>
30#include <vcl/bitmap.hxx>
31#include <vcl/bitmapex.hxx>
32#include <tools/stream.hxx>
33#include <cppuhelper/typeprovider.hxx>
34#include <vcl/dibtools.hxx>
34
35using namespace com::sun::star::lang;
36using namespace com::sun::star::uno;
37
38namespace framework
39{
40
41static Sequence< sal_Int8 > impl_getStaticIdentifier()

--- 31 unchanged lines hidden (view full) ---

73 return com::sun::star::awt::Size( aBitmapSize.Width(), aBitmapSize.Height() );
74}
75
76Sequence< sal_Int8 > SAL_CALL ImageWrapper::getDIB() throw ( RuntimeException )
77{
78 vos::OGuard aGuard( Application::GetSolarMutex() );
79
80 SvMemoryStream aMem;
35
36using namespace com::sun::star::lang;
37using namespace com::sun::star::uno;
38
39namespace framework
40{
41
42static Sequence< sal_Int8 > impl_getStaticIdentifier()

--- 31 unchanged lines hidden (view full) ---

74 return com::sun::star::awt::Size( aBitmapSize.Width(), aBitmapSize.Height() );
75}
76
77Sequence< sal_Int8 > SAL_CALL ImageWrapper::getDIB() throw ( RuntimeException )
78{
79 vos::OGuard aGuard( Application::GetSolarMutex() );
80
81 SvMemoryStream aMem;
81 aMem << m_aImage.GetBitmapEx().GetBitmap();
82 WriteDIB(m_aImage.GetBitmapEx().GetBitmap(), aMem, false, true);
82 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
83}
84
85Sequence< sal_Int8 > SAL_CALL ImageWrapper::getMaskDIB() throw ( RuntimeException )
86{
87 vos::OGuard aGuard( Application::GetSolarMutex() );
88 BitmapEx aBmpEx( m_aImage.GetBitmapEx() );
89
90 if ( aBmpEx.IsAlpha() )
91 {
92 SvMemoryStream aMem;
83 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
84}
85
86Sequence< sal_Int8 > SAL_CALL ImageWrapper::getMaskDIB() throw ( RuntimeException )
87{
88 vos::OGuard aGuard( Application::GetSolarMutex() );
89 BitmapEx aBmpEx( m_aImage.GetBitmapEx() );
90
91 if ( aBmpEx.IsAlpha() )
92 {
93 SvMemoryStream aMem;
93 aMem << aBmpEx.GetAlpha().GetBitmap();
94 WriteDIB(aBmpEx.GetAlpha().GetBitmap(), aMem, false, true);
94 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
95 }
96 else if ( aBmpEx.IsTransparent() )
97 {
98 SvMemoryStream aMem;
95 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
96 }
97 else if ( aBmpEx.IsTransparent() )
98 {
99 SvMemoryStream aMem;
99 aMem << aBmpEx.GetMask();
100 WriteDIB(aBmpEx.GetMask(), aMem, false, true);
100 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
101 }
102
103 return Sequence< sal_Int8 >();
104}
105
106// XUnoTunnel
107sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw ( RuntimeException )
108{
109 if ( aIdentifier == impl_getStaticIdentifier() )
110 return reinterpret_cast< sal_Int64 >( this );
111 else
112 return 0;
113}
114
115}
116
101 return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
102 }
103
104 return Sequence< sal_Int8 >();
105}
106
107// XUnoTunnel
108sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw ( RuntimeException )
109{
110 if ( aIdentifier == impl_getStaticIdentifier() )
111 return reinterpret_cast< sal_Int64 >( this );
112 else
113 return 0;
114}
115
116}
117