- sync to 2.0.9
parent
d0304c9e1c
commit
0a3a5068ac
18
src/gdtest.c
18
src/gdtest.c
|
@ -173,7 +173,8 @@ main (int argc, char **argv)
|
|||
|
||||
if (im2 == NULL)
|
||||
{
|
||||
printf ("GD Source: ERROR Null returned by gdImageCreateFromPngSource\n");
|
||||
printf
|
||||
("GD Source: ERROR Null returned by gdImageCreateFromPngSource\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -195,7 +196,8 @@ main (int argc, char **argv)
|
|||
in = fopen (of, "rb");
|
||||
if (!in)
|
||||
{
|
||||
fprintf (stderr, "GD Sink: ERROR - GD Sink Output file does not exist!\n");
|
||||
fprintf (stderr,
|
||||
"GD Sink: ERROR - GD Sink Output file does not exist!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -230,7 +232,8 @@ main (int argc, char **argv)
|
|||
im3 = gdImageCreateFromGd2Part (in, 200, 300, 150, 100);
|
||||
fclose (in);
|
||||
|
||||
CompareImages ("GD2Part (gdtest_200_300_150_100.png, gdtest.gd2(part))", im2, im3);
|
||||
CompareImages ("GD2Part (gdtest_200_300_150_100.png, gdtest.gd2(part))",
|
||||
im2, im3);
|
||||
|
||||
gdImageDestroy (im2);
|
||||
gdImageDestroy (im3);
|
||||
|
@ -305,7 +308,8 @@ main (int argc, char **argv)
|
|||
#endif /* HAVE_LIBJPEG */
|
||||
/* Assume the color closest to black is the foreground
|
||||
color for the B&W wbmp image. */
|
||||
fprintf (stderr, "NOTE: the WBMP output image will NOT match the original unless the original\n"
|
||||
fprintf (stderr,
|
||||
"NOTE: the WBMP output image will NOT match the original unless the original\n"
|
||||
"is also black and white. This is OK!\n");
|
||||
foreground = gdImageColorClosest (im, 0, 0, 0);
|
||||
fprintf (stderr, "Foreground index is %d\n", foreground);
|
||||
|
@ -336,8 +340,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
fprintf (stderr, "%02X%02X%02X\n",
|
||||
gdImageRed (im2, i),
|
||||
gdImageGreen (im2, i),
|
||||
gdImageBlue (im2, i));
|
||||
gdImageGreen (im2, i), gdImageBlue (im2, i));
|
||||
}
|
||||
fclose (in);
|
||||
if (!im2)
|
||||
|
@ -349,7 +352,8 @@ main (int argc, char **argv)
|
|||
out = fopen ("test/gdtest_wbmp_to_png.png", "wb");
|
||||
if (!out)
|
||||
{
|
||||
fprintf (stderr, "Can't create file test/gdtest_wbmp_to_png.png.\n");
|
||||
fprintf (stderr,
|
||||
"Can't create file test/gdtest_wbmp_to_png.png.\n");
|
||||
exit (1);
|
||||
}
|
||||
gdImagePng (im2, out);
|
||||
|
|
|
@ -55,18 +55,23 @@ main (int argc, char *argv[])
|
|||
double angle = DEG2RAD (90);
|
||||
#endif
|
||||
char *f;
|
||||
if (argc == 2) {
|
||||
if (argc == 2)
|
||||
{
|
||||
f = argv[1];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 2.02: usage message. Defaulting to Times wasn't working well for the
|
||||
many people with no /usr/share/fonts/truetype. */
|
||||
fprintf (stderr, "Usage: gdtestft fontfilename\n");
|
||||
fprintf(stderr, "If fontfilename is not a full or relative path, GDFONTPATH is searched for\n"
|
||||
fprintf (stderr,
|
||||
"If fontfilename is not a full or relative path, GDFONTPATH is searched for\n"
|
||||
"it. If GDFONTPATH is not set, /usr/share/fonts/truetype is searched.\n");
|
||||
exit (1);
|
||||
}
|
||||
/* obtain brect so that we can size the image */
|
||||
err = gdImageStringFT ((gdImagePtr) NULL, &brect[0], 0, f, sz, angle, 0, 0, s);
|
||||
err =
|
||||
gdImageStringFT ((gdImagePtr) NULL, &brect[0], 0, f, sz, angle, 0, 0, s);
|
||||
if (err)
|
||||
{
|
||||
fprintf (stderr, err);
|
||||
|
@ -94,17 +99,20 @@ main (int argc, char *argv[])
|
|||
{
|
||||
FILE *in = fopen ("eleanor.jpg", "rb");
|
||||
gdImagePtr imb;
|
||||
if (in) {
|
||||
if (in)
|
||||
{
|
||||
#ifdef HAVE_LIBJPEG
|
||||
imb = gdImageCreateFromJpeg (in);
|
||||
#else
|
||||
fprintf (stderr, "No JPEG library support.\n");
|
||||
#endif
|
||||
if (!imb) {
|
||||
if (!imb)
|
||||
{
|
||||
fprintf (stderr, "gdImageCreateFromJpeg failed\n");
|
||||
exit (1);
|
||||
}
|
||||
if (!im->trueColor) {
|
||||
if (!im->trueColor)
|
||||
{
|
||||
/* If destination is not truecolor, convert the JPEG to a
|
||||
reasonably high-quality palette version. This is not as good
|
||||
as creating a truecolor output file, of course. Leave many
|
||||
|
@ -116,7 +124,9 @@ main (int argc, char *argv[])
|
|||
/* Resample background image to cover new image exactly */
|
||||
gdImageCopyResampled (im, imb, 0, 0, 0, 0, sx * 3, sy,
|
||||
gdImageSX (imb), gdImageSY (imb));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Can't get background, so paint a simple one */
|
||||
/* Truecolor images start out black, so paint it white */
|
||||
gdImageFilledRectangle (im, 0, 0, sx * 3, sy, white);
|
||||
|
@ -154,7 +164,8 @@ main (int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
/* TBB: Write img to test/fttest.jpg or test/fttest.png */
|
||||
if (im->trueColor) {
|
||||
if (im->trueColor)
|
||||
{
|
||||
out = fopen ("test/fttest.jpg", "wb");
|
||||
if (!out)
|
||||
{
|
||||
|
@ -169,7 +180,9 @@ main (int argc, char *argv[])
|
|||
#endif
|
||||
fclose (out);
|
||||
fprintf (stderr, "Test image written to test/fttest.jpg\n");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
out = fopen ("test/fttest.png", "wb");
|
||||
if (!out)
|
||||
{
|
||||
|
|
|
@ -1200,6 +1200,7 @@ static unsigned short UnicodeTbl[][94] = {
|
|||
0x9A4E, 0x9AD9, 0x9ADC, 0x9B75, 0x9B72, 0x9B8F, 0x9BB1, 0x9BBB,
|
||||
0x9C00, 0x9D70, 0x9D6B, 0xFA2D, 0x9E19, 0x9ED1, 0x0000, 0x0000,
|
||||
0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177,
|
||||
0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02}};
|
||||
0x2178, 0x2179, 0xFFE2, 0xFFE4, 0xFF07, 0xFF02}
|
||||
};
|
||||
|
||||
#endif /* JISX0208_H */
|
||||
|
|
Loading…
Reference in New Issue