Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
dca73ef8
Kaydet (Commit)
dca73ef8
authored
Kas 08, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
support to load SVG images when loading from Image resource
Change-Id: Ieda1c334d8d995c774381c52fa1d9aa11751c5ef
üst
8d95cf54
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
0 deletions
+131
-0
BitmapTools.hxx
include/vcl/BitmapTools.hxx
+30
-0
Library_vcl.mk
vcl/Library_vcl.mk
+1
-0
BitmapTools.cxx
vcl/source/bitmap/BitmapTools.cxx
+95
-0
impimagetree.cxx
vcl/source/gdi/impimagetree.cxx
+5
-0
No files found.
include/vcl/BitmapTools.hxx
0 → 100644
Dosyayı görüntüle @
dca73ef8
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_VCL_BITMAP_TOOLS_HXX
#define INCLUDED_VCL_BITMAP_TOOLS_HXX
#include <vcl/bitmapex.hxx>
#include <tools/stream.hxx>
namespace
vcl
{
class
VCL_DLLPUBLIC
BitmapTools
{
public
:
static
void
loadFromSvg
(
SvStream
&
rStream
,
const
OUString
&
sPath
,
BitmapEx
&
rBitmapEx
,
double
fScaleFactor
=
1.0
,
const
Size
&
aSize
=
Size
());
};
}
#endif // INCLUDED_VCL_BITMAP_TOOLS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/Library_vcl.mk
Dosyayı görüntüle @
dca73ef8
...
...
@@ -326,6 +326,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/bitmap/BitmapSymmetryCheck \
vcl/source/bitmap/BitmapFilterStackBlur \
vcl/source/bitmap/BitmapProcessor \
vcl/source/bitmap/BitmapTools \
vcl/source/bitmap/checksum \
vcl/source/helper/canvasbitmap \
vcl/source/helper/canvastools \
...
...
vcl/source/bitmap/BitmapTools.cxx
0 → 100644
Dosyayı görüntüle @
dca73ef8
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#include <vcl/BitmapTools.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/seqstream.hxx>
#include <vcl/canvastools.hxx>
#include <com/sun/star/graphic/SvgTools.hpp>
#include <com/sun/star/graphic/Primitive2DTools.hpp>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
using
namespace
css
;
using
drawinglayer
::
primitive2d
::
Primitive2DSequence
;
using
drawinglayer
::
primitive2d
::
Primitive2DReference
;
namespace
vcl
{
void
BitmapTools
::
loadFromSvg
(
SvStream
&
rStream
,
const
OUString
&
sPath
,
BitmapEx
&
rBitmapEx
,
double
fScalingFactor
,
const
Size
&
aSize
)
{
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
(
comphelper
::
getProcessComponentContext
());
const
uno
::
Reference
<
graphic
::
XSvgParser
>
xSvgParser
=
graphic
::
SvgTools
::
create
(
xContext
);
sal_Size
nSize
=
rStream
.
remainingSize
();
std
::
vector
<
sal_Int8
>
pBuffer
(
nSize
+
1
);
rStream
.
Read
(
pBuffer
.
data
(),
nSize
);
pBuffer
[
nSize
]
=
0
;
uno
::
Sequence
<
sal_Int8
>
aData
(
pBuffer
.
data
(),
nSize
+
1
);
uno
::
Reference
<
io
::
XInputStream
>
aInputStream
(
new
comphelper
::
SequenceInputStream
(
aData
));
Primitive2DSequence
aPrimitiveSequence
=
xSvgParser
->
getDecomposition
(
aInputStream
,
sPath
);
if
(
aPrimitiveSequence
.
hasElements
())
{
uno
::
Sequence
<
beans
::
PropertyValue
>
aViewParameters
;
const
sal_Int32
nCount
(
aPrimitiveSequence
.
getLength
());
geometry
::
RealRectangle2D
aRealRect
;
basegfx
::
B2DRange
aRange
;
for
(
sal_Int32
a
=
0L
;
a
<
nCount
;
++
a
)
{
const
Primitive2DReference
xReference
(
aPrimitiveSequence
[
a
]);
if
(
xReference
.
is
())
{
aRealRect
=
xReference
->
getRange
(
aViewParameters
);
aRange
.
expand
(
basegfx
::
B2DRange
(
aRealRect
.
X1
,
aRealRect
.
Y1
,
aRealRect
.
X2
,
aRealRect
.
Y2
));
}
}
bool
bIsSizeEmpty
=
(
aSize
.
Width
()
==
0
&&
aSize
.
Height
()
==
0
);
aRealRect
.
X1
=
0
;
aRealRect
.
Y1
=
0
;
aRealRect
.
X2
=
bIsSizeEmpty
?
(
aSize
.
Width
()
*
2540
/
90
)
:
aRange
.
getMaxX
()
-
aRange
.
getMinX
();
aRealRect
.
Y2
=
bIsSizeEmpty
?
(
aSize
.
Height
()
*
2540
/
90
)
:
aRange
.
getMaxY
()
-
aRange
.
getMinY
();
double
nDPI
=
90
*
fScalingFactor
;
const
css
::
uno
::
Reference
<
css
::
graphic
::
XPrimitive2DRenderer
>
xPrimitive2DRenderer
=
css
::
graphic
::
Primitive2DTools
::
create
(
xContext
);
const
css
::
uno
::
Reference
<
css
::
rendering
::
XBitmap
>
xBitmap
(
xPrimitive2DRenderer
->
rasterize
(
aPrimitiveSequence
,
aViewParameters
,
nDPI
,
nDPI
,
aRealRect
,
256
*
256
));
printf
(
"%f %f %f %f
\n
"
,
aRealRect
.
X1
,
aRealRect
.
Y1
,
aRealRect
.
X2
,
aRealRect
.
Y2
);
if
(
xBitmap
.
is
())
{
const
css
::
uno
::
Reference
<
css
::
rendering
::
XIntegerReadOnlyBitmap
>
xIntBmp
(
xBitmap
,
uno
::
UNO_QUERY_THROW
);
if
(
xIntBmp
.
is
())
{
rBitmapEx
=
vcl
::
unotools
::
bitmapExFromXBitmap
(
xIntBmp
);
printf
(
"Size: %d %d
\n
"
,
rBitmapEx
.
GetSizePixel
().
Width
(),
rBitmapEx
.
GetSizePixel
().
Height
());
}
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/source/gdi/impimagetree.cxx
Dosyayı görüntüle @
dca73ef8
...
...
@@ -47,6 +47,7 @@
#include <vcldemo-debug.hxx>
#include <vcl/BitmapProcessor.hxx>
#include <vcl/BitmapTools.hxx>
using
namespace
css
;
...
...
@@ -86,6 +87,10 @@ static void loadImageFromStream(std::shared_ptr<SvStream> xStream, OUString cons
aPNGReader
.
SetIgnoreGammaChunk
(
true
);
rBitmap
=
aPNGReader
.
Read
();
}
else
if
(
rPath
.
endsWith
(
".svg"
))
{
vcl
::
BitmapTools
::
loadFromSvg
(
*
xStream
.
get
(),
rPath
,
rBitmap
);
}
else
{
ReadDIBBitmapEx
(
rBitmap
,
*
xStream
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment