CS130 Winter 2008 - Wine / GDI+

[By Lei Zhang; retrieved on 24 Jan 2009 from http://linux.ucla.edu/~leiz/software/wine/cs130_w08.php]

The Winter 2008 CS130 Wine project focuses on GDI+. Here's some useful information and links for people working on this project.

Content

Windows Programming

GDI+

GDI+ is a new version of GDI with more advanced graphics features. GDI is a Windows susbsystem that draws shapes, render fonts, etc.

MSDN reference

GDI+ Programming

TODO: General description of GDI+ Programming. Links, etc.

List of GDI+ Functions

The table below lists the GDI+ functions known to be in use, along with the number of applications that use it.

The table is sortable if you click on the table headers.

You may also be interested in The list of Outstanding Bugs.

Click here to collapse/expand table

Function Number of apps effected
GdipAddPathArcI 1
GdipAddPathBezier 1
GdipAddPathCurve 1
GdipAddPathLine 2
GdipAddPathPolygonI 1
GdipAddPathRectangle 2
GdipAddPathString 2
GdipBitmapSetPixel 2
GdipCloneBitmapAreaI 5
GdipCloneFontFamily 1
GdipCloneImage 13
GdipCloneStringFormat 2
GdipCombineRegionPath 1
GdipCombineRegionRectI 2
GdipCreateAdjustableArrowCap 1
GdipCreateBitmapFromFileICM - Ethan 4
GdipCreateBitmapFromGdiDib 3
GdipCreateBitmapFromHBITMAP 8
GdipCreateBitmapFromHICON 1
GdipCreateBitmapFromResource 3
GdipCreateCachedBitmap 3
GdipCreateFont 4
GdipCreateFontFamilyFromName 4
GdipCreateFontFromDC 4
GdipCreateHatchBrush 4
GdipCreateHBITMAPFromBitmap 1
GdipCreateRegion 3
GdipCreateRegionRectI 1
GdipCreateTexture 3
GdipCreateTexture2I 1
GdipDeleteCachedBitmap 3
GdipDeleteFontFamily 4
GdipDeletePrivateFontCollection 1
GdipDeleteRegion 3
GdipDrawArcI - Other Wine developer 3
GdipDrawBezierI - Other Wine developer 2
GdipDrawCachedBitmap 3
GdipDrawClosedCurve2I 2
GdipDrawCurve2I 2
GdipDrawEllipseI 3
GdipDrawImagePointRect 2
GdipDrawImagePointRectI 2
GdipDrawImageRect 3
GdipDrawImageRectI 8
GdipDrawImageRectRectI - Jonathan 9
GdipDrawPieI 2
GdipDrawPolygon 2
GdipDrawPolygonI 2
GdipDrawRectangle 2
GdipFillClosedCurveI 2
GdipFillEllipse 2
GdipFillEllipseI 3
GdipFillPieI 2
GdipFillRegion 1
GdipFlush 1
GdipGetClip 1
GdipGetDC 7
GdipGetDpiX 1
GdipGetDpiY 1
GdipGetEncoderParameterList 2
GdipGetEncoderParameterListSize 2
GdipGetFamily 1
GdipGetFamilyName 1
GdipGetFontCollectionFamilyCount 2
GdipGetFontCollectionFamilyList 1
GdipGetFontSize 2
GdipGetGenericFontFamilySansSerif 4
GdipGetHatchBackgroundColor 1
GdipGetHatchForegroundColor 3
GdipGetHatchStyle 2
GdipGetImageDecoders 1
GdipGetImageDecodersSize 1
GdipGetImageDimension - Jonathan 3
GdipGetImageEncoders - Nathan 12
GdipGetImageEncodersSize - Nathan 15
GdipGetImagePalette 1
GdipGetImagePaletteSize 1
GdipGetImageThumbnail 5
GdipGetLineColors 2
GdipGetLineRectI 2
GdipGetLineWrapMode 2
GdipGetPathWorldBoundsI 1
GdipGetPenFillType 2
GdipGetPenMode 2
GdipGetPenWidth 2
GdipGetPropertyCount 1
GdipGetPropertyItem 2
GdipGetRegionHRgn 2
GdipGetTextContrast 1
GdipGraphicsClear 5
GdipImageRotateFlip 2
GdipIsClipEmpty 1
GdipIsStyleAvailable 1
GdipIsVisibleRegionPointI 1
GdipLoadImageFromFile - Nathan 6
GdipLoadImageFromFileICM 2
GdipMeasureCharacterRanges 2
GdipNewInstalledFontCollection 1
GdipNewPrivateFontCollection 1
GdipPrivateAddFontFile 1
GdipReleaseDC 7
GdipResetWorldTransform 4
GdipSaveImageToFile - Nathan 8
GdipSetClipRect 1
GdipSetClipRegion 2
GdipSetEmpty 2
GdipSetImageAttributesRemapTable 1
GdipSetLineColors 3
GdipSetLinePresetBlend 2
GdipSetPenCompoundArray 1
GdipSetPenMode 2
GdipSetPropertyItem 1
GdipSetStringFormatFlags 2
GdipSetStringFormatMeasurableCharacterRanges 1
GdipSetTextContrast 1
GdipStringFormatGetGenericDefault 1
GdipTranslateLineTransform 1
GdipTranslateRegionI 1
GdipTranslateTextureTransform 1
GdipWarpPath 2

Compiling on Win32

The Windows SDK comes with a command line compiler, and the headers / libraries necessary to compile win32 programs.

After installing the SDK, you can start a shell via: Programs -> Microsoft Windows SDK -> CMD Shell

So now, let's say you have a program called cs130proj, and its source files are: proj.c and utils.c. To compile this project, run:

cl -c proj.c
cl -c utils.c
cl -o cs130proj.exe proj.obj utils.obj foo.lib bar.lib

A simple makefile for this would look like:

LIBRARIES = foo.lib bar.lib
APP = cs130proj.exe
OBJ = proj.obj utils.obj

all: $(APP)

$(APP): $(OBJ)
	$(CC) -o $(APP) $(OBJ) $(LIBRARIES)

.c.obj:
	$(CC) -c $<

clean:
	del $(APP) $(OBJ)

See also: Using Microsoft C++ Toolkit on Linux

Compiling Wine Tests on Windows

We need to make sure the conformance tests we write work on Windows to begin with. This means we need to compile and run the tests on Windows.

With GDI+, the Windows SDK header files conflict with the Wine gdiplus header files. To get around that, do the following:

Copy wine-version/include/gdiplus*.h to wine-version/dlls/gdiplus/tests/wine/.

You also need to copy wine-version/include/wine/test.h to wine-version/dlls/gdiplus/tests/wine/test.h. Then, from wine-version/dlls/gdiplus/tests, run:

cl -DSTANDALONE -D_X86_ foo.c gdiplus.lib -I .\wine

This will generate the test program foo.exe.

There's more information on this subject here and here.

Working with Wine

5 minute intro to Wine development (may not apply all that much to gdiplus)
The GdiPlus Wiki Page (possibly a better starting point)

Useful Links

Documentation

Browsing the code

Mailing lists

Overview page
I subscribe to: wine-devel, wine-patches, wine-cvs, and wine-bugs. You probably should only subscribe to wine-devel and wine-patches. The wine-patches mailing list is relatively high in traffic, so be prepared to set up email filters.

Conformance Tests

Wine Developer's Guide - Writing Conformance tests
More on Wine Testing (not Wine Tasting)

Examples: Gdiplus: Pen, Comctl32: Status Bar

Also: Nightly Test Results

Wine Test Macros

Wine has a couple useful macros for testing.

The first one is ok().

ok(test, output_msg, args...);

test can be anything statement, and if it evaluates to true, then the test passes. Otherwise, the test fails and Wine prints an error message.

output_msg, args... - output_msg is a string in the same format used by printf() and args... are the variable arguments for values in the format string.

Example: result = MyFunction(arg1, arg2, arg3); ok(result == 5, "Expected 5, got %d\n", r);

Sometimes a test case will work on Windows, but it is known not to work with Wine. For such a case, put it inside a todo_wine() statement. This has several effects: (1) the failure is listed as a todo instead, (2) when the problem gets fixed eventually, the todo will become a failure to alert you, (3) this separates known failures from new failures that can occur through regression.

Compiling Wine

Compiling the entire Wine tree can be a time consuming process (8-20 minutes on a modern machine. Fortunately, most of the time we will just be making changes in the dlls/gdiplus/ directory, so it's not so bad. If you are on a multi-core/processor machine, remember to use make's -j option to speed up the process.

Here's a list of packages needed to compile Wine on certain Linux distributions.

Compiling Windows Program with Wine

To compile Windows program with Wine, use winegcc/wineg++. It takes the same arguments as gcc, so to compile and link a program with gdiplus, run: winegcc -o foo foo.c -lgdiplus.

GIT

Wine switched from CVS to Git for revision control. (Git is also used by the Linux Kernel - It's written by this guy named Linus) Here's a couple documents to get started:
Using Git With Wine
More info about Wine and Git
The Wine Git Tree

Submitting Patches

In case you didn't know: patch and diff.

Generating and Submitting Patches

Example: Patch sent to wine-patches, Patch accepted on wine-cvs

When sending in the email, attaching the patch should work in most case. (It least it does for me with Mutt and Gmail) Pasting your code into the body of the email may not work right because many email clients wrap text. It's also nice to include the diffstat as shown here:

 dlls/riched20/editor.c       |   26 ++++++++++++++++++--------
 dlls/riched20/tests/editor.c |   10 +++++-----
 2 files changed, 23 insertions(+), 13 deletions(-)

To generate this, run:
diffstat -w 72 your.patch

If you are using Git to generate the patches with git-format-patch, then you do not need to run diffstat. It's automatically done for you.

Bugzilla

Bugzilla is a bug tracking system. This is the Wine Bugzilla.

Sample bug

Here is A sample bug (#10431). There's a lot of information on this page, some of the fields are explained here.

Outstanding Bugs

This is the current list of open bugs for gdiplus.

This is a list of applications people have filed bugs for, along with the list of functions needed to make the application work. The functions names in bold are the ones causing the most immediate crash. Click on the [*] in the left-most column to collapse/expand that row.

You may also be interested in The list of GDI+ Functions.

Bug Application Function Needed Status Notes
[*] 8919 CSS Tab Designer 2
GdipCloneBitmapAreaI
GdipCloneImage
GdipCreateBitmapFromGdiDib
GdipCreateBitmapFromHBITMAP
GdipCreateCachedBitmap
GdipCreateHatchBrush
GdipDeleteCachedBitmap
GdipDrawArcI - Other Wine developer
GdipDrawBezierI - Other Wine developer
GdipDrawCachedBitmap
GdipDrawClosedCurve2I
GdipDrawCurve2I
GdipDrawEllipseI
GdipDrawImagePointRect
GdipDrawImageRectI
GdipDrawImageRectRectI - Jonathan
GdipDrawPieI
GdipDrawPolygonI
GdipFillClosedCurveI
GdipFillEllipseI
GdipFillPieI
GdipGetDC
GdipGetEncoderParameterList
GdipGetEncoderParameterListSize
GdipGetHatchBackgroundColor
GdipGetHatchForegroundColor
GdipGetHatchStyle
GdipGetImageDimension - Jonathan
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetLineColors
GdipGetLineRectI
GdipGetLineWrapMode
GdipGetPenFillType
GdipGetPenMode
GdipGetPenWidth
GdipGraphicsClear
GdipLoadImageFromFile - Nathan
GdipReleaseDC
GdipSetLineColors
GdipSetPenMode
7 / 42
Hey, this app kinda works now.
[*] 9364 Pando
GdipAddPathRectangle
GdipAddPathString
GdipCloneBitmapAreaI
GdipCloneImage
GdipCreateBitmapFromHBITMAP
GdipCreateBitmapFromResource
GdipCreateFont
GdipCreateFontFamilyFromName
GdipCreateHatchBrush
GdipCreateTexture
GdipDeleteFontFamily
GdipDrawImageRect
GdipDrawImageRectI
GdipDrawPolygon
GdipDrawRectangle
GdipFillEllipseI
GdipGetFontSize
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipSetLinePresetBlend
GdipWarpPath
2 / 21
[*] 9362 Incredimail
GdipGetImageEncodersSize - Nathan
More?
0 / NA
I had trouble installing this.
Dan says it's gotten past its gdiplus issues
[*] 9366 Quicktime Player
GdipAddPathBezier
GdipAddPathLine
GdipCloneBitmapAreaI
GdipCloneImage
GdipCloneStringFormat
GdipCombineRegionPath
GdipCombineRegionRectI
GdipCreateBitmapFromHBITMAP
GdipCreateFont
GdipCreateFontFromDC
GdipCreateRegion
GdipCreateRegionRectI
GdipCreateTexture
GdipDeleteRegion
GdipDrawImageRectI
GdipDrawImageRectRectI - Jonathan
GdipFillRegion
GdipFlush
GdipGetDC
GdipGetGenericFontFamilySansSerif
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImageThumbnail
GdipGetPathWorldBoundsI
GdipGetRegionHRgn
GdipGraphicsClear
GdipMeasureCharacterRanges
GdipReleaseDC
GdipSaveImageToFile - Nathan
GdipSetClipRegion
GdipSetEmpty
GdipSetStringFormatFlags
GdipSetStringFormatMeasurableCharacterRanges
GdipStringFormatGetGenericDefault
GdipTranslateLineTransform
4 / 35
Need to set Windows version to Windows XP in winecfg. Quicktime oftentimes blank the screen.
[*] 9678 Buro Plus Next 8.5
GdipGetImageEncodersSize - Nathan
More?
0 / NA
Need to register (in German) to download
[*] 9860 MSN Messenger 8.1
GdipCloneImage
GdipCreateBitmapFromHBITMAP
GdipDrawImageRectI
GdipGetClip
GdipGetDC
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImagePalette
GdipGetImagePaletteSize
GdipGetPropertyItem
GdipGetTextContrast
GdipIsClipEmpty
GdipReleaseDC
GdipResetWorldTransform
GdipSaveImageToFile - Nathan
GdipSetClipRect
GdipSetClipRegion
GdipSetTextContrast
GdipTranslateRegionI
3 / 19
Need to set Wine Version to XP.
It kinda starts up, doesn't really work yet.
[*] 9963
10431
GPSMapEdit
GdipDrawImageRectRectI - Jonathan
GdipGetImageDecoders
GdipGetImageDecodersSize
GdipGetImageDimension - Jonathan
GdipLoadImageFromFile - Nathan
3 / 5
[*] 10269 Art Rage Starter Edition 2.5
GdipGetImageEncodersSize - Nathan
More?
0 / NA
Is this downloadable?
[*] 10285 Google Talk
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipSaveImageToFile - Nathan
3 / 3
Installer no longer crashes due to gdiplus issues
[*] 10449 Broken Cross Disk Manager
GdipCloneImage
GdipCreateBitmapFromFileICM - Ethan
GdipCreateBitmapFromHBITMAP
GdipDrawImageRectRectI - Jonathan
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImageThumbnail
GdipSaveImageToFile - Nathan
5 / 8
[*] 10700 Dragon Natural Speaking
GdipDrawArcI - Other Wine developer
GdipSetLinePresetBlend
1 / 2
[*] 10785 Slingplayer
GdipCloneImage
GdipCombineRegionRectI
GdipCreateRegion
GdipCreateTexture2I
GdipDeleteRegion
GdipDrawImageRectI
GdipDrawImageRectRectI - Jonathan
GdipGetDC
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImageThumbnail
GdipGetRegionHRgn
GdipIsVisibleRegionPointI
GdipLoadImageFromFile - Nathan
GdipLoadImageFromFileICM
GdipReleaseDC
GdipSaveImageToFile - Nathan
GdipSetEmpty
GdipSetImageAttributesRemapTable
5 / 19
Flaky installer
[*] 10788 Windows Movie Maker
GdipAddPathPolygonI
GdipAddPathRectangle
GdipAddPathString
GdipCloneFontFamily
GdipCloneImage
GdipCloneStringFormat
GdipCreateBitmapFromFileICM - Ethan
GdipCreateBitmapFromGdiDib
GdipCreateBitmapFromHBITMAP
GdipCreateBitmapFromHICON
GdipCreateBitmapFromResource
GdipCreateFont
GdipCreateFontFamilyFromName
GdipCreateFontFromDC
GdipDeleteFontFamily
GdipDrawImagePointRectI
GdipDrawImageRect
GdipDrawImageRectI
GdipDrawImageRectRectI - Jonathan
GdipGetFamily
GdipGetFamilyName
GdipGetFontCollectionFamilyCount
GdipGetFontCollectionFamilyList
GdipGetFontSize
GdipGetGenericFontFamilySansSerif
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImageThumbnail
GdipGetPropertyItem
GdipGraphicsClear
GdipImageRotateFlip
GdipIsStyleAvailable
GdipNewInstalledFontCollection
GdipResetWorldTransform
GdipSaveImageToFile - Nathan
GdipSetLineColors
GdipSetPropertyItem
GdipSetStringFormatFlags
GdipTranslateTextureTransform
GdipWarpPath
5 / 40
Need to set Windows version to Windows XP in winecfg.
[*] 10903 Visere
GdipAddPathArcI
GdipAddPathCurve
GdipAddPathLine
GdipCloneImage
GdipCreateBitmapFromFileICM - Ethan
GdipCreateBitmapFromHBITMAP
GdipCreateFontFromDC
GdipCreateHBITMAPFromBitmap
GdipCreateTexture
GdipDrawImageRect
GdipGetDC
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetImageThumbnail
GdipImageRotateFlip
GdipReleaseDC
GdipResetWorldTransform
GdipSaveImageToFile - Nathan
4 / 18
[*] 10980 ConvertImage
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetPropertyCount
GdipLoadImageFromFile - Nathan
3 / 4
Source code available
Pretty much works now, as long as we convert to BMP
[*] 10981 Anti-Grain Geometry GDI Demo
GdipCloneImage
GdipCreateAdjustableArrowCap
GdipDrawImagePointRectI
GdipFillEllipse
GdipGraphicsClear
0 / 5
Source code available
[*] 10982 ClearScale
GdipBitmapSetPixel
GdipCloneImage
GdipCreateFontFamilyFromName
GdipDeleteFontFamily
GdipDrawImageRectRectI - Jonathan
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipSaveImageToFile - Nathan
4 / 8
[*] 11033 My Sirius Studio
GdipGetGenericFontFamilySansSerif
More?
0 / NA
Need to set Windows version to Windows XP in winecfg, needs .NET
[*] 11054 EasyGPS
GdipBitmapSetPixel
GdipCloneBitmapAreaI
GdipCloneImage
GdipCreateBitmapFromResource
GdipCreateCachedBitmap
GdipCreateFont
GdipCreateFontFamilyFromName
GdipCreateHatchBrush
GdipDeleteCachedBitmap
GdipDeleteFontFamily
GdipDeletePrivateFontCollection
GdipDrawCachedBitmap
GdipDrawEllipseI
GdipDrawImageRectRectI - Jonathan
GdipDrawPolygon
GdipDrawRectangle
GdipFillEllipse
GdipGetDpiX
GdipGetDpiY
GdipGetFontCollectionFamilyCount
GdipGetGenericFontFamilySansSerif
GdipNewPrivateFontCollection
GdipPrivateAddFontFile
GdipResetWorldTransform
GdipSetPenCompoundArray
1 / 25
[*] 11086 Noiseware
GdipSaveImageToFile - Nathan
GdipCreateBitmapFromHBITMAP
GdipGetImageEncodersSize - Nathan
GdipGetImageEncoders - Nathan
GdipCloneImage
3/ 5
[*] 11225 Amazon MP3 Downloader
GdipCloneImage
GdipCreateFontFromDC
GdipDrawImageRectI
GdipGetDC
GdipLoadImageFromFile - Nathan
GdipLoadImageFromFileICM???
GdipMeasureCharacterRanges???
GdipReleaseDC
1 / 8
Need to set Windows version to Windows XP in winecfg.
[*] No Bug # PowerWorld Simulator
GdipCloneBitmapAreaI
GdipCloneImage
GdipCreateBitmapFromGdiDib
GdipCreateBitmapFromHBITMAP
GdipCreateCachedBitmap
GdipCreateHatchBrush
GdipDeleteCachedBitmap
GdipDrawArcI - Other Wine developer
GdipDrawBezierI - Other Wine developer
GdipDrawCachedBitmap
GdipDrawClosedCurve2I
GdipDrawCurve2I
GdipDrawEllipseI
GdipDrawImagePointRect
GdipDrawImageRectI
GdipDrawImageRectRectI - Jonathan
GdipDrawPieI
GdipDrawPolygonI
GdipFillClosedCurveI
GdipFillEllipseI
GdipFillPieI
GdipGetDC
GdipGetEncoderParameterList
GdipGetEncoderParameterListSize
GdipGetHatchBackgroundColor
GdipGetHatchForegroundColor
GdipGetHatchStyle
GdipGetImageDimension - Jonathan
GdipGetImageEncoders - Nathan
GdipGetImageEncodersSize - Nathan
GdipGetLineColors
GdipGetLineRectI
GdipGetLineWrapMode
GdipGetPenFillType
GdipGetPenMode
GdipGetPenWidth
GdipGraphicsClear
GdipLoadImageFromFile - Nathan
GdipReleaseDC
GdipSetLineColors
GdipSetPenMode
7 / 41
Comes with gdiplus.dll.

/~leiz/software/wine/cs130_w08.php last updated on Wed Dec 31 1969