Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
0453531d
Commit
0453531d
authored
Dec 15, 2017
by
Vitaly Derbin
Committed by
mrbean-bremen
Dec 17, 2018
Browse files
347
# image opacity fix
parent
e72d713a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Samples/SVGViewer/DebugRenderer.cs
View file @
0453531d
...
...
@@ -37,6 +37,12 @@ namespace SVGViewer
{
}
public
void
DrawImage
(
Image
image
,
RectangleF
destRect
,
RectangleF
srcRect
,
GraphicsUnit
graphicsUnit
,
float
opacity
)
{
}
public
void
DrawImageUnscaled
(
Image
image
,
Point
location
)
{
...
...
@@ -91,8 +97,7 @@ namespace SVGViewer
public
void
TranslateTransform
(
float
dx
,
float
dy
,
MatrixOrder
order
=
MatrixOrder
.
Append
)
{
_transform
.
Translate
(
dx
,
dy
,
order
);
}
}
public
SmoothingMode
SmoothingMode
...
...
Source/Basic Shapes/SvgImage.cs
View file @
0453531d
...
...
@@ -209,7 +209,10 @@ namespace Svg
if
(
bmp
!=
null
)
{
renderer
.
DrawImage
(
bmp
,
destRect
,
srcRect
,
GraphicsUnit
.
Pixel
);
if
(
Opacity
==
1F
)
renderer
.
DrawImage
(
bmp
,
destRect
,
srcRect
,
GraphicsUnit
.
Pixel
);
else
renderer
.
DrawImage
(
bmp
,
destRect
,
srcRect
,
GraphicsUnit
.
Pixel
,
Opacity
);
bmp
.
Dispose
();
}
else
if
(
svg
!=
null
)
...
...
Source/Rendering/ISvgRenderer.cs
View file @
0453531d
...
...
@@ -22,5 +22,6 @@ namespace Svg
SmoothingMode
SmoothingMode
{
get
;
set
;
}
Matrix
Transform
{
get
;
set
;
}
void
TranslateTransform
(
float
dx
,
float
dy
,
MatrixOrder
order
=
MatrixOrder
.
Append
);
void
DrawImage
(
Image
image
,
RectangleF
destRect
,
RectangleF
srcRect
,
GraphicsUnit
graphicsUnit
,
float
opacity
);
}
}
Source/Rendering/SvgRenderer.cs
View file @
0453531d
...
...
@@ -4,6 +4,7 @@ using System.Linq;
using
System.Text
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Drawing.Imaging
;
using
System.Drawing.Text
;
namespace
Svg
...
...
@@ -46,6 +47,21 @@ namespace Svg
{
_innerGraphics
.
DrawImage
(
image
,
destRect
,
srcRect
,
graphicsUnit
);
}
public
void
DrawImage
(
Image
image
,
RectangleF
destRect
,
RectangleF
srcRect
,
GraphicsUnit
graphicsUnit
,
float
opacity
)
{
var
matrix
=
new
ColorMatrix
{
Matrix33
=
opacity
};
var
attributes
=
new
ImageAttributes
();
attributes
.
SetColorMatrix
(
matrix
,
ColorMatrixFlag
.
Default
,
ColorAdjustType
.
Bitmap
);
var
points
=
new
[]
{
destRect
.
Location
,
new
PointF
(
destRect
.
X
+
destRect
.
Width
,
destRect
.
Y
),
new
PointF
(
destRect
.
X
,
destRect
.
Y
+
destRect
.
Height
)
};
_innerGraphics
.
DrawImage
(
image
,
points
,
srcRect
,
graphicsUnit
,
attributes
);
}
public
void
DrawImageUnscaled
(
Image
image
,
Point
location
)
{
this
.
_innerGraphics
.
DrawImageUnscaled
(
image
,
location
);
...
...
Write
Preview
Supports
Markdown
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