Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
60167dfb
Commit
60167dfb
authored
May 20, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
May 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement partially transparent solid fill brushes.
parent
122af07a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
0 deletions
+81
-0
brush.c
dlls/gdiplus/brush.c
+9
-0
gdiplus.c
dlls/gdiplus/gdiplus.c
+36
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+2
-0
graphics.c
dlls/gdiplus/graphics.c
+34
-0
No files found.
dlls/gdiplus/brush.c
View file @
60167dfb
...
...
@@ -46,13 +46,19 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
switch
(
brush
->
bt
){
case
BrushTypeSolidColor
:
{
GpSolidFill
*
fill
;
*
clone
=
GdipAlloc
(
sizeof
(
GpSolidFill
));
if
(
!*
clone
)
return
OutOfMemory
;
fill
=
(
GpSolidFill
*
)
*
clone
;
memcpy
(
*
clone
,
brush
,
sizeof
(
GpSolidFill
));
(
*
clone
)
->
gdibrush
=
CreateBrushIndirect
(
&
(
*
clone
)
->
lb
);
fill
->
bmp
=
ARGB2BMP
(
fill
->
color
);
break
;
}
case
BrushTypeHatchFill
:
*
clone
=
GdipAlloc
(
sizeof
(
GpHatch
));
if
(
!*
clone
)
return
OutOfMemory
;
...
...
@@ -560,6 +566,7 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
(
*
sf
)
->
brush
.
gdibrush
=
CreateSolidBrush
(
col
);
(
*
sf
)
->
brush
.
bt
=
BrushTypeSolidColor
;
(
*
sf
)
->
color
=
color
;
(
*
sf
)
->
bmp
=
ARGB2BMP
(
color
);
return
Ok
;
}
...
...
@@ -842,6 +849,8 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
GdipFree
(((
GpPathGradient
*
)
brush
)
->
blendpos
);
break
;
case
BrushTypeSolidColor
:
if
(((
GpSolidFill
*
)
brush
)
->
bmp
)
DeleteObject
(((
GpSolidFill
*
)
brush
)
->
bmp
);
break
;
case
BrushTypeLinearGradient
:
GdipFree
(((
GpLineGradient
*
)
brush
)
->
blendfac
);
...
...
dlls/gdiplus/gdiplus.c
View file @
60167dfb
...
...
@@ -258,6 +258,42 @@ COLORREF ARGB2COLORREF(ARGB color)
((
color
&
0xff0000
)
>>
16
);
}
HBITMAP
ARGB2BMP
(
ARGB
color
)
{
HDC
hdc
;
BITMAPINFO
bi
;
HBITMAP
result
;
RGBQUAD
*
bits
;
int
alpha
;
if
((
color
&
0xff000000
)
==
0xff000000
)
return
0
;
hdc
=
CreateCompatibleDC
(
NULL
);
bi
.
bmiHeader
.
biSize
=
sizeof
(
bi
.
bmiHeader
);
bi
.
bmiHeader
.
biWidth
=
1
;
bi
.
bmiHeader
.
biHeight
=
1
;
bi
.
bmiHeader
.
biPlanes
=
1
;
bi
.
bmiHeader
.
biBitCount
=
32
;
bi
.
bmiHeader
.
biCompression
=
BI_RGB
;
bi
.
bmiHeader
.
biSizeImage
=
0
;
bi
.
bmiHeader
.
biXPelsPerMeter
=
0
;
bi
.
bmiHeader
.
biYPelsPerMeter
=
0
;
bi
.
bmiHeader
.
biClrUsed
=
0
;
bi
.
bmiHeader
.
biClrImportant
=
0
;
result
=
CreateDIBSection
(
hdc
,
&
bi
,
DIB_RGB_COLORS
,
(
void
*
)
&
bits
,
NULL
,
0
);
bits
[
0
].
rgbReserved
=
alpha
=
(
color
>>
24
)
&
0xff
;
bits
[
0
].
rgbRed
=
((
color
>>
16
)
&
0xff
)
*
alpha
/
255
;
bits
[
0
].
rgbGreen
=
((
color
>>
8
)
&
0xff
)
*
alpha
/
255
;
bits
[
0
].
rgbBlue
=
(
color
&
0xff
)
*
alpha
/
255
;
DeleteDC
(
hdc
);
return
result
;
}
/* Like atan2, but puts angle in correct quadrant if dx is 0. */
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
)
{
...
...
dlls/gdiplus/gdiplus_private.h
View file @
60167dfb
...
...
@@ -41,6 +41,7 @@
#define TENSION_CONST (0.3)
COLORREF
ARGB2COLORREF
(
ARGB
color
);
HBITMAP
ARGB2BMP
(
ARGB
color
);
extern
INT
arc2polybezier
(
GpPointF
*
points
,
REAL
x1
,
REAL
y1
,
REAL
x2
,
REAL
y2
,
REAL
startAngle
,
REAL
sweepAngle
);
extern
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
);
...
...
@@ -126,6 +127,7 @@ struct GpHatch{
struct
GpSolidFill
{
GpBrush
brush
;
ARGB
color
;
HBITMAP
bmp
;
};
struct
GpPathGradient
{
...
...
dlls/gdiplus/graphics.c
View file @
60167dfb
...
...
@@ -346,6 +346,40 @@ static void brush_fill_path(GpGraphics *graphics, GpBrush* brush)
}
break
;
}
case
BrushTypeSolidColor
:
{
GpSolidFill
*
fill
=
(
GpSolidFill
*
)
brush
;
if
(
fill
->
bmp
)
{
RECT
rc
;
/* partially transparent fill */
SelectClipPath
(
graphics
->
hdc
,
RGN_AND
);
if
(
GetClipBox
(
graphics
->
hdc
,
&
rc
)
!=
NULLREGION
)
{
HDC
hdc
=
CreateCompatibleDC
(
NULL
);
HBITMAP
oldbmp
;
BLENDFUNCTION
bf
;
if
(
!
hdc
)
break
;
oldbmp
=
SelectObject
(
hdc
,
fill
->
bmp
);
bf
.
BlendOp
=
AC_SRC_OVER
;
bf
.
BlendFlags
=
0
;
bf
.
SourceConstantAlpha
=
255
;
bf
.
AlphaFormat
=
AC_SRC_ALPHA
;
GdiAlphaBlend
(
graphics
->
hdc
,
rc
.
left
,
rc
.
top
,
rc
.
right
-
rc
.
left
,
rc
.
bottom
-
rc
.
top
,
hdc
,
0
,
0
,
1
,
1
,
bf
);
SelectObject
(
hdc
,
oldbmp
);
DeleteDC
(
hdc
);
}
break
;
}
/* else fall through */
}
default:
SelectObject
(
graphics
->
hdc
,
brush
->
gdibrush
);
FillPath
(
graphics
->
hdc
);
...
...
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