Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
magicseteditor
Commits
10c1418b
Commit
10c1418b
authored
Dec 22, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for masks in choice styles
parent
7b11e13c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
4 deletions
+22
-4
src/data/field/choice.cpp
src/data/field/choice.cpp
+9
-1
src/data/field/choice.hpp
src/data/field/choice.hpp
+4
-0
src/data/field/text.cpp
src/data/field/text.cpp
+1
-1
src/gfx/blend_image.cpp
src/gfx/blend_image.cpp
+1
-1
src/render/value/choice.cpp
src/render/value/choice.cpp
+6
-0
src/script/script_manager.cpp
src/script/script_manager.cpp
+1
-1
No files found.
src/data/field/choice.cpp
View file @
10c1418b
...
...
@@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------- : Includes
#include <data/field/choice.hpp>
#include <util/io/package.hpp>
DECLARE_TYPEOF_COLLECTION
(
ChoiceField
::
ChoiceP
);
typedef
map
<
String
,
ScriptableImage
>
map_String_ScriptableImage
;
...
...
@@ -185,6 +186,13 @@ void ChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
}
}
void
ChoiceStyle
::
loadMask
(
Package
&
pkg
)
{
if
(
mask
.
Ok
()
||
mask_filename
.
empty
())
return
;
// load file
InputStreamP
image_file
=
pkg
.
openIn
(
mask_filename
);
mask
.
LoadFile
(
*
image_file
);
}
IMPLEMENT_REFLECTION_ENUM
(
ChoicePopupStyle
)
{
VALUE_N
(
"dropdown"
,
POPUP_DROPDOWN
);
VALUE_N
(
"menu"
,
POPUP_MENU
);
...
...
@@ -204,7 +212,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
REFLECT_BASE
(
Style
);
REFLECT
(
popup_style
);
REFLECT
(
render_style
);
REFLECT_N
(
"ma
ks
"
,
mask_filename
);
REFLECT_N
(
"ma
sk
"
,
mask_filename
);
REFLECT
(
combine
);
REFLECT
(
alignment
);
REFLECT
(
colors_card_list
);
...
...
src/data/field/choice.hpp
View file @
10c1418b
...
...
@@ -125,6 +125,10 @@ class ChoiceStyle : public Style {
String
mask_filename
;
///< Filename of an additional mask over the images
ImageCombine
combine
;
///< Combining mode for drawing the images
Alignment
alignment
;
///< Alignment of images
Image
mask
;
///< The actual mask image
/// Load the mask image, if it's not already done
void
loadMask
(
Package
&
pkg
);
virtual
bool
update
(
Context
&
);
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
...
...
src/data/field/text.cpp
View file @
10c1418b
...
...
@@ -95,7 +95,7 @@ String TextValue::toString() const {
}
bool
TextValue
::
update
(
Context
&
ctx
)
{
Value
::
update
(
ctx
);
WITH_DYNAMIC_ARG
(
last_update_age
,
last_update
.
get
());
WITH_DYNAMIC_ARG
(
last_update_age
,
value
.
isDefault
()
?
0
:
last_update
.
get
());
bool
change
=
field
().
default_script
.
invokeOnDefault
(
ctx
,
value
)
|
field
().
script
.
invokeOn
(
ctx
,
value
);
if
(
change
)
last_update
.
update
();
...
...
src/gfx/blend_image.cpp
View file @
10c1418b
...
...
@@ -77,7 +77,7 @@ void mask_blend(Image& img1, const Image& img2, const Image& mask) {
void
set_alpha
(
Image
&
img
,
const
Image
&
img_alpha
)
{
if
(
img
.
GetWidth
()
!=
img_alpha
.
GetWidth
()
||
img
.
GetHeight
()
!=
img_alpha
.
GetHeight
())
{
throw
InternalError
(
_
(
"Image used with maks
must have same size as mask"
));
throw
Error
(
_
(
"Image
must have same size as mask"
));
}
if
(
!
img
.
HasAlpha
())
img
.
InitAlpha
();
Byte
*
im
=
img
.
GetAlpha
(),
*
al
=
img_alpha
.
GetData
();
...
...
src/render/value/choice.cpp
View file @
10c1418b
...
...
@@ -34,6 +34,12 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
);
}
if
(
i
)
{
// apply mask?
style
().
loadMask
(
*
viewer
.
stylesheet
);
if
(
style
().
mask
.
Ok
())
{
set_alpha
(
i
->
image
,
style
().
mask
);
}
// draw
dc
.
DrawImage
(
i
->
image
,
align_in_rect
(
style
().
alignment
,
RealSize
(
i
->
image
.
GetWidth
(),
i
->
image
.
GetHeight
()),
style
().
getRect
()),
i
->
combine
==
COMBINE_NORMAL
?
style
().
combine
:
i
->
combine
...
...
src/script/script_manager.cpp
View file @
10c1418b
...
...
@@ -30,7 +30,7 @@ DECLARE_TYPEOF_NO_REV(IndexMap_FieldP_ValueP);
void
init_script_functions
(
Context
&
ctx
);
void
init_script_image_functions
(
Context
&
ctx
);
#define LOG_UPDATES
//
#define LOG_UPDATES
// ----------------------------------------------------------------------------- : SetScriptContext : initialization
...
...
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