Skip to content

Commit

Permalink
* src/image.c, src/gdip.h: Added GdipDrawImage/DrawImageRect
Browse files Browse the repository at this point in the history
* src/jpegcodec.c, src/tiffcodec.c: Implemented loading jpeg and
tiff images.  Need to test these out on windows, to see exactly
what formats stuff gets retruned in, but I think we should be ok
for the most common cases.  No file saving yet.

* src/bmpcodec.c, src/gifcodec.c, src/pngcodec.c:
Remove calls to bogus (and undefined) gdip_image_new()

* configure.in: Added checks for libtiff and libjpeg.  Cribbed
from gtk.  Also added in test/Makefile target.

* testgdi.c: initial commit

* .cvsignire: Added Makefile, Makefile.in, and other misc junk

svn path=/trunk/libgdiplus/; revision=25013
  • Loading branch information
Vladimir Vukicevic committed Apr 4, 2004
1 parent 348dd98 commit 21848d6
Show file tree
Hide file tree
Showing 21 changed files with 710 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .cvsignore
Expand Up @@ -11,3 +11,5 @@ libgdiplus.pc
libtool
ltmain.sh
stamp-h1
Makefile
Makefile.in
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2004-04-04 Vladimir Vukicevic <vladimir@pobox.com>

* configure.in: Added checks for libtiff and libjpeg. Cribbed
from gtk. Also added in test/Makefile target.

2004-01-31 Miguel de Icaza <miguel@ximian.com>

* Initial release, split from the Mono's MCS package.
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
@@ -1,9 +1,9 @@
SUBDIRS = src
SUBDIRS = src tests

pkgconfigdir = $(libdir)/pkgconfig

pkgconfig_DATA= libgdiplus.pc

DISTCLEANFILES= libgdiplus.pc

EXTRA_DIST = libgdiplus.pc.in
EXTRA_DIST = libgdiplus.pc.in
64 changes: 62 additions & 2 deletions configure.in
Expand Up @@ -22,11 +22,71 @@ else
AC_MSG_ERROR("Did not find Cairo 0.1.17");
fi
GDIPLUS_LIBS="`pkg-config --libs cairo mono glib-2.0` `freetype-config --libs`"
AC_SUBST(GDIPLUS_LIBS)
GDIPLUS_CFLAGS="`pkg-config --cflags cairo mono glib-2.0` `freetype-config --cflags`"

AC_ARG_WITH(libjpeg,
[AC_HELP_STRING([--without-libjpeg], [disable JPEG file IO])])
AC_ARG_WITH(libtiff,
[AC_HELP_STRING([--without-libtiff], [disable TIFF file IO])])

