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
062c18dd
Commit
062c18dd
authored
Apr 20, 2005
by
Richard Cohen
Committed by
Alexandre Julliard
Apr 20, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dither solid colours on monochrome bitmaps.
parent
8f983be0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
14 deletions
+44
-14
gdiobj.c
dlls/gdi/gdiobj.c
+1
-5
brush.c
dlls/x11drv/brush.c
+43
-9
No files found.
dlls/gdi/gdiobj.c
View file @
062c18dd
...
...
@@ -50,13 +50,9 @@ static const LOGBRUSH WhiteBrush = { BS_SOLID, RGB(255,255,255), 0 };
static
const
LOGBRUSH
BlackBrush
=
{
BS_SOLID
,
RGB
(
0
,
0
,
0
),
0
};
static
const
LOGBRUSH
NullBrush
=
{
BS_NULL
,
0
,
0
};
/* FIXME: these should perhaps be BS_HATCHED, at least for 1 bitperpixel */
static
const
LOGBRUSH
LtGrayBrush
=
{
BS_SOLID
,
RGB
(
192
,
192
,
192
),
0
};
static
const
LOGBRUSH
GrayBrush
=
{
BS_SOLID
,
RGB
(
128
,
128
,
128
),
0
};
/* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
/* See HatchBrushes in x11drv for the HS_DIAGCROSS+1 hack */
static
const
LOGBRUSH
DkGrayBrush
=
{
BS_HATCHED
,
RGB
(
0
,
0
,
0
),
(
HS_DIAGCROSS
+
1
)
};
static
const
LOGBRUSH
DkGrayBrush
=
{
BS_SOLID
,
RGB
(
64
,
64
,
64
),
0
};
static
const
LOGPEN
WhitePen
=
{
PS_SOLID
,
{
0
,
0
},
RGB
(
255
,
255
,
255
)
};
static
const
LOGPEN
BlackPen
=
{
PS_SOLID
,
{
0
,
0
},
RGB
(
0
,
0
,
0
)
};
...
...
dlls/x11drv/brush.c
View file @
062c18dd
...
...
@@ -28,9 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
gdi
);
#define NB_HATCH_STYLES (HS_DIAGCROSS+1)
static
const
char
HatchBrushes
[
NB_HATCH_STYLES
+
1
][
8
]
=
static
const
char
HatchBrushes
[][
8
]
=
{
{
0x00
,
0x00
,
0x00
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
},
/* HS_HORIZONTAL */
{
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
,
0x08
},
/* HS_VERTICAL */
...
...
@@ -38,7 +36,6 @@ static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
{
0x80
,
0x40
,
0x20
,
0x10
,
0x08
,
0x04
,
0x02
,
0x01
},
/* HS_BDIAGONAL */
{
0x08
,
0x08
,
0x08
,
0xff
,
0x08
,
0x08
,
0x08
,
0x08
},
/* HS_CROSS */
{
0x81
,
0x42
,
0x24
,
0x18
,
0x18
,
0x24
,
0x42
,
0x81
},
/* HS_DIAGCROSS */
{
0xee
,
0xbb
,
0xee
,
0xbb
,
0xee
,
0xbb
,
0xee
,
0xbb
}
/* Hack for DKGRAY */
};
/* Levels of each primary for dithering */
...
...
@@ -100,15 +97,16 @@ static const int EGAmapping[TOTAL_LEVELS] =
#define PIXEL_VALUE(r,g,b) \
X11DRV_PALETTE_mapEGAPixel[EGAmapping[((r)*PRIMARY_LEVELS+(g))*PRIMARY_LEVELS+(b)]]
/* X image for building dithered pixmap */
static
XImage
*
ditherImage
=
NULL
;
static
const
COLORREF
BLACK
=
RGB
(
0
,
0
,
0
);
static
const
COLORREF
WHITE
=
RGB
(
0xff
,
0xff
,
0xff
);
/***********************************************************************
* BRUSH_DitherColor
*/
static
Pixmap
BRUSH_DitherColor
(
COLORREF
color
)
{
/* X image for building dithered pixmap */
static
XImage
*
ditherImage
=
NULL
;
static
COLORREF
prevColor
=
0xffffffff
;
unsigned
int
x
,
y
;
Pixmap
pixmap
;
...
...
@@ -116,7 +114,11 @@ static Pixmap BRUSH_DitherColor( COLORREF color )
if
(
!
ditherImage
)
{
ditherImage
=
X11DRV_DIB_CreateXImage
(
MATRIX_SIZE
,
MATRIX_SIZE
,
screen_depth
);
if
(
!
ditherImage
)
return
0
;
if
(
!
ditherImage
)
{
ERR
(
"Could not create dither image
\n
"
);
return
0
;
}
}
wine_tsx11_lock
();
...
...
@@ -143,13 +145,39 @@ static Pixmap BRUSH_DitherColor( COLORREF color )
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
MATRIX_SIZE
,
MATRIX_SIZE
,
screen_depth
);
XPutImage
(
gdi_display
,
pixmap
,
BITMAP_colorGC
,
ditherImage
,
0
,
0
,
0
,
0
,
MATRIX_SIZE
,
MATRIX_SIZE
);
0
,
0
,
MATRIX_SIZE
,
MATRIX_SIZE
);
wine_tsx11_unlock
();
return
pixmap
;
}
/***********************************************************************
* BRUSH_DitherMono
*/
static
Pixmap
BRUSH_DitherMono
(
COLORREF
color
)
{
/* This makes the spray work in Win 3.11 pbrush.exe */
/* FIXME. Extend this basic selection of dither patterns */
static
const
char
gray_dither
[][
2
]
=
{{
0x1
,
0x0
},
/* DKGRAY */
{
0x2
,
0x1
},
/* GRAY */
{
0x1
,
0x3
},
/* LTGRAY */
};
int
gray
=
(
30
*
GetRValue
(
color
)
+
59
*
GetGValue
(
color
)
+
11
*
GetBValue
(
color
))
/
100
;
int
idx
=
gray
*
(
sizeof
gray_dither
/
sizeof
gray_dither
[
0
]
+
1
)
/
256
-
1
;
Pixmap
pixmap
;
TRACE
(
"color=%06lx -> gray=%x
\n
"
,
color
,
gray
);
wine_tsx11_lock
();
pixmap
=
XCreateBitmapFromData
(
gdi_display
,
root_window
,
gray_dither
[
idx
],
2
,
2
);
wine_tsx11_unlock
();
return
pixmap
;
}
/***********************************************************************
* BRUSH_SelectSolidBrush
*/
static
void
BRUSH_SelectSolidBrush
(
X11DRV_PDEVICE
*
physDev
,
COLORREF
color
)
...
...
@@ -161,6 +189,12 @@ static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
physDev
->
brush
.
fillStyle
=
FillTiled
;
physDev
->
brush
.
pixel
=
0
;
}
else
if
(
physDev
->
depth
==
1
&&
color
!=
WHITE
&&
color
!=
BLACK
)
{
physDev
->
brush
.
pixel
=
0
;
physDev
->
brush
.
pixmap
=
BRUSH_DitherMono
(
color
);
physDev
->
brush
.
fillStyle
=
FillTiled
;
}
else
{
/* Solid brush */
...
...
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