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
999fc135
Kaydet (Commit)
999fc135
authored
Kas 07, 2014
tarafından
Michael Meeks
Kaydeden (comit)
Markus Mohrhard
Kas 10, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcldemo: initial bitmap tests.
Change-Id: I2841e689b732467f2168450dc47464b322baa183
üst
f5910731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
9 deletions
+57
-9
vcldemo.cxx
vcl/workben/vcldemo.cxx
+57
-9
No files found.
vcl/workben/vcldemo.cxx
Dosyayı görüntüle @
999fc135
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
#include <rtl/bootstrap.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
...
@@ -16,16 +17,41 @@
...
@@ -16,16 +17,41 @@
#include <vcl/vclmain.hxx>
#include <vcl/vclmain.hxx>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
#include <vcl/svapp.hxx>
#include <vcl/pngread.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/graphicfilter.hxx>
using
namespace
css
;
using
namespace
css
;
class
DemoWin
:
public
WorkWindow
class
DemoWin
:
public
WorkWindow
{
{
Bitmap
maIntroBW
;
BitmapEx
maIntro
;
public
:
public
:
DemoWin
()
:
WorkWindow
(
NULL
,
WB_APP
|
WB_STDWORK
)
DemoWin
()
:
WorkWindow
(
NULL
,
WB_APP
|
WB_STDWORK
)
{
{
// Needed to find images
OUString
aPath
;
rtl
::
Bootstrap
::
get
(
"SYSBINDIR"
,
aPath
);
#ifdef FIXME_THIS_FAILS
rtl
::
Bootstrap
::
set
(
"BRAND_BASE_DIR"
,
aPath
+
"/.."
);
if
(
Application
::
LoadBrandBitmap
(
"intro"
,
maIntro
))
Application
::
Abort
(
"Failed to load intro image"
);
#else
aPath
=
aPath
+
"/intro.png"
;
SvFileStream
aFileStream
(
aPath
,
STREAM_READ
);
GraphicFilter
aGraphicFilter
(
false
);
Graphic
aGraphic
;
if
(
aGraphicFilter
.
ImportGraphic
(
aGraphic
,
aPath
,
aFileStream
)
!=
0
)
Application
::
Abort
(
"Failed to load intro image: "
+
aPath
);
maIntro
=
aGraphic
.
GetBitmapEx
();
#endif
maIntroBW
=
maIntro
.
GetBitmap
();
maIntroBW
.
Filter
(
BMP_FILTER_EMBOSS_GREY
);
}
}
virtual
void
Paint
(
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
void
Paint
(
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
...
@@ -46,9 +72,10 @@ public:
...
@@ -46,9 +72,10 @@ public:
void
drawRadialLines
(
Rectangle
r
)
void
drawRadialLines
(
Rectangle
r
)
{
{
SetFillColor
(
Color
(
COL_LIGHTRED
));
SetFillColor
(
Color
(
COL_LIGHTRED
));
SetLineColor
(
Color
(
COL_
LIGHTGREEN
));
SetLineColor
(
Color
(
COL_
BLACK
));
DrawRect
(
r
);
DrawRect
(
r
);
// FIXME: notice these appear reflected at the bottom not the top.
for
(
int
i
=
0
;
i
<
r
.
GetHeight
();
i
+=
15
)
for
(
int
i
=
0
;
i
<
r
.
GetHeight
();
i
+=
15
)
DrawLine
(
Point
(
r
.
Left
(),
r
.
Top
()
+
i
),
Point
(
r
.
Right
(),
r
.
Bottom
()
-
i
)
);
DrawLine
(
Point
(
r
.
Left
(),
r
.
Top
()
+
i
),
Point
(
r
.
Right
(),
r
.
Bottom
()
-
i
)
);
for
(
int
i
=
0
;
i
<
r
.
GetWidth
();
i
+=
15
)
for
(
int
i
=
0
;
i
<
r
.
GetWidth
();
i
+=
15
)
...
@@ -69,12 +96,10 @@ public:
...
@@ -69,12 +96,10 @@ public:
SetLineColor
(
Color
(
COL_RED
));
SetLineColor
(
Color
(
COL_RED
));
// DrawPolyLine(aPoly);
// DrawPolyLine(aPoly);
}
}
void
drawPolyPoly
(
Rectangle
r
)
void
drawPolyPoly
(
Rectangle
r
)
{
{
(
void
)
r
;
(
void
)
r
;
}
}
void
drawCheckered
(
Rectangle
r
)
void
drawCheckered
(
Rectangle
r
)
{
{
DrawCheckered
(
r
.
TopLeft
(),
r
.
GetSize
());
DrawCheckered
(
r
.
TopLeft
(),
r
.
GetSize
());
...
@@ -82,13 +107,31 @@ public:
...
@@ -82,13 +107,31 @@ public:
void
drawGradient
(
Rectangle
r
)
void
drawGradient
(
Rectangle
r
)
{
{
Gradient
aGradient
;
Gradient
aGradient
;
aGradient
.
SetStartColor
(
COL_
BLUE
);
aGradient
.
SetStartColor
(
COL_
YELLOW
);
aGradient
.
SetEndColor
(
COL_
GREEN
);
aGradient
.
SetEndColor
(
COL_
RED
);
// aGradient.SetAngle(45);
// aGradient.SetAngle(45);
aGradient
.
SetStyle
(
GradientStyle_
LINEAR
);
aGradient
.
SetStyle
(
GradientStyle_
RECT
);
aGradient
.
SetBorder
(
r
.
GetSize
().
Width
()
/
20
);
aGradient
.
SetBorder
(
r
.
GetSize
().
Width
()
/
20
);
DrawGradient
(
r
,
aGradient
);
DrawGradient
(
r
,
aGradient
);
}
}
void
drawBitmap
(
Rectangle
r
)
{
Bitmap
aBitmap
(
maIntroBW
);
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
}
void
drawBitmapEx
(
Rectangle
r
)
{
BitmapEx
aBitmap
(
maIntro
);
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
DrawBitmapEx
(
r
.
TopLeft
(),
aBitmap
);
}
void
fetchDrawBitmap
(
Rectangle
r
)
{
Bitmap
aBitmap
(
GetBitmap
(
Point
(
0
,
0
),
GetSizePixel
()));
aBitmap
.
Scale
(
r
.
GetSize
(),
BMP_SCALE_BESTQUALITY
);
DrawBitmap
(
r
.
TopLeft
(),
aBitmap
);
}
};
};
std
::
vector
<
Rectangle
>
DemoWin
::
partitionAndClear
(
int
nX
,
int
nY
)
std
::
vector
<
Rectangle
>
DemoWin
::
partitionAndClear
(
int
nX
,
int
nY
)
...
@@ -100,8 +143,7 @@ std::vector<Rectangle> DemoWin::partitionAndClear(int nX, int nY)
...
@@ -100,8 +143,7 @@ std::vector<Rectangle> DemoWin::partitionAndClear(int nX, int nY)
Size
aSize
(
GetSizePixel
());
Size
aSize
(
GetSizePixel
());
long
nBorderSize
=
aSize
.
Width
()
/
32
;
long
nBorderSize
=
aSize
.
Width
()
/
32
;
long
nBoxWidth
=
(
aSize
.
Width
()
-
nBorderSize
*
(
nX
+
1
))
/
nX
;
long
nBoxWidth
=
(
aSize
.
Width
()
-
nBorderSize
*
(
nX
+
1
))
/
nX
;
long
nBoxHeight
=
(
aSize
.
Height
()
-
nBorderSize
*
(
nX
+
1
))
/
nY
;
long
nBoxHeight
=
(
aSize
.
Height
()
-
nBorderSize
*
(
nY
+
1
))
/
nY
;
// SL_DEBUG("Size " << aSize << " boxes " << nBoxWidth << "x" << nBoxHeight << " border " << nBorderSize);
for
(
int
y
=
0
;
y
<
nY
;
y
++
)
for
(
int
y
=
0
;
y
<
nY
;
y
++
)
{
{
for
(
int
x
=
0
;
x
<
nX
;
x
++
)
for
(
int
x
=
0
;
x
<
nX
;
x
++
)
...
@@ -117,7 +159,8 @@ std::vector<Rectangle> DemoWin::partitionAndClear(int nX, int nY)
...
@@ -117,7 +159,8 @@ std::vector<Rectangle> DemoWin::partitionAndClear(int nX, int nY)
DrawRect
(
r
);
DrawRect
(
r
);
else
else
DrawRect
(
r
);
DrawRect
(
r
);
// DrawRect(r, nBorderSize, nBorderSize); FIXME - lfrb
// FIXME: rendering these guys doesn't work at all
// DrawRect(r, nBorderSize, nBorderSize);
aRegions
.
push_back
(
r
);
aRegions
.
push_back
(
r
);
}
}
...
@@ -140,7 +183,12 @@ void DemoWin::Paint( const Rectangle& rRect )
...
@@ -140,7 +183,12 @@ void DemoWin::Paint( const Rectangle& rRect )
drawPoly
(
aRegions
[
i
++
]);
drawPoly
(
aRegions
[
i
++
]);
drawPolyPoly
(
aRegions
[
i
++
]);
drawPolyPoly
(
aRegions
[
i
++
]);
drawCheckered
(
aRegions
[
i
++
]);
drawCheckered
(
aRegions
[
i
++
]);
drawBitmapEx
(
aRegions
[
i
++
]);
drawBitmap
(
aRegions
[
i
++
]);
drawGradient
(
aRegions
[
i
++
]);
drawGradient
(
aRegions
[
i
++
]);
// last - thumbnail all the above
fetchDrawBitmap
(
aRegions
[
i
++
]);
assert
(
i
<=
12
);
}
}
class
DemoApp
:
public
Application
class
DemoApp
:
public
Application
...
...
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