Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
ab603b47
Commit
ab603b47
authored
Mar 27, 2004
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: beginning of "text" bitmap font support. The text bitmap must have
the following layout: [cf xmms skins ;)]
parent
00aa16f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
22 deletions
+56
-22
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder.cpp
+1
-1
modules/gui/skins2/src/bitmap_font.cpp
modules/gui/skins2/src/bitmap_font.cpp
+39
-20
modules/gui/skins2/src/bitmap_font.hpp
modules/gui/skins2/src/bitmap_font.hpp
+16
-1
No files found.
modules/gui/skins2/parser/builder.cpp
View file @
ab603b47
...
...
@@ -144,7 +144,7 @@ void Builder::addBitmapFont( const BuilderData::BitmapFont &rData )
GenericBitmap
*
pBmp
=
new
PngBitmap
(
getIntf
(),
rData
.
m_file
,
0
);
m_pTheme
->
m_bitmaps
[
rData
.
m_id
]
=
GenericBitmapPtr
(
pBmp
);
GenericFont
*
pFont
=
new
BitmapFont
(
getIntf
(),
*
pBmp
);
GenericFont
*
pFont
=
new
BitmapFont
(
getIntf
(),
*
pBmp
,
rData
.
m_type
);
if
(
pFont
->
init
()
)
{
m_pTheme
->
m_fonts
[
rData
.
m_id
]
=
GenericFontPtr
(
pFont
);
...
...
modules/gui/skins2/src/bitmap_font.cpp
View file @
ab603b47
...
...
@@ -26,11 +26,39 @@
#include "../utils/ustring.hpp"
BitmapFont
::
BitmapFont
(
intf_thread_t
*
pIntf
,
const
GenericBitmap
&
rBitmap
)
:
BitmapFont
::
BitmapFont
(
intf_thread_t
*
pIntf
,
const
GenericBitmap
&
rBitmap
,
const
string
&
rType
)
:
GenericFont
(
pIntf
),
m_rBitmap
(
rBitmap
)
{
m_width
=
9
;
m_height
=
13
;
if
(
rType
==
"digits"
)
{
m_width
=
9
;
m_height
=
13
;
m_advance
=
12
;
m_skip
=
6
;
for
(
int
i
=
0
;
i
<=
9
;
i
++
)
{
m_table
[
'0'
+
i
].
m_xPos
=
i
*
m_width
;
}
m_table
[(
size_t
)
'-'
].
m_xPos
=
11
*
m_width
;
}
else
if
(
rType
==
"text"
)
{
m_width
=
5
;
m_height
=
6
;
m_advance
=
5
;
m_skip
=
5
;
for
(
int
i
=
0
;
i
<
26
;
i
++
)
{
m_table
[
'A'
+
i
].
m_xPos
=
i
*
m_width
;
m_table
[
'a'
+
i
].
m_xPos
=
i
*
m_width
;
}
for
(
int
i
=
0
;
i
<=
9
;
i
++
)
{
m_table
[
'0'
+
i
].
m_xPos
=
i
*
m_width
;
m_table
[
'0'
+
i
].
m_yPos
=
m_height
;
}
}
}
...
...
@@ -43,13 +71,13 @@ GenericBitmap *BitmapFont::drawString( const UString &rString,
for
(
uint32_t
*
ptr
=
pString
;
*
ptr
;
ptr
++
)
{
uint32_t
c
=
*
ptr
;
if
(
(
c
>=
'0'
&&
c
<=
'9'
)
||
c
==
'-'
)
if
(
c
<
256
&&
m_table
[
c
].
m_xPos
!=
-
1
)
{
width
+=
m_
width
+
3
;
width
+=
m_
advance
;
}
else
{
width
+=
6
;
width
+=
m_skip
;
}
}
// Create a bitmap
...
...
@@ -58,24 +86,15 @@ GenericBitmap *BitmapFont::drawString( const UString &rString,
while
(
*
pString
)
{
uint32_t
c
=
*
(
pString
++
);
int
xSrc
=
-
1
;
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
xSrc
=
(
c
-
'0'
)
*
m_width
;
}
else
if
(
c
==
'-'
)
{
xSrc
=
11
*
m_width
;
}
if
(
xSrc
!=
-
1
)
if
(
c
<
256
&&
m_table
[
c
].
m_xPos
!=
-
1
)
{
pBmp
->
drawBitmap
(
m_rBitmap
,
xSrc
,
0
,
xDest
,
0
,
m_width
,
m_height
);
xDest
+=
m_
width
+
3
;
pBmp
->
drawBitmap
(
m_rBitmap
,
m_table
[
c
].
m_xPos
,
m_table
[
c
].
m_yPos
,
xDest
,
0
,
m_width
,
m_height
);
xDest
+=
m_
advance
;
}
else
{
xDest
+=
6
;
xDest
+=
m_skip
;
}
}
return
pBmp
;
...
...
modules/gui/skins2/src/bitmap_font.hpp
View file @
ab603b47
...
...
@@ -25,6 +25,7 @@
#define BITMAP_FONT_HPP
#include "generic_font.hpp"
#include <string>
class
GenericBitmap
;
...
...
@@ -33,7 +34,8 @@ class GenericBitmap;
class
BitmapFont
:
public
GenericFont
{
public:
BitmapFont
(
intf_thread_t
*
pIntf
,
const
GenericBitmap
&
rBitmap
);
BitmapFont
(
intf_thread_t
*
pIntf
,
const
GenericBitmap
&
rBitmap
,
const
string
&
rType
);
virtual
~
BitmapFont
()
{}
virtual
bool
init
()
{
return
true
;
}
...
...
@@ -47,10 +49,23 @@ class BitmapFont: public GenericFont
virtual
int
getSize
()
const
{
return
12
;
}
private:
/// Description of a glyph
struct
Glyph_t
{
Glyph_t
()
:
m_xPos
(
-
1
),
m_yPos
(
0
)
{}
int
m_xPos
,
m_yPos
;
};
/// Bitmap
const
GenericBitmap
&
m_rBitmap
;
/// Glyph size
int
m_width
,
m_height
;
/// Horizontal advance between two characters
int
m_advance
;
/// Horizontal advance for non-displayable characters
int
m_skip
;
/// Character table
Glyph_t
m_table
[
256
];
};
#endif
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