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
63cb0cf6
Commit
63cb0cf6
authored
Jul 12, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add support for generating WICBitmapPaletteTypeFixedHalftone8 palette.
parent
ca126c06
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
palette.c
dlls/windowscodecs/palette.c
+33
-0
palette.c
dlls/windowscodecs/tests/palette.c
+27
-0
No files found.
dlls/windowscodecs/palette.c
View file @
63cb0cf6
/*
/*
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2012 Dmitry Timoshkov
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -132,6 +133,33 @@ static WICColor *generate_gray256_palette(UINT *count)
...
@@ -132,6 +133,33 @@ static WICColor *generate_gray256_palette(UINT *count)
return
entries
;
return
entries
;
}
}
static
WICColor
*
generate_halftone8_palette
(
UINT
*
count
)
{
WICColor
*
entries
;
UINT
i
;
*
count
=
16
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
16
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
entries
[
i
]
=
0xff000000
;
if
(
i
&
1
)
entries
[
i
]
|=
0xff
;
if
(
i
&
2
)
entries
[
i
]
|=
0xff00
;
if
(
i
&
4
)
entries
[
i
]
|=
0xff0000
;
}
for
(
i
=
8
;
i
<
16
;
i
++
)
{
static
const
DWORD
halftone
[
8
]
=
{
0xc0c0c0
,
0x808080
,
0x800000
,
0x008000
,
0x000080
,
0x808000
,
0x800080
,
0x008080
};
entries
[
i
]
=
0xff000000
;
entries
[
i
]
|=
halftone
[
i
-
8
];
}
return
entries
;
}
static
HRESULT
WINAPI
PaletteImpl_InitializePredefined
(
IWICPalette
*
iface
,
static
HRESULT
WINAPI
PaletteImpl_InitializePredefined
(
IWICPalette
*
iface
,
WICBitmapPaletteType
type
,
BOOL
add_transparent
)
WICBitmapPaletteType
type
,
BOOL
add_transparent
)
{
{
...
@@ -171,6 +199,11 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
...
@@ -171,6 +199,11 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
if
(
!
colors
)
return
E_OUTOFMEMORY
;
if
(
!
colors
)
return
E_OUTOFMEMORY
;
break
;
break
;
case
WICBitmapPaletteTypeFixedHalftone8
:
colors
=
generate_halftone8_palette
(
&
count
);
if
(
!
colors
)
return
E_OUTOFMEMORY
;
break
;
default:
default:
FIXME
(
"(%p,%u,%d): stub
\n
"
,
iface
,
type
,
add_transparent
);
FIXME
(
"(%p,%u,%d): stub
\n
"
,
iface
,
type
,
add_transparent
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
...
dlls/windowscodecs/tests/palette.c
View file @
63cb0cf6
/*
/*
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2009 Vincent Povirk for CodeWeavers
* Copyright 2012 Dmitry Timoshkov
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -175,6 +176,29 @@ static void generate_gray256_palette(DWORD *entries, UINT count)
...
@@ -175,6 +176,29 @@ static void generate_gray256_palette(DWORD *entries, UINT count)
}
}
}
}
static
void
generate_halftone8_palette
(
DWORD
*
entries
,
UINT
count
)
{
UINT
i
;
assert
(
count
==
16
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
entries
[
i
]
=
0xff000000
;
if
(
i
&
1
)
entries
[
i
]
|=
0xff
;
if
(
i
&
2
)
entries
[
i
]
|=
0xff00
;
if
(
i
&
4
)
entries
[
i
]
|=
0xff0000
;
}
for
(
i
=
8
;
i
<
16
;
i
++
)
{
static
const
DWORD
halftone
[
8
]
=
{
0xc0c0c0
,
0x808080
,
0x800000
,
0x008000
,
0x000080
,
0x808000
,
0x800080
,
0x008080
};
entries
[
i
]
=
0xff000000
;
entries
[
i
]
|=
halftone
[
i
-
8
];
}
}
static
void
test_predefined_palette
(
void
)
static
void
test_predefined_palette
(
void
)
{
{
static
struct
test_data
static
struct
test_data
...
@@ -190,6 +214,7 @@ static void test_predefined_palette(void)
...
@@ -190,6 +214,7 @@ static void test_predefined_palette(void)
{
0xff000000
,
0xff555555
,
0xffaaaaaa
,
0xffffffff
}
},
{
0xff000000
,
0xff555555
,
0xffaaaaaa
,
0xffffffff
}
},
{
WICBitmapPaletteTypeFixedGray16
,
0
,
1
,
16
,
{
0
}
},
{
WICBitmapPaletteTypeFixedGray16
,
0
,
1
,
16
,
{
0
}
},
{
WICBitmapPaletteTypeFixedGray256
,
0
,
1
,
256
,
{
0
}
},
{
WICBitmapPaletteTypeFixedGray256
,
0
,
1
,
256
,
{
0
}
},
{
WICBitmapPaletteTypeFixedHalftone8
,
0
,
0
,
16
,
{
0
}
},
};
};
IWICImagingFactory
*
factory
;
IWICImagingFactory
*
factory
;
IWICPalette
*
palette
;
IWICPalette
*
palette
;
...
@@ -244,6 +269,8 @@ static void test_predefined_palette(void)
...
@@ -244,6 +269,8 @@ static void test_predefined_palette(void)
generate_gray16_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
generate_gray16_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
else
if
(
td
[
i
].
type
==
WICBitmapPaletteTypeFixedGray256
)
else
if
(
td
[
i
].
type
==
WICBitmapPaletteTypeFixedGray256
)
generate_gray256_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
generate_gray256_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
else
if
(
td
[
i
].
type
==
WICBitmapPaletteTypeFixedHalftone8
)
generate_halftone8_palette
(
td
[
i
].
color
,
td
[
i
].
count
);
for
(
j
=
0
;
j
<
count
;
j
++
)
for
(
j
=
0
;
j
<
count
;
j
++
)
{
{
...
...
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