Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
poppler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
Oliver Sander
poppler
Commits
f9d208e8
Commit
f9d208e8
authored
Oct 16, 2005
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge SplashScreen.[cc|h] from xpdf 3.01
parent
7d46ac00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
39 deletions
+87
-39
ChangeLog
ChangeLog
+4
-0
splash/SplashScreen.cc
splash/SplashScreen.cc
+72
-38
splash/SplashScreen.h
splash/SplashScreen.h
+11
-1
No files found.
ChangeLog
View file @
f9d208e8
2005-09-20 Albert Astals Cid <aacid@kde.org>
* splash/SplashXPathScanner.cc: Merge from xpdf 3.01
* splash/SplashScreen.[cc|h]: Merge from xpdf 3.01
2005-10-05 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-page.cc (poppler_page_render_to_ps): Fix another
...
...
splash/SplashScreen.cc
View file @
f9d208e8
...
...
@@ -10,6 +10,7 @@
#pragma implementation
#endif
#include <string.h>
#include "goo/gmem.h"
#include "SplashMath.h"
#include "SplashScreen.h"
...
...
@@ -23,85 +24,118 @@
// Gamma correction (gamma = 1 / 1.33) is also computed here.
SplashScreen
::
SplashScreen
(
int
sizeA
)
{
SplashCoord
*
dist
;
SplashCoord
u
,
v
,
d
;
int
x
,
y
,
x1
,
y1
,
i
;
SplashCoord
u
,
v
,
d
,
val
;
int
size2
,
x
,
y
,
x1
,
y1
,
i
;
size
=
sizeA
>>
1
;
if
(
size
<
1
)
{
size
=
1
;
size
2
=
sizeA
>>
1
;
if
(
size
2
<
1
)
{
size
2
=
1
;
}
size
=
size2
<<
1
;
// initialize the threshold matrix
mat
=
(
SplashCoord
*
)
gmallocn
(
2
*
size
*
size
,
sizeof
(
SplashCoord
));
for
(
y
=
0
;
y
<
2
*
size
;
++
y
)
{
mat
=
(
SplashCoord
*
)
gmallocn
(
size
*
size
,
sizeof
(
SplashCoord
));
for
(
y
=
0
;
y
<
size
;
++
y
)
{
for
(
x
=
0
;
x
<
size
;
++
x
)
{
mat
[
y
*
size
+
x
]
=
-
1
;
}
}
// build the distance matrix
dist
=
(
SplashCoord
*
)
gmallocn
(
2
*
size
*
size
,
sizeof
(
SplashCoord
));
for
(
y
=
0
;
y
<
size
;
++
y
)
{
for
(
x
=
0
;
x
<
size
;
++
x
)
{
if
(
x
+
y
<
size
-
1
)
{
u
=
(
SplashCoord
)
x
+
0.5
-
0
;
//~ (-0.5);
dist
=
(
SplashCoord
*
)
gmallocn
(
size
*
size2
,
sizeof
(
SplashCoord
));
for
(
y
=
0
;
y
<
size
2
;
++
y
)
{
for
(
x
=
0
;
x
<
size
2
;
++
x
)
{
if
(
x
+
y
<
size
2
-
1
)
{
u
=
(
SplashCoord
)
x
+
0.5
-
0
;
v
=
(
SplashCoord
)
y
+
0.5
-
0
;
}
else
{
u
=
(
SplashCoord
)
x
+
0.5
-
(
SplashCoord
)
size
;
//~ ((SplashCoord)size - 0.5)
;
v
=
(
SplashCoord
)
y
+
0.5
-
(
SplashCoord
)
size
;
u
=
(
SplashCoord
)
x
+
0.5
-
(
SplashCoord
)
size
2
;
v
=
(
SplashCoord
)
y
+
0.5
-
(
SplashCoord
)
size
2
;
}
dist
[
y
*
size
+
x
]
=
u
*
u
+
v
*
v
;
dist
[
y
*
size
2
+
x
]
=
u
*
u
+
v
*
v
;
}
}
for
(
y
=
0
;
y
<
size
;
++
y
)
{
for
(
x
=
0
;
x
<
size
;
++
x
)
{
for
(
y
=
0
;
y
<
size
2
;
++
y
)
{
for
(
x
=
0
;
x
<
size
2
;
++
x
)
{
if
(
x
<
y
)
{
u
=
(
SplashCoord
)
x
+
0.5
-
0
;
//~ (-0.5);
v
=
(
SplashCoord
)
y
+
0.5
-
(
SplashCoord
)
size
;
u
=
(
SplashCoord
)
x
+
0.5
-
0
;
v
=
(
SplashCoord
)
y
+
0.5
-
(
SplashCoord
)
size
2
;
}
else
{
u
=
(
SplashCoord
)
x
+
0.5
-
(
SplashCoord
)
size
;
//~ ((SplashCoord)size - 0.5)
;
u
=
(
SplashCoord
)
x
+
0.5
-
(
SplashCoord
)
size
2
;
v
=
(
SplashCoord
)
y
+
0.5
-
0
;
}
dist
[(
size
+
y
)
*
size
+
x
]
=
u
*
u
+
v
*
v
;
dist
[(
size
2
+
y
)
*
size2
+
x
]
=
u
*
u
+
v
*
v
;
}
}
// build the threshold matrix
minVal
=
1
;
maxVal
=
0
;
x1
=
y1
=
0
;
// make gcc happy
for
(
i
=
1
;
i
<=
2
*
size
*
size
;
++
i
)
{
d
=
2
*
size
*
size
;
for
(
y
=
0
;
y
<
2
*
size
;
++
y
)
{
for
(
x
=
0
;
x
<
size
;
++
x
)
{
for
(
i
=
1
;
i
<=
size
*
size2
;
++
i
)
{
d
=
size
*
size2
;
for
(
y
=
0
;
y
<
size
;
++
y
)
{
for
(
x
=
0
;
x
<
size
2
;
++
x
)
{
if
(
mat
[
y
*
size
+
x
]
<
0
&&
dist
[
y
*
size
+
x
]
<
d
)
{
dist
[
y
*
size
2
+
x
]
<
d
)
{
x1
=
x
;
y1
=
y
;
d
=
dist
[
y1
*
size
+
x1
];
d
=
dist
[
y1
*
size
2
+
x1
];
}
}
}
u
=
1.0
-
(
SplashCoord
)
i
/
(
SplashCoord
)(
2
*
size
*
size
+
1
);
mat
[
y1
*
size
+
x1
]
=
splashPow
(
u
,
1.33
);
u
=
(
SplashCoord
)
1
-
(
SplashCoord
)
i
/
(
SplashCoord
)(
size
*
size2
+
1
);
val
=
splashPow
(
u
,
1.33
);
if
(
val
<
minVal
)
{
minVal
=
val
;
}
if
(
val
>
maxVal
)
{
maxVal
=
val
;
}
mat
[
y1
*
size
+
x1
]
=
val
;
if
(
y1
<
size2
)
{
mat
[(
y1
+
size2
)
*
size
+
x1
+
size2
]
=
val
;
}
else
{
mat
[(
y1
-
size2
)
*
size
+
x1
+
size2
]
=
val
;
}
}
gfree
(
dist
);
}
SplashScreen
::
SplashScreen
(
SplashScreen
*
screen
)
{
int
n
;
size
=
screen
->
size
;
n
=
size
*
size
*
sizeof
(
SplashCoord
);
mat
=
(
SplashCoord
*
)
gmalloc
(
n
);
memcpy
(
mat
,
screen
->
mat
,
n
);
minVal
=
screen
->
minVal
;
maxVal
=
screen
->
maxVal
;
}
SplashScreen
::~
SplashScreen
()
{
gfree
(
mat
);
}
int
SplashScreen
::
test
(
int
x
,
int
y
,
SplashCoord
value
)
{
SplashCoord
*
mat1
;
int
xx
,
yy
;
xx
=
x
%
(
2
*
size
);
yy
=
y
%
(
2
*
size
)
;
mat1
=
mat
;
if
(
(
xx
/
size
)
^
(
yy
/
size
)
)
{
mat1
+=
size
*
size
;
if
(
value
<
minVal
)
{
return
0
;
}
if
(
value
>=
maxVal
)
{
return
1
;
}
xx
%=
size
;
yy
%=
size
;
return
value
<
mat1
[
yy
*
size
+
xx
]
?
0
:
1
;
if
((
xx
=
x
%
size
)
<
0
)
{
xx
=
-
xx
;
}
if
((
yy
=
y
%
size
)
<
0
)
{
yy
=
-
yy
;
}
return
value
<
mat
[
yy
*
size
+
xx
]
?
0
:
1
;
}
GBool
SplashScreen
::
isStatic
(
SplashCoord
value
)
{
return
value
<
minVal
||
value
>=
maxVal
;
}
splash/SplashScreen.h
View file @
f9d208e8
...
...
@@ -21,18 +21,28 @@ class SplashScreen {
public:
SplashScreen
(
int
sizeA
);
SplashScreen
(
SplashScreen
*
screen
);
~
SplashScreen
();
SplashScreen
*
copy
()
{
return
new
SplashScreen
(
size
<<
1
);
}
SplashScreen
*
copy
()
{
return
new
SplashScreen
(
this
);
}
// Return the computed pixel value (0=black, 1=white) for the gray
// level <value> at (<x>, <y>).
int
test
(
int
x
,
int
y
,
SplashCoord
value
);
// Returns true if value is above the white threshold or below the
// black threshold, i.e., if the corresponding halftone will be
// solid white or black.
GBool
isStatic
(
SplashCoord
value
);
private:
SplashCoord
*
mat
;
// threshold matrix
int
size
;
// size of the threshold matrix
SplashCoord
minVal
;
// any pixel value below minVal generates
// solid black
SplashCoord
maxVal
;
// any pixel value above maxVal generates
// solid white
};
#endif
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