dnl Test for libtiff
if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
AC_CHECK_LIB(tiff, TIFFReadScanline,
[AC_CHECK_HEADER(tiffio.h,
TIFF='tiff'; LIBTIFF='-ltiff',
AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
[AC_CHECK_LIB(tiff, TIFFWriteScanline,
[AC_CHECK_HEADER(tiffio.h,
TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
[AC_CHECK_LIB(tiff34, TIFFFlushData,
[AC_CHECK_HEADER(tiffio.h,
TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
fi

if test x$TIFF != x; then
GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBTIFF"
AC_DEFINE(HAVE_LIBTIFF, 1, Define if tiff support is available)
fi

dnl Test for libjpeg
if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
jpeg_ok=yes,
jpeg_ok=no
AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
if test "$jpeg_ok" = yes; then
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#undef HAVE_STDLIB_H
#include <jpeglib.h>],
jpeg_ok=yes,
jpeg_ok=no)
AC_MSG_RESULT($jpeg_ok)
if test "$jpeg_ok" = yes; then
JPEG='jpeg'; LIBJPEG='-ljpeg'
else
AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
fi
fi
fi

if test x$JPEG != x; then
GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBJPEG"
AC_DEFINE(HAVE_LIBJPEG, 1, Define if jpeg support is available)
fi

AC_SUBST(GDIPLUS_LIBS)
AC_SUBST(GDIPLUS_CFLAGS)

AC_OUTPUT([
Makefile
libgdiplus.pc
src/Makefile])
src/Makefile
tests/Makefile])

5 changes: 5 additions & 0 deletions src/.cvsignore
@@ -1,2 +1,7 @@
*.lo
*.la
.deps
.libs
Makefile
Makefile.in

12 changes: 12 additions & 0 deletions src/ChangeLog
@@ -1,3 +1,15 @@
2004-04-04 Vladimir Vukicevic <vladimir@pobox.com>

* src/image.c, src/gdip.h: Added GdipDrawImage/DrawImageRect

* src/jpegcodec.c, src/tiffcodec.c: Implemented loading jpeg and
tiff images. Need to test these out on windows, to see exactly
what formats stuff gets retruned in, but I think we should be ok
for the most common cases. No file saving yet.

* src/bmpcodec.c, src/gifcodec.c, src/pngcodec.c:
Remove calls to bogus (and undefined) gdip_image_new()

2004-04-04 Duncan Mak <duncan@ximian.com>

* graphics.c (make_curve): Renamed from
Expand Down
10 changes: 7 additions & 3 deletions src/bmpcodec.c
Expand Up @@ -13,7 +13,11 @@
GpStatus
gdip_load_png_bmp_from_file (FILE *fp, GpImage *image)
{
image = (GpImage *) gdip_image_new ();
image->type = imageBitmap;
return NotImplemented;
return NotImplemented;
}

GpStatus
gdip_load_bmp_image_from_file (FILE *fp, GpImage *image)
{
return NotImplemented;
}
4 changes: 4 additions & 0 deletions src/gdip.h
Expand Up @@ -552,6 +552,10 @@ GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int
GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height);
GpStatus GdipDrawImage (GpGraphics *graphics, GpImage *image, int x, int y);
GpStatus GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y);
GpStatus GdipDrawImageRect (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height);
GpStatus GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height);
GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2);
GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2);
GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
Expand Down
2 changes: 0 additions & 2 deletions src/gifcodec.c
Expand Up @@ -13,7 +13,5 @@
GpStatus
gdip_load_gif_image_from_file (FILE *fp, GpImage *image)
{
image = (GpImage *) gdip_image_new ();
image->type = imageBitmap;
return NotImplemented;
}
30 changes: 24 additions & 6 deletions src/image.c
Expand Up @@ -125,13 +125,24 @@ GdipGetImageGraphicsContext (GpImage *image, GpGraphics **graphics)
}

GpStatus
GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y)
GdipDrawImage (GpGraphics *graphics, GpImage *image, int x, int y)
{
printf("GdipDrawImageI. %p (type %d), %p, (%d,%d)\n", graphics, graphics->type, image, x, y);
return NotImplemented;
return GdipDrawImageRectI (graphics, image, x, y, image->width, image->height);
}

GpStatus
GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y)
{
return GdipDrawImageRectI (graphics, image, x, y, image->width, image->height);
}

GpStatus
GdipDrawImageRect (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height)
{
return GdipDrawImageRectI (graphics, image, x, y, width, height);
}

GpStatus
GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height)
{
GpGraphics *image_graphics = 0;
Expand Down Expand Up @@ -176,10 +187,17 @@ GdipLoadImageFromFile (GDIPCONST WCHAR *file, GpImage **image)
ImageFormat format;
unsigned char *file_name;

GError *err = NULL;

if (!image || !file)
return InvalidParameter;

file_name = (unsigned char *) g_utf16_to_utf8 ((const gunichar2 *)file, -1, NULL, NULL, NULL);
file_name = (unsigned char *) g_utf16_to_utf8 ((const gunichar2 *)file, -1, NULL, NULL, &err);
if (file_name == NULL || err != NULL) {
*image = NULL;
return InvalidParameter;
}

/*printf ("image.c, file name is %s \n", file_name);*/
if ((fp = fopen(file_name, "rb")) == NULL)
return FileNotFound;
Expand All @@ -197,7 +215,7 @@ GdipLoadImageFromFile (GDIPCONST WCHAR *file, GpImage **image)
}
break;
case TIFF:
status = gdip_load_tiff_image_from_file (fp, result);
status = gdip_load_tiff_image_from_file (fp, &result);
if (status != Ok)
{
fclose(fp);
Expand All @@ -221,7 +239,7 @@ GdipLoadImageFromFile (GDIPCONST WCHAR *file, GpImage **image)
}
break;
case JPEG:
status = gdip_load_jpeg_image_from_file (fp, result);
status = gdip_load_jpeg_image_from_file (fp, &result);
if (status != Ok)
{
fclose(fp);
Expand Down

0 comments on commit 21848d6

Please sign in to comment.