├── .azure-pipelines.yml ├── .gitattributes ├── .gitignore ├── .gitmodules ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── AUTHORS ├── CODE-OF-CONDUCT.md ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile.am ├── NEWS ├── README.md ├── TODO ├── autogen.sh ├── configure.ac ├── docs ├── regions └── valgrind ├── libgdiplus.pc.in ├── libgdiplus.sln ├── libgdiplus0.spec.in ├── src ├── .gitignore ├── GdiPlusFlat.h ├── Makefile.am ├── adjustablearrowcap-private.h ├── adjustablearrowcap.c ├── adjustablearrowcap.h ├── alpha-premul-table.inc ├── bitmap-private.h ├── bitmap.c ├── bitmap.h ├── bmpcodec.c ├── bmpcodec.h ├── brush-private.h ├── brush.c ├── brush.h ├── carbon-private.c ├── carbon-private.h ├── codecs-private.h ├── codecs.h ├── customlinecap-private.h ├── customlinecap.c ├── customlinecap.h ├── dstream.c ├── dstream.h ├── emfcodec.c ├── emfcodec.h ├── emfplus.c ├── emfplus.h ├── font-private.h ├── font.c ├── font.h ├── fontcollection-private.h ├── fontcollection.h ├── fontfamily-private.h ├── fontfamily.h ├── gdi32.c ├── gdi32.h ├── gdip.h ├── gdipenums.h ├── gdiplus-private.h ├── gdiplusimaging.h ├── gdipluspixelformats.h ├── gdipstructs.h ├── general-private.h ├── general.c ├── general.h ├── gifcodec.c ├── gifcodec.h ├── graphics-cairo-private.h ├── graphics-cairo.c ├── graphics-metafile-private.h ├── graphics-metafile.c ├── graphics-path-private.h ├── graphics-path.c ├── graphics-path.h ├── graphics-pathiterator-private.h ├── graphics-pathiterator.c ├── graphics-pathiterator.h ├── graphics-private.h ├── graphics.c ├── graphics.h ├── hatchbrush-private.h ├── hatchbrush.c ├── hatchbrush.h ├── icocodec.c ├── icocodec.h ├── image-private.h ├── image.c ├── image.h ├── imageattributes-private.h ├── imageattributes.c ├── imageattributes.h ├── jpegcodec.c ├── jpegcodec.h ├── libgdiplus.vcxproj ├── lineargradientbrush-private.h ├── lineargradientbrush.c ├── lineargradientbrush.h ├── matrix-private.h ├── matrix.c ├── matrix.h ├── metafile-private.h ├── metafile.c ├── metafile.h ├── pathgradientbrush-private.h ├── pathgradientbrush.c ├── pathgradientbrush.h ├── pen-private.h ├── pen.c ├── pen.h ├── pngcodec.c ├── pngcodec.h ├── print.c ├── region-bitmap.c ├── region-bitmap.h ├── region-path-tree.c ├── region-path-tree.h ├── region-private.h ├── region.c ├── region.h ├── solidbrush-private.h ├── solidbrush.c ├── solidbrush.h ├── stringformat-private.h ├── stringformat.c ├── stringformat.h ├── text-cairo-private.h ├── text-cairo.c ├── text-metafile-private.h ├── text-metafile.c ├── text-pango-private.h ├── text-pango.c ├── text.c ├── text.h ├── text.notes ├── texturebrush-private.h ├── texturebrush.c ├── texturebrush.h ├── tiffcodec.c ├── tiffcodec.h ├── win32-private.c ├── win32-private.h ├── win32structs.h ├── wmfcodec.c └── wmfcodec.h ├── tests ├── .gitignore ├── AdobeRGB1998.icc ├── Makefile.am ├── gtest.cpp ├── lsansuppressions.txt ├── test-exif.jpg ├── test-gsa.png ├── test-trns.png ├── test.bmp ├── test.emf ├── test.gif ├── test.ico ├── test.jpg ├── test.otf ├── test.png ├── test.tif ├── test.ttf ├── test.wmf ├── test3.ico ├── testadjustablearrowcap.c ├── testbitmap.c ├── testbits.c ├── testbmpcodec.c ├── testbrush.c ├── testclip.c ├── testcodecs.c ├── testcustomlinecap.c ├── testemfcodec.c ├── testfont.c ├── testgdi.c ├── testgeneral.c ├── testgifcodec.c ├── testgpimage.c ├── testgraphics.c ├── testgraphicsdraw.c ├── testgraphicsfill.c ├── testgraphicspath.c ├── testhatchbrush.c ├── testhelpers.h ├── testicocodec.c ├── testimageattributes.c ├── testjpegcodec.c ├── testlineargradientbrush.c ├── testmatrix.c ├── testmetafile.c ├── testpathgradientbrush.c ├── testpen.c ├── testpng.c ├── testpngcodec.c ├── testregion.c ├── testreversepath.c ├── testsolidbrush.c ├── teststringformat.c ├── testtext.c ├── testtexturebrush.c ├── testtiffcodec.c └── testwmfcodec.c ├── update_submodules.sh └── winconfig.h.in /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh crlf=input 2 | *.inc linguist-language=C 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | config.guess 4 | config.h 5 | config.h.in 6 | config.sub 7 | config.log 8 | configure 9 | depcomp 10 | install-sh 11 | libgdiplus.pc 12 | libgdiplus0.spec 13 | ltmain.sh 14 | missing 15 | aclocal.m4 16 | autom4te.cache/ 17 | libtool.m4 18 | lt~obsolete.m4 19 | ltoptions.m4 20 | ltsugar.m4 21 | ltversion.m4 22 | config.status 23 | libtool 24 | stamp-h1 25 | test-driver 26 | compile 27 | tests/*.trs 28 | tests/*.log 29 | .vs/ 30 | Debug/ 31 | Release/ 32 | *.user 33 | gtk/ 34 | *.7z 35 | packages/ 36 | .vscode/* 37 | !.vscode/settings.json 38 | !.vscode/tasks.json 39 | !.vscode/launch.json 40 | !.vscode/extensions.json 41 | 42 | ### Windows ### 43 | 44 | # Windows image file caches 45 | Thumbs.db 46 | ehthumbs.db 47 | 48 | # Folder config file 49 | Desktop.ini 50 | 51 | # Recycle Bin used on file shares 52 | $RECYCLE.BIN/ 53 | 54 | # Windows Installer files 55 | *.cab 56 | *.msi 57 | *.msm 58 | *.msp 59 | 60 | # Windows shortcuts 61 | *.lnk 62 | 63 | ### macOS ### 64 | *.DS_Store 65 | .AppleDouble 66 | .LSOverride 67 | 68 | # Icon must end with two \r 69 | Icon 70 | 71 | # Thumbnails 72 | ._* 73 | 74 | # Files that might appear in the root of a volume 75 | .DocumentRevisions-V100 76 | .fseventsd 77 | .Spotlight-V100 78 | .TemporaryItems 79 | .Trashes 80 | .VolumeIcon.icns 81 | .com.apple.timemachine.donotpresent 82 | 83 | # Directories potentially created on remote AFP share 84 | .AppleDB 85 | .AppleDesktop 86 | Network Trash Folder 87 | Temporary Items 88 | .apdisk 89 | 90 | # gcc coverage testing tool files 91 | *.gcno 92 | *.gcda 93 | *.gcov 94 | coverage.info 95 | /coverage 96 | 97 | *.tmp 98 | 99 | # googletest build output 100 | gtest_build/ 101 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/googletest"] 2 | path = external/googletest 3 | url = https://github.com/google/googletest.git 4 | branch = v1.8.x 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "(lldb) Launch", 6 | "type": "cppdbg", 7 | "request": "launch", 8 | "preLaunchTask": "Build", 9 | "program": "${workspaceFolder}/tests/.libs/${fileBasenameNoExtension}", 10 | "args": [], 11 | "stopAtEntry": false, 12 | "cwd": "${workspaceFolder}", 13 | "environment": [{ 14 | "Name": "DYLD_LIBRARY_PATH", 15 | "Value": "${workspaceFolder}/src/.libs:$DYLD_LIBRARY_PATH" 16 | }], 17 | "externalConsole": false, 18 | "MIMode": "lldb" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "metafile-private.h": "c", 4 | "win32-private.h": "c", 5 | "__locale": "c", 6 | "string": "c", 7 | "string_view": "c", 8 | "vector": "c", 9 | "jpegcodec.h": "c", 10 | "jpeglib.h": "c", 11 | "dstream.h": "c", 12 | "jconfig.h": "c", 13 | "jmorecfg.h": "c" 14 | } 15 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build", 8 | "type": "shell", 9 | "command": "make", 10 | "group": { 11 | "kind": "build", 12 | "isDefault": true 13 | }, 14 | "args": [ 15 | "-j4", 16 | "QUIET=0" 17 | ], 18 | "problemMatcher": { 19 | "owner": "cpp", 20 | "fileLocation": ["absolute"], 21 | "pattern": { 22 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 23 | "file": 1, 24 | "line": 2, 25 | "column": 3, 26 | "severity": 4, 27 | "message": 5 28 | } 29 | } 30 | }, 31 | { 32 | "label": "Test", 33 | "type": "shell", 34 | "command": "make", 35 | "args": [ 36 | "check", 37 | "-j4" 38 | ], 39 | "dependsOn": "Build", 40 | "group": { 41 | "kind": "test", 42 | "isDefault": true 43 | }, 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The following people made libgdiplus happen: 2 | 3 | Alexandre Pigolkine 4 | Duncan Mak 5 | Jordi Mas 6 | Mark Steele 7 | Miguel de Icaza 8 | Ravindra Kumar 9 | Vladimir Vukicevic 10 | Sanjay Gupta 11 | Peter Bartok 12 | Hisham Mardam Bey 13 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | 6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 7 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | See LICENSE file in the project root for full license information. 2 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | Check git history for latest changes. 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 2 | and associated documentation files (the "Software"), to deal in the Software without restriction, 3 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 4 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 5 | subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial 8 | portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 11 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 12 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 13 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 14 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = src tests 4 | DIST_SUBDIRS = src tests 5 | 6 | pkgconfigdir = $(libdir)/pkgconfig 7 | 8 | pkgconfig_DATA= libgdiplus.pc 9 | 10 | DISTCLEANFILES= libgdiplus.pc 11 | 12 | EXTRA_DIST = libgdiplus.pc.in README.md LICENSE libgdiplus.sln winconfig.h.in update_submodules.sh external/googletest 13 | 14 | all: update_submodules 15 | 16 | update_submodules: 17 | @cd $(top_srcdir) && ./update_submodules.sh 18 | 19 | .PHONY: update_submodules 20 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See http://www.mono-project.com/docs/gui/libgdiplus/ for the most recent details 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## libgdiplus: An Open Source implementation of the GDI+ API. 2 | 3 | This is part of the [Mono project](http://www.mono-project.com/). 4 | 5 | Build status: 6 | 7 | [![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/mono/mono-libgdiplus-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=617&branchName=main) 8 | 9 | ### Requirements: 10 | 11 | This requires the libraries used by the Cairo vector graphics library to build (freetype2, fontconfig, Xft2 and libpng). 12 | 13 | On **OSX** you can use [Homebrew](https://brew.sh/) to install the dependencies: 14 | 15 | brew install glib cairo libexif libjpeg giflib libtiff autoconf libtool automake pango pkg-config 16 | brew link gettext --force 17 | 18 | On **Debian-based Linux distributions** you can use `apt-get` to install the dependencies: 19 | 20 | sudo apt-get install libgif-dev autoconf libtool automake build-essential gettext libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev 21 | 22 | On **Windows** you can use [Vcpkg](https://github.com/Microsoft/vcpkg) to install the dependencies. Run the following commands from the root of the repository from an admin command prompt: 23 | 24 | bootstrap-vcpkg.bat 25 | vcpkg.exe install giflib libjpeg-turbo libpng cairo glib tiff libexif pango --triplet x86-windows 26 | vcpkg.exe install giflib libjpeg-turbo libpng cairo glib tiff libexif pango --triplet x64-windows 27 | vcpkg.exe integrate install 28 | 29 | ### Build instructions 30 | 31 | To build on **OSX** without X11: 32 | 33 | ./autogen.sh --without-x11 --prefix=YOUR_PREFIX 34 | make 35 | 36 | To build on **OSX with X11** (e.g. from XQuartz): 37 | 38 | PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig ./autogen.sh --prefix=YOUR_PREFIX 39 | make 40 | 41 | To build on **Linux**: 42 | 43 | ./autogen.sh --prefix=YOUR_PREFIX 44 | make 45 | 46 | To build on **Windows**, open `libgdiplus.sln`. 47 | 48 | ### Running the unit tests 49 | 50 | Run the following command from the root of the repository: 51 | 52 | make check 53 | 54 | To run the tests with Clang sanitizers, run the following command from the root of the repository: 55 | 56 | ./autogen.sh --enable-asan 57 | make check 58 | 59 | To run the unit tests with leak sanitizers, run the following command from the root of the repository: 60 | 61 | ./autogen.sh --enable-asan 62 | export ASAN_OPTIONS=detect_leaks=1:fast_unwind_on_malloc=0 63 | export LSAN_OPTIONS=suppressions=lsansuppressions.txt 64 | make check 65 | 66 | ### Code coverage 67 | 68 | Code coverage stats are generated with `lcov`. You can use [Homebrew](https://brew.sh/) on **OSX** to install the dependencies: 69 | 70 | brew install lcov 71 | 72 | To run the tests with code coverage, run the following commands from the root of the repository: 73 | 74 | ./autogen.sh --enable-coverage 75 | make check 76 | lcov --capture --directory src --output-file coverage.info 77 | genhtml coverage.info --output-directory coverage 78 | 79 | To view the coverage report, navigate to the `coverage` directory in the root of the repository and open `index.html`. 80 | 81 | ### Installing libgdiplus 82 | 83 | Run the following command from the root of the repository: 84 | 85 | make install 86 | 87 | ### Optional build options 88 | 89 | --with-pango 90 | 91 | This builds libgdiplus using Pango to render (measure and draw) 92 | all of it's text. This requires Pango version 1.38 (or later). 93 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | This file has a list of functionality not yet implemented or issues that 2 | have to be fixed in libgdiplus. 3 | 4 | ---- Functionality not implemented 5 | 6 | * Image formats 7 | 8 | - WMF and EMF. We have limited support metafiles. 9 | 10 | * Path 11 | 12 | - add missing implementation for 13 | - [path gradient brush](https://bugzilla.novell.com/show_bug.cgi?id=321034) 14 | - [path widen](https://bugzilla.novell.com/show_bug.cgi?id=320856) 15 | - [path warp](https://bugzilla.novell.com/show_bug.cgi?id=400775) 16 | 17 | ---- Not implemented / partially implemented functions 18 | 19 | * Handle functions 20 | 21 | Functions that use or create Win32 handles and are not yet implemented 22 | (except for window and device needed in System.Windows.Forms.) 23 | 24 | GdipCreateBitmapFromResource 25 | GdipCreateFontFromDC 26 | GdipCreateFromHWND 27 | 28 | * Generic functions 29 | 30 | GdipBeginContainer2 31 | GdipBeginContainerI 32 | GdipGetPixelOffsetMode [2] 33 | GdipGetTextContrast [2] 34 | GdipSetPixelOffsetMode [2] 35 | GdipSetTextContrast [2] 36 | GdipTransformPoints 37 | GdipTransformPointsI 38 | 39 | * Image handling 40 | 41 | GdipSetImageAttributesThreshold 42 | GdipSetImageAttributesOutputChannelColorProfile 43 | GdipGetImageAttributesAdjustedPalette 44 | GdipSetImageAttributesOutputChannel 45 | GdipLoadImageFromStream 46 | GdipSaveImageToStream 47 | GdipSaveAdd 48 | GdipSaveAddImage 49 | 50 | * Functions related to paths 51 | 52 | GdipAddString [1] 53 | GdipAddStringI [1] 54 | GdipWindingModeOutline 55 | GdipWidenPath 56 | GdipWarpPath 57 | 58 | 59 | Notes 60 | [1] Partially implemented. LayoutRect and StringFormat are ignored. 61 | [2] Function exists (return Ok) but doesn't do anything (visually or not) 62 | [3] Function exists (return Ok) but only display a warning on the console 63 | [4] Partially implemented. GpGraphics is ignored. 64 | 65 | ---- Known Limitations 66 | 67 | * Maximum of 32bpp 68 | 69 | GDI+ supports bitmaps with more than 32bpp. 70 | http://bugzilla.ximian.com/show_bug.cgi?id=80693 71 | 72 | * Coordinates limitations 73 | 74 | GDI+ supports 32bips of precision (Cairo is limited to 15bits) 75 | http://bugzilla.ximian.com/show_bug.cgi?id=79729 76 | 77 | * Cairo doesn't support 8-bit pseudocolor visuals 78 | 79 | http://bugzilla.ximian.com/show_bug.cgi?id=77937 80 | 81 | * Cairo doesn't implement cairo_stroke_to_path 82 | 83 | GdipWidenPath implementation depends on this feature. 84 | http://bugzilla.ximian.com/show_bug.cgi?id=78110 85 | 86 | ---- 87 | 88 | last updated: August 9th, 2007 89 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | # Ripped off from GNOME macros version 4 | 5 | DIE=0 6 | 7 | srcdir=`dirname $0` 8 | test -z "$srcdir" && srcdir=. 9 | 10 | if [ -n "$MONO_PATH" ]; then 11 | # from -> /mono/lib:/another/mono/lib 12 | # to -> /mono /another/mono 13 | for i in `echo ${MONO_PATH} | tr ":" " "`; do 14 | i=`dirname ${i}` 15 | if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then 16 | ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" 17 | fi 18 | if [ -n "{i}" -a -d "${i}/bin" ]; then 19 | PATH="${i}/bin:$PATH" 20 | fi 21 | done 22 | export PATH 23 | fi 24 | 25 | (autoconf --version) < /dev/null > /dev/null 2>&1 || { 26 | echo 27 | echo "**Error**: You must have \`autoconf' installed to compile Mono." 28 | echo "Download the appropriate package for your distribution," 29 | echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" 30 | DIE=1 31 | } 32 | 33 | if [ -z "$LIBTOOLIZE" ]; then 34 | LIBTOOLIZE=`command -v glibtoolize 2>/dev/null` 35 | if [ ! -x "$LIBTOOLIZE" ]; then 36 | LIBTOOLIZE=`command -v libtoolize` 37 | fi 38 | fi 39 | 40 | (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { 41 | ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || { 42 | echo 43 | echo "**Error**: You must have \`libtool' installed to compile Mono." 44 | echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" 45 | echo "(or a newer version if it is available)" 46 | DIE=1 47 | } 48 | } 49 | 50 | grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { 51 | grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ 52 | (gettext --version) < /dev/null > /dev/null 2>&1 || { 53 | echo 54 | echo "**Error**: You must have \`gettext' installed to compile Mono." 55 | echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" 56 | echo "(or a newer version if it is available)" 57 | DIE=1 58 | } 59 | } 60 | 61 | (automake --version) < /dev/null > /dev/null 2>&1 || { 62 | echo 63 | echo "**Error**: You must have \`automake' installed to compile Mono." 64 | echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" 65 | echo "(or a newer version if it is available)" 66 | DIE=1 67 | NO_AUTOMAKE=yes 68 | } 69 | 70 | 71 | # if no automake, don't bother testing for aclocal 72 | test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { 73 | echo 74 | echo "**Error**: Missing \`aclocal'. The version of \`automake'" 75 | echo "installed doesn't appear recent enough." 76 | echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" 77 | echo "(or a newer version if it is available)" 78 | DIE=1 79 | } 80 | 81 | if test "$DIE" -eq 1; then 82 | exit 1 83 | fi 84 | 85 | if test x$NOCONFIGURE = x && test -z "$*"; then 86 | echo "**Warning**: I am going to run \`configure' with no arguments." 87 | echo "If you wish to pass any to it, please specify them on the" 88 | echo \`$0\'" command line." 89 | echo 90 | fi 91 | 92 | case $CC in 93 | xlc ) 94 | am_opt=--include-deps;; 95 | esac 96 | 97 | 98 | if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then 99 | if test -z "$NO_LIBTOOLIZE" ; then 100 | echo "Running libtoolize..." 101 | $LIBTOOLIZE --force --copy 102 | fi 103 | fi 104 | 105 | echo "Running aclocal $ACLOCAL_FLAGS ..." 106 | aclocal $ACLOCAL_FLAGS || { 107 | echo 108 | echo "**Error**: aclocal failed. This may mean that you have not" 109 | echo "installed all of the packages you need, or you may need to" 110 | echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" 111 | echo "for the prefix where you installed the packages whose" 112 | echo "macros were not found" 113 | exit 1 114 | } 115 | 116 | if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then 117 | echo "Running autoheader..." 118 | autoheader || { echo "**Error**: autoheader failed."; exit 1; } 119 | fi 120 | 121 | echo "Running automake --gnu $am_opt ..." 122 | automake --add-missing --gnu $am_opt || 123 | { echo "**Error**: automake failed."; exit 1; } 124 | echo "Running autoconf ..." 125 | autoconf || { echo "**Error**: autoconf failed."; exit 1; } 126 | 127 | CONF_OPTIONS="" 128 | until [ -z "$1" ] 129 | do 130 | CONF_OPTIONS="$CONF_OPTIONS $1" 131 | shift 132 | done 133 | 134 | conf_flags="--enable-maintainer-mode" 135 | 136 | if test x$NOCONFIGURE = x; then 137 | echo Running $srcdir/configure $conf_flags $CONF_OPTIONS ... 138 | $srcdir/configure $conf_flags $CONF_OPTIONS \ 139 | && echo Now type \`make\' to compile $PKG_NAME || exit 1 140 | else 141 | echo Skipping configure process. 142 | fi 143 | -------------------------------------------------------------------------------- /docs/regions: -------------------------------------------------------------------------------- 1 | Region implementations in libgdiplus 2 | Last update: 2006-03-23 3 | 4 | * Introduction 5 | 6 | First you should notice "implementations" in the title. Yes there is more 7 | than one implementation to handle region code. 8 | 9 | 10 | * Rectangular based regions 11 | 12 | The first implementation (i.e. the only one available before 1.1.14) is 13 | based on rectangles. A region is simply a list of rectangles and all 14 | binary operations (union, intersection, complement, exclude and xor) are 15 | done mathematically (i.e. they results in a new list of rectangles). 16 | 17 | This approach is simple, efficient and allow to implement some other GDI+ 18 | API very easily (e.g. GdipGetRegionData, GdipGetRegionDataSize, 19 | GdipGetRegionScans). 20 | 21 | However it is limited to rectangles (i.e. no polygons, beziers ...) and 22 | makes it impossible to implement some other GDI+ API, like 23 | GdipTransformRegion where the rectangles would be transformed into paths. 24 | Software depending on these features simply can't work. 25 | 26 | All the code for this implementation resides inside the file 27 | /libgdiplus/src/region.c 28 | 29 | 30 | * Bitmap based regions 31 | 32 | This implementation use 1bbp (1 bit per pixel) bitmaps to represent the 33 | regions. This allows us to implement the binary operators on memory 34 | buffers, not on coordinates (see /libgdiplus/src/region-bitmap.c). At 35 | display time (GdipFillRegion) the bitmap is used as the alpha channel and 36 | we simply draw a rectangle using the selected brush. 37 | 38 | This approach is simple, compared to a pure mathematical implementation, 39 | but not as efficient and somewhat less precise (float to int 40 | conversions). This is why the bitmap implementation co-exists with the 41 | rectangular based region code. Simple regions get treated simply ;-) 42 | 43 | To minimize the inconveniences the bitmaps are created only on demand 44 | (e.g. when an API requires them) and we try, as much as possible, to 45 | avoid this code path (e.g. using the rectangle code where possible, check 46 | for special cases, like an union with infinity...). 47 | 48 | Sadly having bitmaps isn't quite enough. We still have to be able to 49 | apply transforms (i.e. GdipTransformRegion) and be able to [de]serialize 50 | the region (GdipGetRegionData). While both operations _could_ be done 51 | with bitmaps the results wouldn't be very precise (transform) nor small 52 | (serialization). This is why the region keeps a tree of all the paths and 53 | operations required to re-construct itself (see 54 | /libgdiplus/src/region-path-tree.c). 55 | 56 | The code for this implementation resides in the files: 57 | 58 | /libgdiplus/src/region.c|h 59 | The GDI+ API for regions. The API will switch to the rectangle or 60 | bitmap code based on the regions type. If required a rectangle- 61 | based region will be "promoted" to a bitmap region. 62 | 63 | /libgdiplus/src/region-bitmap.c|h 64 | Handle the bitmap allocation, creation (from path), the binary 65 | operations, ... 66 | 67 | /libgdiplus/src/region-path-tree.c|h 68 | Handle the tree of path and (binary) operations required to 69 | re-construct the region if required (e.g. transform and 70 | serialization). 71 | 72 | There are currently two main limitations to this approach: 73 | 74 | 1. Memory. It's simply impossible to allocate enough memory for an 75 | "infinite" region. There is a maximum of 2 megabytes allocated for a 76 | region bitmap (see region-bitmap.h). This is enough (1bbp) for 77 | regions to cover a full screen resolution. 78 | 79 | 2. Clipping. Graphics.Clip can't use the bitmap (at least not without 80 | major changes). This means that clipping _will_work_ for any region 81 | (not just rectangles) until a binary operation is done on it. So far 82 | I've not seen any code trying that... 83 | 84 | 85 | * Future? 86 | 87 | A pure, totally mathematical, implementation would be a nice addition to 88 | libgdiplus. It could, once debugged, replace both the rectangular and 89 | bitmap implementations. 90 | 91 | The main advantages of this implementation would be: 92 | - reduced memory requirements (well most of the time); 93 | - (almost) unlimited size; 94 | - more precision (no float to int conversion); 95 | - no limits on clipping; 96 | 97 | So if it's the best solution why don't we have it yet ? 98 | 99 | Well it's really not an easy problem. Writing an effective intersector is 100 | a complex problem. You must deal with curves (well they could be cheated 101 | into linear paths) and a _lot_ of corner cases (google for them). Most 102 | existing (open source) implementation aren't satisfied with their results 103 | (e.g. libart, livarot). But don't let us discourage you from trying! ;-) 104 | -------------------------------------------------------------------------------- /docs/valgrind: -------------------------------------------------------------------------------- 1 | Using valgrind to find memory leaks in libgdiplus 2 | Last update: 2006-03-23 3 | 4 | * Introduction 5 | 6 | Valgrind (http://valgrind.org/) is a nice tool for finding memory leaks 7 | and related problems (e.g. like reusing freed memory). 8 | 9 | Libgdiplus is the foundation of Mono's System.Drawing.dll assembly. Any 10 | leak from libgdiplus will make your .NET application leak - no GC help 11 | here! 12 | 13 | There are many ways to run valgrind on libgdiplus. The most simple one is 14 | to use (or write) a C program using and use valgrind on it, but the most 15 | interesting one are running System.Drawing samples using Mono. 16 | 17 | 18 | * Using valgrind with Mono 19 | 20 | Historically Mono and Valgrind didn't always played well together. If 21 | this has discouraged you in the past then it's time to try it again! 22 | 23 | Recent valgrind versions are able to deal with for self-modifying 24 | programs (which is what the mono JIT does) by using the 25 | --smc-check=all option. 26 | 27 | As an extra bonus, Paolo (lupus) has shared his suppression file for 28 | Mono. This removes a lot, but not all, false positives (or unimportant) 29 | logs coming from the Mono runtime. This makes it easier and faster to 30 | find what you're looking for. The suppression file is available in 31 | Mono's SVN as /mono/data/mono.supp 32 | 33 | 34 | Sample usage: 35 | 36 | valgrind --tool=memcheck -v --leak-check=full --log-file=log 37 | --smc-check=all --suppressions=mono.supp mono app.exe 38 | 39 | This will run the app.exe application using mono and create a log file 40 | named "log.####" (where #### is the process id). The log file will 41 | indicates what leaked (and from where), what was (badly) reused after 42 | being freed, ... 43 | -------------------------------------------------------------------------------- /libgdiplus.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | 7 | Name: libgdiplus 8 | Description: GDI+ implementation 9 | Version: @VERSION@ 10 | Requires: glib-2.0 gmodule-2.0 gthread-2.0 11 | Libs: -L${libdir} -lgdiplus @GDIPLUS_PKG_LIBS@ 12 | Cflags: -I${includedir} @GDIPLUS_PKG_CFLAGS@ 13 | -------------------------------------------------------------------------------- /libgdiplus.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26403.7 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgdiplus", "src\libgdiplus.vcxproj", "{BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Debug|Win32.Build.0 = Debug|Win32 18 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Debug|x64.ActiveCfg = Debug|x64 19 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Debug|x64.Build.0 = Debug|x64 20 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Release|Win32.ActiveCfg = Release|Win32 21 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Release|Win32.Build.0 = Release|Win32 22 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Release|x64.ActiveCfg = Release|x64 23 | {BE724C6E-BF07-4B3E-901B-7584BC7B6C8A}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /libgdiplus0.spec.in: -------------------------------------------------------------------------------- 1 | %define real_name libgdiplus 2 | 3 | Name: libgdiplus0 4 | Version: @VERSION@ 5 | Release: 0 6 | License: LGPL v2.1 only ; MPL ; MIT License (or similar) 7 | Url: http://go-mono.org/ 8 | Source0: %{real_name}-%{version}.tar.bz2 9 | Summary: Open Source Implementation of the GDI+ API 10 | Group: Development/Libraries/Other 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-build 12 | Obsoletes: libgdiplus-devel 13 | Provides: libgdiplus-devel 14 | Obsoletes: libgdiplus 15 | Provides: libgdiplus 16 | 17 | BuildRequires: cairo-devel >= 1.6.4 18 | BuildRequires: fontconfig-devel 19 | BuildRequires: giflib-devel 20 | BuildRequires: glib2-devel 21 | BuildRequires: libexif-devel 22 | BuildRequires: libjpeg-devel 23 | BuildRequires: libpng-devel 24 | BuildRequires: libtiff-devel 25 | %if 0%{?suse_version} 26 | BuildRequires: freetype2-devel 27 | %else 28 | BuildRequires: freetype-devel 29 | %endif 30 | 31 | %description 32 | This is part of the Mono project. It is required when using 33 | Windows.Forms. 34 | 35 | %files 36 | %defattr(-, root, root) 37 | %_libdir/libgdiplus.so* 38 | %_libdir/pkgconfig/libgdiplus.pc 39 | %doc AUTHORS COPYING ChangeLog* NEWS README.md 40 | 41 | %prep 42 | %setup -q -n %{real_name}-%{version} 43 | 44 | %build 45 | export CFLAGS="$RPM_OPT_FLAGS" 46 | %configure 47 | make 48 | 49 | %install 50 | make install DESTDIR=%{buildroot} 51 | # Unwanted files: 52 | rm -f %{buildroot}%{_libdir}/libgdiplus.a 53 | rm -f %{buildroot}%{_libdir}/libgdiplus.la 54 | # Remove generic non-usefull INSTALL file... (appeases 55 | # suse rpmlint checks, saves 3kb) 56 | find . -name INSTALL | xargs rm -f 57 | 58 | %clean 59 | rm -rf "$RPM_BUILD_ROOT" 60 | 61 | %post -p /sbin/ldconfig 62 | 63 | %postun -p /sbin/ldconfig 64 | 65 | %changelog 66 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.lo 2 | *.o 3 | Makefile 4 | Makefile.in 5 | *.la 6 | .deps 7 | .libs 8 | -------------------------------------------------------------------------------- /src/GdiPlusFlat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | /* 24 | * This is *the* public header to be used by C/C++ consumers of GDI+ 25 | * and has the same name as MS provided header for the "flat API" 26 | */ 27 | 28 | #ifndef _FLATAPI_H 29 | #define _FLATAPI_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" 33 | { 34 | #endif 35 | 36 | /* 37 | * WINGDIPAPI is used to define the visibility of the GDI+ functions. If you're including GdiPlusFlat.h 38 | * file, you're using the public header, consuming GDI+, so the GDI+ functions are not exported in your library. 39 | */ 40 | #define WINGDIPAPI 41 | 42 | /* 43 | * If you ever need a workaround specific to libgdiplus then use the following define 44 | */ 45 | 46 | #define MONO_LIBGDIPLUS 1 47 | 48 | /* 49 | * public view of internal stuff (curious about them, check in *-private.h files ;-) 50 | */ 51 | 52 | typedef void GpAdjustableArrowCap; 53 | typedef void GpBitmap; 54 | typedef void GpBrush; 55 | typedef void GpCustomLineCap; 56 | typedef void GpFont; 57 | typedef void GpFontCollection; 58 | typedef void GpFontFamily; 59 | typedef void GpGraphics; 60 | typedef void GpHatch; 61 | typedef void GpImage; 62 | typedef void GpImageAttributes; 63 | typedef void GpLineGradient; 64 | typedef void GpMatrix; 65 | typedef void GpMetafile; 66 | typedef void GpPath; 67 | typedef void GpPathIterator; 68 | typedef void GpPathGradient; 69 | typedef void GpPen; 70 | typedef void GpRegion; 71 | typedef void GpSolidFill; 72 | typedef void GpState; 73 | typedef void GpStringFormat; 74 | typedef void GpTexture; 75 | 76 | /* 77 | * Do not include those headers directly. 78 | * Their content is public but, unlike this file, the header filenames do NOT match MS filenames! 79 | */ 80 | 81 | #include "gdipluspixelformats.h" 82 | #include "gdiplusimaging.h" 83 | #include "gdipenums.h" 84 | #include "gdipstructs.h" 85 | 86 | #include "general.h" 87 | #include "adjustablearrowcap.h" 88 | #include "bitmap.h" 89 | #include "brush.h" 90 | #include "customlinecap.h" 91 | #include "font.h" 92 | #include "fontcollection.h" 93 | #include "fontfamily.h" 94 | #include "graphics.h" 95 | #include "graphics-path.h" 96 | #include "graphics-pathiterator.h" 97 | #include "hatchbrush.h" 98 | #include "image.h" 99 | #include "imageattributes.h" 100 | #include "lineargradientbrush.h" 101 | #include "matrix.h" 102 | #include "metafile.h" 103 | #include "pathgradientbrush.h" 104 | #include "pen.h" 105 | #include "region.h" 106 | #include "solidbrush.h" 107 | #include "stringformat.h" 108 | #include "text.h" 109 | #include "texturebrush.h" 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES = libgdiplus.la 2 | 3 | libgdiplus_la_SOURCES = \ 4 | adjustablearrowcap.c \ 5 | adjustablearrowcap.h \ 6 | adjustablearrowcap-private.h \ 7 | alpha-premul-table.inc \ 8 | bitmap.c \ 9 | bitmap.h \ 10 | bitmap-private.h \ 11 | brush.c \ 12 | brush.h \ 13 | brush-private.h \ 14 | carbon-private.c \ 15 | carbon-private.h \ 16 | codecs.h \ 17 | codecs-private.h \ 18 | customlinecap.c \ 19 | customlinecap.h \ 20 | customlinecap-private.h \ 21 | dstream.c \ 22 | dstream.h \ 23 | font.c \ 24 | font.h \ 25 | font-private.h \ 26 | fontcollection.h \ 27 | fontcollection-private.h \ 28 | fontfamily.h \ 29 | fontfamily-private.h \ 30 | gdi32.h \ 31 | gdi32.c \ 32 | GdiPlusFlat.h \ 33 | gdiplus-private.h \ 34 | gdip.h \ 35 | gdipenums.h \ 36 | gdiplusimaging.h \ 37 | gdipluspixelformats.h \ 38 | gdipstructs.h \ 39 | general.c \ 40 | general.h \ 41 | general-private.h \ 42 | graphics.c \ 43 | graphics.h \ 44 | graphics-cairo.c \ 45 | graphics-cairo-private.h \ 46 | graphics-metafile.c \ 47 | graphics-metafile-private.h \ 48 | graphics-private.h \ 49 | graphics-path.c \ 50 | graphics-path.h \ 51 | graphics-path-private.h \ 52 | graphics-pathiterator.c \ 53 | graphics-pathiterator.h \ 54 | graphics-pathiterator-private.h \ 55 | hatchbrush.c \ 56 | hatchbrush.h \ 57 | hatchbrush-private.h \ 58 | icocodec.c \ 59 | icocodec.h \ 60 | image.c \ 61 | image.h \ 62 | image-private.h \ 63 | imageattributes.c \ 64 | imageattributes.h \ 65 | imageattributes-private.h \ 66 | lineargradientbrush.c \ 67 | lineargradientbrush.h \ 68 | lineargradientbrush-private.h \ 69 | matrix.c \ 70 | matrix.h \ 71 | matrix-private.h \ 72 | metafile.c \ 73 | metafile.h \ 74 | metafile-private.h \ 75 | pathgradientbrush.c \ 76 | pathgradientbrush.h \ 77 | pathgradientbrush-private.h \ 78 | pen.c \ 79 | pen.h \ 80 | pen-private.h \ 81 | print.c \ 82 | region.c \ 83 | region.h \ 84 | region-private.h \ 85 | region-bitmap.c \ 86 | region-bitmap.h \ 87 | region-path-tree.c \ 88 | region-path-tree.h \ 89 | solidbrush.c \ 90 | solidbrush.h \ 91 | solidbrush-private.h \ 92 | stringformat.c \ 93 | stringformat.h \ 94 | stringformat-private.h \ 95 | text.c \ 96 | text.h \ 97 | text-metafile.c \ 98 | text-metafile-private.h \ 99 | texturebrush.c \ 100 | texturebrush.h \ 101 | texturebrush-private.h \ 102 | win32structs.h \ 103 | bmpcodec.h \ 104 | bmpcodec.c \ 105 | emfcodec.c \ 106 | emfcodec.h \ 107 | emfplus.c \ 108 | emfplus.h \ 109 | gifcodec.h \ 110 | gifcodec.c \ 111 | jpegcodec.h \ 112 | jpegcodec.c \ 113 | pngcodec.h \ 114 | pngcodec.c \ 115 | tiffcodec.h \ 116 | tiffcodec.c \ 117 | wmfcodec.c \ 118 | wmfcodec.h 119 | 120 | if USE_PANGO_RENDERING 121 | libgdiplus_la_SOURCES += \ 122 | text-pango.c \ 123 | text-pango-private.h 124 | else 125 | libgdiplus_la_SOURCES += \ 126 | text-cairo.c \ 127 | text-cairo-private.h 128 | endif 129 | 130 | libgdiplus_la_LIBADD = $(GDIPLUS_LIBS) 131 | 132 | AM_CPPFLAGS = $(GDIPLUS_CFLAGS) 133 | 134 | EXTRA_DIST = libgdiplus.vcxproj 135 | -------------------------------------------------------------------------------- /src/adjustablearrowcap-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __ADJUSTABLEARROWCAP_PRIVATE_H__ 36 | #define __ADJUSTABLEARROWCAP_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "customlinecap-private.h" 40 | 41 | typedef struct _AdjustableArrowCap { 42 | CustomLineCap base; 43 | float width; 44 | float height; 45 | float middle_inset; 46 | BOOL fill_state; 47 | } AdjustableArrowCap; 48 | 49 | #include "adjustablearrowcap.h" 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/adjustablearrowcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __ADJUSTABLEARROWCAP_H__ 32 | #define __ADJUSTABLEARROWCAP_H__ 33 | 34 | /* AdjustableArrowCap public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap (REAL height, REAL width, BOOL isFilled, GpAdjustableArrowCap **cap); 37 | 38 | GpStatus WINGDIPAPI GdipGetAdjustableArrowCapHeight (GpAdjustableArrowCap *cap, REAL *height); 39 | GpStatus WINGDIPAPI GdipSetAdjustableArrowCapHeight (GpAdjustableArrowCap *cap, REAL height); 40 | 41 | GpStatus WINGDIPAPI GdipGetAdjustableArrowCapWidth (GpAdjustableArrowCap *cap, REAL *width); 42 | GpStatus WINGDIPAPI GdipSetAdjustableArrowCapWidth (GpAdjustableArrowCap *cap, REAL width); 43 | 44 | GpStatus WINGDIPAPI GdipGetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *cap, REAL *middleInset); 45 | GpStatus WINGDIPAPI GdipSetAdjustableArrowCapMiddleInset (GpAdjustableArrowCap *cap, REAL middleInset); 46 | 47 | GpStatus WINGDIPAPI GdipSetAdjustableArrowCapFillState (GpAdjustableArrowCap *cap, BOOL isFilled); 48 | GpStatus WINGDIPAPI GdipGetAdjustableArrowCapFillState (GpAdjustableArrowCap *cap, BOOL *isFilled); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/bitmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __BITMAP_H__ 32 | #define __BITMAP_H__ 33 | 34 | GpStatus WINGDIPAPI GdipCreateBitmapFromStream (void *stream, GpBitmap **bitmap); 35 | GpStatus WINGDIPAPI GdipCreateBitmapFromFile (GDIPCONST WCHAR* filename, GpBitmap **bitmap); 36 | GpStatus WINGDIPAPI GdipCreateBitmapFromStreamICM (void *stream, GpBitmap **bitmap); 37 | GpStatus WINGDIPAPI GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap); 38 | 39 | GpStatus WINGDIPAPI GdipCreateBitmapFromScan0 (INT width, INT height, INT stride, PixelFormat format, BYTE* scan0, GpBitmap **bitmap); 40 | GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics (INT width, INT height, GpGraphics *target, GpBitmap **bitmap); 41 | 42 | GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP (HBITMAP hbm, HPALETTE hpal, GpBitmap** bitmap); 43 | GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap (GpBitmap* bitmap, HBITMAP *hbmReturn, ARGB background); 44 | 45 | GpStatus WINGDIPAPI GdipCreateBitmapFromHICON (HICON hicon, GpBitmap** bitmap); 46 | GpStatus WINGDIPAPI GdipCreateHICONFromBitmap (GpBitmap* bitmap, HICON *hbmReturn); 47 | 48 | GpStatus WINGDIPAPI GdipCreateBitmapFromResource (HINSTANCE hInstance, GDIPCONST WCHAR *lpBitmapName, GpBitmap** bitmap); 49 | 50 | GpStatus WINGDIPAPI GdipBitmapLockBits (GpBitmap *bitmap, GDIPCONST Rect *rect, UINT flags, PixelFormat format, BitmapData *lockedBitmapData); 51 | GpStatus WINGDIPAPI GdipBitmapUnlockBits (GpBitmap *bitmap, BitmapData *lockedBitmapData); 52 | 53 | GpStatus WINGDIPAPI GdipBitmapSetPixel (GpBitmap *bitmap, INT x, INT y, ARGB color); 54 | GpStatus WINGDIPAPI GdipBitmapGetPixel (GpBitmap *bitmap, INT x, INT y, ARGB *color); 55 | 56 | GpStatus WINGDIPAPI GdipCloneBitmapArea (REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); 57 | GpStatus WINGDIPAPI GdipCloneBitmapAreaI (INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap); 58 | 59 | GpStatus WINGDIPAPI GdipBitmapSetResolution (GpBitmap *bitmap, REAL xdpi, REAL ydpi); 60 | 61 | 62 | /* missing API 63 | GdipCreateBitmapFromDirectDrawSurface 64 | GdipCreateBitmapFromGdiDib 65 | */ 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/bmpcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bmpcodec.h : Contains function declarations for encoding decoding bmp images 3 | * 4 | * Authors: 5 | * Sanjay Gupta (gsanjay@novell.com) 6 | * Mark Steele (ms@rapidsys.com) 7 | * 8 | * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) 9 | */ 10 | 11 | #ifndef _BMPCODEC_H 12 | #define _BMPCODEC_H 13 | 14 | #include "bitmap-private.h" 15 | //#include "codecs-private.h" 16 | #include "dstream.h" 17 | 18 | #define BITMAPINFOHEADER_SIZE 40 19 | #define BITMAPCOREHEADER_SIZE 12 20 | 21 | #ifndef __GNUC__ 22 | #pragma pack(2) 23 | #endif 24 | typedef struct 25 | #ifdef __GNUC__ 26 | __attribute__ ((packed)) 27 | #endif 28 | { 29 | WORD bfType; 30 | DWORD bfSize; 31 | WORD bfReserved1; 32 | WORD bfReserved2; 33 | DWORD bfOffBits; 34 | } BITMAPFILEHEADER, *PBITMAPFILEHEADER, *LPBITMAPFILEHEADER; 35 | #ifndef __GNUC__ 36 | #pragma pack() 37 | #endif 38 | 39 | #define BFT_BITMAP 0x4d42 40 | 41 | typedef struct { 42 | DWORD bV3Size; 43 | LONG bV3Width; 44 | LONG bV3Height; 45 | WORD bV3Planes; 46 | WORD bV3BitCount; 47 | DWORD bV3Compression; 48 | DWORD bV3SizeImage; 49 | LONG bV3XPelsPerMeter; 50 | LONG bV3YPelsPerMeter; 51 | DWORD bV3ClrUsed; 52 | DWORD bV3ClrImportant; 53 | DWORD bV3RedMask; 54 | DWORD bV3GreenMask; 55 | DWORD bV3BlueMask; 56 | DWORD bV3AlphaMask; 57 | } BITMAPV3HEADER, *PBITMAPV3HEADER; 58 | 59 | #include "gdiplus-private.h" 60 | 61 | GpStatus gdip_read_bmp_image (void *pointer, GpImage **image, ImageSource source) GDIP_INTERNAL; 62 | GpStatus gdip_load_bmp_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 63 | GpStatus gdip_load_bmp_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; 64 | 65 | GpStatus gdip_save_bmp_image_to_file (FILE *fp, GpImage *image) GDIP_INTERNAL; 66 | GpStatus gdip_save_bmp_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image) GDIP_INTERNAL; 67 | 68 | ImageCodecInfo *gdip_getcodecinfo_bmp () GDIP_INTERNAL; 69 | 70 | /* Conversion functions */ 71 | ARGB gdip_getpixel_32bppARGB (BYTE *scan, INT x) GDIP_INTERNAL; 72 | void gdip_setpixel_32bppARGB (BYTE *scan, INT x, BYTE a, BYTE r, BYTE g, BYTE b) GDIP_INTERNAL; 73 | 74 | ARGB gdip_getpixel_16bppRGB555 (BYTE *scan, INT x) GDIP_INTERNAL; 75 | 76 | ARGB gdip_getpixel_16bppRGB565 (BYTE *scan, INT x) GDIP_INTERNAL; 77 | 78 | /* helper functions / shared with ICOn codec */ 79 | GpStatus gdip_read_BITMAPINFOHEADER (void *pointer, ImageSource source, BITMAPV5HEADER *bmi, 80 | BOOL *upsidedown) GDIP_INTERNAL; 81 | int gdip_read_bmp_data (void *pointer, BYTE *data, int size, ImageSource source) GDIP_INTERNAL; 82 | 83 | #endif /* _BMPCODEC_H */ 84 | -------------------------------------------------------------------------------- /src/brush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __BRUSH_PRIVATE_H__ 36 | #define __BRUSH_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | typedef struct { 41 | float *factors; 42 | float *positions; 43 | int count; 44 | } Blend; 45 | 46 | typedef struct _BrushClass { 47 | /* Brush virtual functions */ 48 | GpBrushType type; 49 | GpStatus (*setup) (GpGraphics *graphics, GpBrush *brush); 50 | GpStatus (*clone_brush) (GpBrush *brush, GpBrush **clonedBrush); 51 | GpStatus (*destroy) (GpBrush *brush); 52 | } BrushClass; 53 | 54 | typedef struct _Brush { 55 | BrushClass *vtable; 56 | BOOL changed; 57 | } Brush; 58 | 59 | void gdip_brush_init (GpBrush *brush, BrushClass* vtable) GDIP_INTERNAL; 60 | GpStatus gdip_brush_setup (GpGraphics *graphics, GpBrush *brush) GDIP_INTERNAL; 61 | 62 | #include "brush.h" 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/brush.c: -------------------------------------------------------------------------------- 1 | /* 2 | * brush.c 3 | * 4 | * Copyright (c) 2003 Alexandre Pigolkine 5 | * Copyright (C) 2007 Novell, Inc. http://www.novell.com 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 8 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 9 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 17 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * Authors: 23 | * Alexandre Pigolkine(pigolkine@gmx.de) 24 | * Ravindra (rkumar@novell.com) 25 | */ 26 | 27 | #include "brush-private.h" 28 | #include "graphics-private.h" 29 | 30 | void 31 | gdip_brush_init (GpBrush *brush, BrushClass* vtable) 32 | { 33 | brush->vtable = vtable; 34 | 35 | /* Set the changed state to true, so that we don't miss the 36 | * first setup of the brush. 37 | */ 38 | brush->changed = TRUE; 39 | } 40 | 41 | GpStatus 42 | gdip_brush_setup (GpGraphics *graphics, GpBrush *brush) 43 | { 44 | /* Don't need to setup, if brush is the same as the cached brush and 45 | * it is not changed. Just comparing pointers may not be sufficient 46 | * to say that the brushes are same. It is possible to have different 47 | * brush on the same memory, but probability is very low. We would 48 | * need a function to check the equality of the brushes in that case. 49 | */ 50 | if (brush == graphics->last_brush && !brush->changed) 51 | return Ok; 52 | else { 53 | GpStatus status = brush->vtable->setup (graphics, brush); 54 | if (status == Ok) { 55 | brush->changed = FALSE; 56 | graphics->last_brush = brush; 57 | } 58 | 59 | return status; 60 | } 61 | } 62 | 63 | /* coverity[+alloc : arg-*1] */ 64 | GpStatus WINGDIPAPI 65 | GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush) 66 | { 67 | if (!brush || !clonedBrush) 68 | return InvalidParameter; 69 | 70 | return brush->vtable->clone_brush (brush, clonedBrush); 71 | } 72 | 73 | GpStatus WINGDIPAPI 74 | GdipDeleteBrush (GpBrush *brush) 75 | { 76 | GpStatus status; 77 | 78 | if (!brush) 79 | return InvalidParameter; 80 | 81 | status = brush->vtable->destroy (brush); 82 | GdipFree (brush); 83 | 84 | return status; 85 | } 86 | 87 | GpStatus WINGDIPAPI 88 | GdipGetBrushType (GpBrush *brush, GpBrushType *type) 89 | { 90 | if (!brush || !type) 91 | return InvalidParameter; 92 | 93 | *type = brush->vtable->type; 94 | return Ok; 95 | } 96 | -------------------------------------------------------------------------------- /src/brush.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Ravindra (rkumar@novell.com) 19 | * 20 | * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) 21 | */ 22 | 23 | #ifndef __BRUSH_H__ 24 | #define __BRUSH_H__ 25 | 26 | typedef struct _InterpolationColors { 27 | ARGB* colors; 28 | float *positions; 29 | int count; 30 | } InterpolationColors; 31 | 32 | GpStatus WINGDIPAPI GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush); 33 | GpStatus WINGDIPAPI GdipDeleteBrush (GpBrush *brush); 34 | GpStatus WINGDIPAPI GdipGetBrushType (GpBrush *brush, GpBrushType *type); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/carbon-private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * carbon-private.c 3 | * 4 | * Copyright (C) 2008 Novell, Inc (http://www.novell.com) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 7 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 8 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all copies or substantial 13 | * portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 16 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | * 21 | * Authors: 22 | * Geoff Norton 23 | */ 24 | 25 | #ifdef __APPLE__ 26 | #include 27 | 28 | void gdip_get_display_dpi_carbon (float *h_dpi, float *v_dpi) { 29 | *h_dpi = *v_dpi = 96.0f; 30 | 31 | if (getenv ("MONO_MWF_MAC_DETECT_DPI") != NULL) { 32 | CGSize size = CGDisplayScreenSize(kCGDirectMainDisplay); 33 | 34 | if (!CGSizeEqualToSize(size, CGSizeZero)) { 35 | const float mmpi = 25.4; 36 | float h_size_inch = size.width / mmpi; 37 | float v_size_inch = size.height / mmpi; 38 | *h_dpi = CGDisplayPixelsWide (kCGDirectMainDisplay) / h_size_inch; 39 | *v_dpi = CGDisplayPixelsHigh (kCGDirectMainDisplay) / v_size_inch; 40 | } 41 | } 42 | } 43 | #else 44 | #include 45 | 46 | void gdip_get_display_dpi_carbon (float *h_dpi, float *v_dpi) { 47 | g_assert_not_reached (); 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /src/carbon-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Geoff Norton (gnorton@novell.com) 19 | * 20 | * Copyright (C) 2008 Novell, Inc (http://www.novell.com) 21 | */ 22 | 23 | #ifndef __CARBON_PRIVATE_H__ 24 | #define __CARBON_PRIVATE_H__ 25 | 26 | void gdip_get_display_dpi_carbon (float *h_dpi, float *v_dpi); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/codecs-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __CODECS_PRIVATE_H__ 32 | #define __CODECS_PRIVATE_H__ 33 | 34 | #include "gdiplus-private.h" 35 | #include "codecs.h" 36 | 37 | /* Maximum CODEC signature length, which is the minimum size we need to read from an image file to detect it's type */ 38 | #define MAX_CODEC_SIG_LENGTH 44 39 | 40 | typedef enum { 41 | File, 42 | DStream, 43 | Memory 44 | } ImageSource; 45 | 46 | typedef struct { 47 | BYTE* ptr; 48 | int size; 49 | int pos; 50 | } MemorySource; 51 | 52 | 53 | static const CLSID gdip_image_frameDimension_page_guid = {0x7462dc86U, 0x6180U, 0x4c7eU, {0x8e, 0x3f, 0xee, 0x73, 0x33, 0xa7, 0xa4, 0x83}}; 54 | static const CLSID gdip_image_frameDimension_time_guid = {0x6aedbd6dU, 0x3fb5U, 0x418aU, {0x83, 0xa6, 0x7f, 0x45, 0x22, 0x9d, 0xc8, 0x72}}; 55 | static const CLSID gdip_image_frameDimension_resolution_guid = {0x84236f7bU, 0x3bd3U, 0x428fU, {0x8d, 0xab, 0x4e, 0xa1, 0x43, 0x9c, 0xa3, 0x15}}; 56 | 57 | const EncoderParameter *gdip_find_encoder_parameter (GDIPCONST EncoderParameters *eps, const GUID *guid) GDIP_INTERNAL; 58 | 59 | GpStatus initCodecList (void) GDIP_INTERNAL; 60 | void releaseCodecList (void) GDIP_INTERNAL; 61 | 62 | extern GUID GdipEncoderCompression; 63 | extern GUID GdipEncoderColorDepth; 64 | extern GUID GdipEncoderSaveFlag; 65 | extern GUID GdipEncoderSaveAsCMYK; 66 | extern GUID GdipEncoderImageItems; 67 | extern GUID GdipEncoderTransformation; 68 | extern GUID GdipEncoderQuality; 69 | extern GUID GdipEncoderLuminanceTable; 70 | extern GUID GdipEncoderChrominanceTable; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/codecs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * codecs.h 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Alexandre Pigolkine (pigolkine@gmx.de) 21 | * Duncan Mak (duncan@ximian.com) 22 | * Miguel de Icaza (miguel@ximian.com) 23 | * Ravindra (rkumar@novell.com) 24 | * Sanjay Gupta (gsanjay@novell.com) 25 | * Vladimir Vukicevic (vladimir@pobox.com) 26 | * Geoff Norton (gnorton@customerdna.com) 27 | * Jonathan Gilbert (logic@deltaq.org) 28 | * Sebastien Pouliot 29 | * 30 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 31 | */ 32 | 33 | #ifndef __CODECS_H__ 34 | #define __CODECS_H__ 35 | 36 | GpStatus WINGDIPAPI GdipGetImageDecodersSize (UINT *numDecoders, UINT *size); 37 | GpStatus WINGDIPAPI GdipGetImageDecoders (UINT numDecoders, UINT size, ImageCodecInfo *decoders); 38 | GpStatus WINGDIPAPI GdipGetImageEncodersSize (UINT *numEncoders, UINT *size); 39 | GpStatus WINGDIPAPI GdipGetImageEncoders (UINT numEncoders, UINT size, ImageCodecInfo *encoders); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/customlinecap-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __CUSTOMLINECAP_PRIVATE_H__ 36 | #define __CUSTOMLINECAP_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | typedef struct _CapClass { 41 | CustomLineCapType type; 42 | GpStatus (*setup) (GpGraphics *graphics, GpCustomLineCap *cap); 43 | GpStatus (*clone_cap) (GpCustomLineCap *cap, GpCustomLineCap **clonedCap); 44 | GpStatus (*destroy) (GpCustomLineCap *cap); 45 | GpStatus (*draw) (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *cap, float x, float y, float otherend_x, float otherend_y); 46 | } CapClass; 47 | 48 | typedef struct _CustomLineCap { 49 | CapClass *vtable; 50 | GpPath *fill_path; 51 | GpPath *stroke_path; 52 | GpLineCap base_cap; 53 | GpLineCap start_cap; 54 | GpLineCap end_cap; 55 | GpLineJoin stroke_join; 56 | float base_inset; 57 | float width_scale; 58 | } CustomLineCap; 59 | 60 | void gdip_custom_linecap_init (GpCustomLineCap *cap, CapClass *vt) GDIP_INTERNAL; 61 | GpStatus gdip_linecap_setup (GpGraphics *graphics, GpCustomLineCap *customCap) GDIP_INTERNAL; 62 | GpStatus gdip_linecap_draw (GpGraphics *graphics, GpPen *pen, GpCustomLineCap *customCap, float x, float y, float otherend_x, float otherend_y) GDIP_INTERNAL; 63 | double gdip_custom_linecap_angle (float x, float y, float otherend_x, float otherend_y); 64 | 65 | #include "customlinecap.h" 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/customlinecap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * customlinecap.h 3 | * 4 | * Authors: 5 | * Ravindra (rkumar@novell.com) 6 | * 7 | * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) 8 | */ 9 | 10 | #ifndef __CUSTOMLINECAP_H__ 11 | #define __CUSTOMLINECAP_H__ 12 | 13 | /* CustomLineCap functions */ 14 | GpStatus WINGDIPAPI GdipCreateCustomLineCap (GpPath *fillPath, GpPath *strokePath, GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap); 15 | GpStatus WINGDIPAPI GdipDeleteCustomLineCap (GpCustomLineCap *customCap); 16 | GpStatus WINGDIPAPI GdipCloneCustomLineCap (GpCustomLineCap *customCap, GpCustomLineCap **clonedCap); 17 | GpStatus WINGDIPAPI GdipGetCustomLineCapType (GpCustomLineCap *customCap, CustomLineCapType *capType); 18 | GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap startCap, GpLineCap endCap); 19 | GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeCaps (GpCustomLineCap *customCap, GpLineCap *startCap, GpLineCap *endCap); 20 | GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin lineJoin); 21 | GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin (GpCustomLineCap *customCap, GpLineJoin *lineJoin); 22 | GpStatus WINGDIPAPI GdipSetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap baseCap); 23 | GpStatus WINGDIPAPI GdipGetCustomLineCapBaseCap (GpCustomLineCap *customCap, GpLineCap *baseCap); 24 | GpStatus WINGDIPAPI GdipSetCustomLineCapBaseInset (GpCustomLineCap *customCap, REAL inset); 25 | GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset (GpCustomLineCap *customCap, REAL *inset); 26 | GpStatus WINGDIPAPI GdipSetCustomLineCapWidthScale (GpCustomLineCap *customCap, REAL widthScale); 27 | GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale (GpCustomLineCap *customCap, REAL *widthScale); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/dstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | */ 20 | 21 | #ifndef __DSTREAM_H 22 | #define __DSTREAM_H 23 | 24 | #include "win32structs.h" 25 | #include "image.h" 26 | 27 | typedef struct _dstream_pvt dstream_private; 28 | typedef struct _dstream dstream_t; 29 | struct _dstream { 30 | dstream_private *pvt; 31 | }; 32 | 33 | dstream_t *dstream_input_new (GetBytesDelegate read, SeekDelegate seek) GDIP_INTERNAL; 34 | int dstream_read (dstream_t *loader, BYTE *buffer, int size, char peek) GDIP_INTERNAL; 35 | void dstream_skip (dstream_t *loader, int nbytes) GDIP_INTERNAL; 36 | void dstream_free (dstream_t *loader) GDIP_INTERNAL; 37 | void dstream_keep_exif_buffer (dstream_t *loader) GDIP_INTERNAL; 38 | void dstream_get_exif_buffer (dstream_t *loader, unsigned char **ptr, unsigned int *length) GDIP_INTERNAL; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/emfcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __EMFCODEC_H__ 24 | #define __EMFCODEC_H__ 25 | 26 | #include "gdiplus-private.h" 27 | #include "metafile-private.h" 28 | #include "graphics-private.h" 29 | 30 | /* 31 | * Some interesting links... 32 | * http://wvware.sourceforge.net/caolan/ora-wmf.html 33 | * http://www.undocprint.org/formats/winspool/emf 34 | */ 35 | 36 | #define EMF_MIN_RECORD_SIZE 8 37 | 38 | #define EMF_CHECK_PARAMS(x) do { \ 39 | if (params < (x)) goto cleanup; \ 40 | } while (0) 41 | 42 | #define EMF_FUNCTION 0 43 | #define EMF_RECORDSIZE 4 44 | #define DWP1 8 45 | #define DWP2 12 46 | #define DWP3 16 47 | #define DWP4 20 48 | #define DWP5 24 49 | #define DWP6 28 50 | #define DWP7 32 51 | #define DWP8 36 52 | #define DWP9 40 53 | #define DWP10 44 54 | #define DWP11 48 55 | #define DWP(y) (8 + ((y) << 2)) 56 | 57 | 58 | #define gdip_read_emf_data gdip_read_bmp_data 59 | 60 | GpStatus gdip_load_emf_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 61 | 62 | GpStatus gdip_load_emf_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; 63 | 64 | /* no save functions as the EMF "codec" is a decoder only */ 65 | 66 | ImageCodecInfo* gdip_getcodecinfo_emf () GDIP_INTERNAL; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/emfplus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __EMFPLUS_H__ 24 | #define __EMFPLUS_H__ 25 | 26 | #include "gdiplus-private.h" 27 | #include "metafile-private.h" 28 | #include "emfcodec.h" 29 | #include "graphics.h" 30 | #include "solidbrush-private.h" 31 | 32 | /* 33 | * Some interesting links... 34 | * [EMF+ Metafile Record Format Documentation] http://www.aces.uiuc.edu/~jhtodd/Metafile/ 35 | */ 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/font-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __FONT_PRIVATE_H__ 36 | #define __FONT_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | #ifdef USE_PANGO_RENDERING 41 | #include 42 | #include 43 | #include 44 | #endif 45 | 46 | struct _Font { 47 | float sizeInPixels; 48 | FontStyle style; 49 | unsigned char* face; 50 | GpFontFamily *family; 51 | float emSize; 52 | GpUnit unit; 53 | #ifdef USE_PANGO_RENDERING 54 | PangoFontDescription *pango; 55 | #else 56 | cairo_font_face_t *cairofnt; 57 | #endif 58 | }; 59 | 60 | GpStatus gdip_create_font_without_validation (GDIPCONST GpFontFamily *family, REAL emSize, INT style, Unit unit, GpFont **font); 61 | void gdip_font_clear_pattern_cache (void) GDIP_INTERNAL; 62 | void gdip_delete_system_fonts (void) GDIP_INTERNAL; 63 | 64 | #ifdef USE_PANGO_RENDERING 65 | 66 | PangoFontDescription* gdip_get_pango_font_description (GpFont *font); 67 | 68 | #else 69 | 70 | cairo_font_face_t* gdip_get_cairo_font_face (GpFont *font); 71 | 72 | #endif 73 | 74 | #include "font.h" 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/font.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __FONT_H__ 32 | #define __FONT_H__ 33 | 34 | /* Font public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipCreateFont (GDIPCONST GpFontFamily *family, REAL emSize, INT style, Unit unit, GpFont **font); 37 | GpStatus WINGDIPAPI GdipCreateFontFromDC (HDC hdc, GpFont **font); 38 | 39 | GpStatus WINGDIPAPI GdipCreateFontFromLogfontA (HDC hdc, GDIPCONST LOGFONTA *logfont, GpFont **font); 40 | GpStatus WINGDIPAPI GdipCreateFontFromLogfontW (HDC hdc, GDIPCONST LOGFONTW *logfont, GpFont **font); 41 | 42 | GpStatus WINGDIPAPI GdipCloneFont (GpFont *font, GpFont **cloneFont); 43 | 44 | GpStatus WINGDIPAPI GdipDeleteFont (GpFont *font); 45 | GpStatus WINGDIPAPI GdipGetLogFontA (GpFont *font, GpGraphics *graphics, LOGFONTA *logfontA); 46 | GpStatus WINGDIPAPI GdipGetLogFontW (GpFont *font, GpGraphics *graphics, LOGFONTW *logfontW); 47 | GpStatus WINGDIPAPI GdipGetFontHeight (GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height); 48 | GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI (GDIPCONST GpFont *font, REAL dpi, REAL *height); 49 | GpStatus WINGDIPAPI GdipGetFontSize (GpFont *font, REAL *size); 50 | GpStatus WINGDIPAPI GdipGetFontStyle (GpFont *font, INT *style); 51 | GpStatus WINGDIPAPI GdipGetFontUnit (GpFont *font, Unit *unit); 52 | GpStatus WINGDIPAPI GdipGetFamily (GpFont *font, GpFontFamily **family); 53 | 54 | /* libgdiplus extra API (not availble in MSGDI+ but exported from libgdiplus) */ 55 | GpStatus WINGDIPAPI GdipCreateFontFromHfontA (HFONT hfont, GpFont **font, void *lf); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/fontcollection-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __FONTCOLLECTION_PRIVATE_H__ 36 | #define __FONTCOLLECTION_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | struct _FontCollection { 41 | FcFontSet* fontset; 42 | FcConfig* config; /* Only for private collections */ 43 | #ifdef USE_PANGO_RENDERING 44 | PangoFontMap* pango_font_map; 45 | #endif 46 | }; 47 | 48 | #include "fontcollection.h" 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/fontcollection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __FONTCOLLECTION_H__ 32 | #define __FONTCOLLECTION_H__ 33 | 34 | /* FontCollection public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipDeletePrivateFontCollection (GpFontCollection **fontCollection); 37 | GpStatus WINGDIPAPI GdipGetFontCollectionFamilyCount (GpFontCollection *fontCollection, INT *numFound); 38 | GpStatus WINGDIPAPI GdipGetFontCollectionFamilyList (GpFontCollection *fontCollection, INT numSought, GpFontFamily *gpfamilies[], INT *numFound); 39 | GpStatus WINGDIPAPI GdipNewInstalledFontCollection (GpFontCollection **fontCollection); 40 | GpStatus WINGDIPAPI GdipNewPrivateFontCollection (GpFontCollection **fontCollection); 41 | GpStatus WINGDIPAPI GdipPrivateAddFontFile (GpFontCollection *fontCollection, GDIPCONST WCHAR *filename); 42 | GpStatus WINGDIPAPI GdipPrivateAddMemoryFont (GpFontCollection *fontCollection, GDIPCONST void *memory, INT length); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/fontfamily-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __FONTFAMILY_PRIVATE_H__ 36 | #define __FONTFAMILY_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | struct _FontFamily { 41 | struct _FontCollection *collection; 42 | FcPattern* pattern; 43 | BOOL allocated; 44 | short height; 45 | short linespacing; 46 | short celldescent; 47 | short cellascent; 48 | }; 49 | 50 | #include "fontfamily.h" 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/fontfamily.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __FONTFAMILY_H__ 32 | #define __FONTFAMILY_H__ 33 | 34 | /* FontFamily public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipCreateFontFamilyFromName (GDIPCONST WCHAR *name, GpFontCollection *fontCollection, GpFontFamily **fontFamily); 37 | GpStatus WINGDIPAPI GdipCloneFontFamily (GpFontFamily *fontFamily, GpFontFamily **clonedFontFamily); 38 | GpStatus WINGDIPAPI GdipDeleteFontFamily (GpFontFamily *fontFamily); 39 | GpStatus WINGDIPAPI GdipGetCellAscent (GDIPCONST GpFontFamily *family, INT style, UINT16 *CellAscent); 40 | GpStatus WINGDIPAPI GdipGetCellDescent (GDIPCONST GpFontFamily *family, INT style, UINT16 *CellDescent); 41 | GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif (GpFontFamily **nativeFamily); 42 | GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif (GpFontFamily **nativeFamily); 43 | GpStatus WINGDIPAPI GdipGetGenericFontFamilyMonospace (GpFontFamily **nativeFamily); 44 | GpStatus WINGDIPAPI GdipGetEmHeight (GDIPCONST GpFontFamily *family, INT style, UINT16 *EmHeight); 45 | GpStatus WINGDIPAPI GdipGetFamilyName (GDIPCONST GpFontFamily *family, WCHAR name[LF_FACESIZE], LANGID language); 46 | GpStatus WINGDIPAPI GdipGetLineSpacing (GDIPCONST GpFontFamily *family, INT style, UINT16 *LineSpacing); 47 | GpStatus WINGDIPAPI GdipIsStyleAvailable (GDIPCONST GpFontFamily *family, INT style, BOOL *IsStyleAvailable); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/gdi32.c: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Francis Fisher (frankie@terrorise.me.uk) 3 | // 4 | // (C) Francis Fisher 2013 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | 26 | #include "graphics-private.h" 27 | #include "graphics-cairo-private.h" 28 | 29 | #include 30 | 31 | #define NO_CAIRO_AA 32 | 33 | #define MAX_GRAPHICS_STATE_STACK 512 34 | 35 | #define SRCCOPY (DWORD)0x00CC0020 36 | 37 | BOOL 38 | BitBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop) 39 | { 40 | if (dwRop != SRCCOPY) 41 | return FALSE; 42 | GpGraphics *src = (GpGraphics *) hdcSrc; 43 | GpGraphics *dest = (GpGraphics *) hdcDest; 44 | 45 | cairo_t *cr = dest->ct; 46 | cairo_surface_t *src_surface = cairo_get_target(src->ct); 47 | 48 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); 49 | cairo_set_source_surface (cr, src_surface, nXDest - nXSrc, nYDest - nYSrc); 50 | cairo_rectangle (cr, nXDest, nYDest, nWidth, nHeight); 51 | cairo_fill (cr); 52 | 53 | return TRUE; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/gdi32.h: -------------------------------------------------------------------------------- 1 | // Authors: 2 | // Francis Fisher (frankie@terrorise.me.uk) 3 | // 4 | // (C) Francis Fisher 2013 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | 26 | #include "graphics-private.h" 27 | 28 | #ifndef __GDI32_H__ 29 | #define __GDI32_H__ 30 | 31 | BitBlt (HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/gdip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdip.h - THIS FILE IS DEPRECATED - please use the new GdiPlusFlat.h header file 3 | * 4 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 7 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 8 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all copies or substantial 13 | * portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 16 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | * 21 | * Authors: 22 | * Sebastien Pouliot 23 | */ 24 | 25 | #warning The file gdip.h will eventually disappear, please directly include GdiPlusFlat.h instead 26 | #include "GdiPlusFlat.h" 27 | -------------------------------------------------------------------------------- /src/gdiplus-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | /* 24 | * NOTE: This is a private header files and everything is subject to changes. 25 | */ 26 | 27 | #ifndef __LIBGDIPLUS_H__ 28 | #define __LIBGDIPLUS_H__ 29 | 30 | #include 31 | 32 | #ifdef _MSC_VER 33 | #define _USE_MATH_DEFINES 34 | #endif 35 | #include 36 | #include 37 | #include 38 | #include FT_TRUETYPE_TABLES_H 39 | #ifndef _MSC_VER 40 | #include 41 | #include 42 | 43 | #endif 44 | 45 | #include "config.h" 46 | 47 | #if HAVE_VISIBILITY_HIDDEN 48 | #define GDIP_INTERNAL __attribute__((visibility ("hidden"))) 49 | #else 50 | #define GDIP_INTERNAL 51 | #endif 52 | 53 | #ifdef _MSC_VER 54 | #define WINGDIPAPI __declspec( dllexport ) 55 | #else 56 | #define WINGDIPAPI 57 | #endif 58 | 59 | #include 60 | #ifdef CAIRO_HAS_FT_FONT 61 | #include 62 | #endif 63 | 64 | #if defined(HAVE_X11) 65 | #ifdef CAIRO_HAS_XLIB_SURFACE 66 | #include 67 | #endif 68 | #endif 69 | 70 | #if defined(HAVE_X11) 71 | #include 72 | #endif 73 | 74 | #include "win32structs.h" 75 | #include "gdipenums.h" 76 | #include "gdipluspixelformats.h" 77 | #include "gdiplusimaging.h" 78 | #include "gdipstructs.h" 79 | #include "general-private.h" 80 | 81 | typedef struct _AdjustableArrowCap GpAdjustableArrowCap; 82 | typedef struct _Brush GpBrush; 83 | typedef struct _CustomLineCap GpCustomLineCap; 84 | typedef struct _Font GpFont; 85 | typedef struct _FontCollection GpFontCollection; 86 | typedef struct _FontFamily GpFontFamily; 87 | typedef struct _Graphics GpGraphics; 88 | typedef struct _Hatch GpHatch; 89 | typedef struct _Image GpImage; 90 | typedef struct _ImageAttributes GpImageAttributes; 91 | typedef struct _LineGradient GpLineGradient; 92 | typedef struct _Metafile GpMetafile; 93 | typedef struct _Path GpPath; 94 | typedef struct _PathIterator GpPathIterator; 95 | typedef struct _PathGradient GpPathGradient; 96 | typedef struct _Pen GpPen; 97 | typedef struct _Region GpRegion; 98 | typedef struct _SolidFill GpSolidFill; 99 | typedef struct _StringFormat GpStringFormat; 100 | typedef struct _Texture GpTexture; 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /src/gdipstructs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __GDIPSTRUCTS_H__ 32 | #define __GDIPSTRUCTS_H__ 33 | 34 | #include "win32structs.h" 35 | 36 | #define GDIPCONST const 37 | 38 | /* public structures defined by GDI+ (i.e. you can safely access their members) */ 39 | 40 | typedef struct { 41 | int First; 42 | int Length; 43 | } CharacterRange; 44 | 45 | typedef struct { 46 | ARGB Argb; 47 | } Color; 48 | 49 | typedef struct { 50 | Color oldColor; 51 | Color newColor; 52 | } ColorMap; 53 | 54 | typedef struct { 55 | float m[5][5]; 56 | } ColorMatrix; 57 | 58 | typedef struct { 59 | int X, Y; 60 | } Point, GpPoint; 61 | 62 | typedef struct { 63 | float X, Y; 64 | } PointF, GpPointF; 65 | 66 | typedef struct { 67 | int Count; 68 | PointF *Points; 69 | BYTE *Types; 70 | } PathData, GpPathData; 71 | 72 | typedef struct { 73 | int X, Y, Width, Height; 74 | } Rect, GpRect; 75 | 76 | typedef struct { 77 | float X, Y, Width, Height; 78 | } RectF, GpRectF; 79 | 80 | /* Callbacks */ 81 | typedef BOOL (*ImageAbort) (void *); 82 | typedef ImageAbort DrawImageAbort; 83 | typedef ImageAbort GetThumbnailImageAbort; 84 | 85 | typedef BOOL (*EnumerateMetafileProc) (EmfPlusRecordType, UINT, UINT, const BYTE*, VOID*); 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/general.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __GENERAL_H__ 24 | #define __GENERAL_H__ 25 | 26 | #include "win32structs.h" 27 | 28 | /* Startup / shutdown */ 29 | typedef struct { 30 | UINT32 GdiplusVersion; /* must be 1 or 2 */ 31 | void* DebugEventCallback; /* ignored in libgdiplus */ 32 | BOOL SuppressBackgroundThread; /* ignored in libgdiplus */ 33 | BOOL SuppressExternalCodecs; /* ignored in libgdiplus */ 34 | } GdiplusStartupInput; 35 | 36 | typedef struct { 37 | void* NotificationHook; /* ignored in libgdiplus */ 38 | void* NotificationUnhook; /* ignored in libgdiplus */ 39 | } GdiplusStartupOutput; 40 | 41 | GpStatus WINGDIPAPI GdiplusStartup (ULONG_PTR *token, const GdiplusStartupInput *input, GdiplusStartupOutput *output); 42 | void WINGDIPAPI GdiplusShutdown (ULONG_PTR token); 43 | 44 | /* Memory / public API */ 45 | WINGDIPAPI void* GdipAlloc (size_t size); 46 | WINGDIPAPI void GdipFree (void *ptr); 47 | 48 | /* Notification API */ 49 | GpStatus WINGDIPAPI GdiplusNotificationHook (ULONG_PTR *token); 50 | void WINGDIPAPI GdiplusNotificationUnhook (ULONG_PTR token); 51 | 52 | /* libgdiplus-specific API, useful for quirking buggy behavior in older versions */ 53 | WINGDIPAPI char* GetLibgdiplusVersion (); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/gifcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gifcodec.h : Contains function declarations for encoding decoding gif images 3 | * 4 | * Authors: 5 | * Sanjay Gupta (gsanjay@novell.com) 6 | * Vladimir Vukicevic (vladimir@pobox.com) 7 | * 8 | * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) 9 | */ 10 | 11 | #ifndef _GIFCODEC_H 12 | #define _GIFCODEC_H 13 | 14 | #include "bitmap-private.h" 15 | #include "bmpcodec.h" 16 | 17 | GpStatus gdip_load_gif_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 18 | 19 | GpStatus gdip_load_gif_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seekFunc, 20 | GpImage **image) GDIP_INTERNAL; 21 | 22 | GpStatus gdip_save_gif_image_to_file (unsigned char *filename, GpImage *image) GDIP_INTERNAL; 23 | 24 | GpStatus gdip_save_gif_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, 25 | GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 26 | 27 | ImageCodecInfo *gdip_getcodecinfo_gif () GDIP_INTERNAL; 28 | 29 | GpStatus gdip_fill_encoder_parameter_list_gif (EncoderParameters *buffer, UINT size) GDIP_INTERNAL; 30 | 31 | typedef struct 32 | { 33 | UINT count; 34 | EncoderParameter imageItems; 35 | EncoderParameter saveFlag; 36 | LONG saveFlagValue; 37 | } GifEncoderParameters; 38 | 39 | #endif /* _GIFCODEC_H */ 40 | -------------------------------------------------------------------------------- /src/graphics-cairo-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __GRAPHICS_CAIRO_PRIVATE_H__ 24 | #define __GRAPHICS_CAIRO_PRIVATE_H__ 25 | 26 | #include "gdiplus-private.h" 27 | #include "brush-private.h" 28 | #include "matrix-private.h" 29 | 30 | /* constant for make_ellipse */ 31 | #define C1 0.552285 32 | 33 | /* 34 | * Handling of pens with a width greater than 1 is not identical between GDI+ and Cairo 35 | * 36 | * On cairo >= 1.12 pen adjustment is not required or tons of tests senstive to this break. 37 | */ 38 | #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) 39 | #define gdip_cairo_pen_width_needs_adjustment(pen) (0) 40 | #else 41 | #define gdip_cairo_pen_width_needs_adjustment(pen) (((int)(pen->width) & 1) == 0) 42 | #endif 43 | 44 | cairo_fill_rule_t gdip_convert_fill_mode (FillMode fill_mode) GDIP_INTERNAL; 45 | GpStatus gdip_plot_path (GpGraphics *graphics, GpPath *path, BOOL antialiasing) GDIP_INTERNAL; 46 | 47 | 48 | GpStatus cairo_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, 49 | float sweepAngle) GDIP_INTERNAL; 50 | 51 | GpStatus cairo_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; 52 | 53 | GpStatus cairo_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count, 54 | float tension) GDIP_INTERNAL; 55 | GpStatus cairo_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, 56 | float tension, GpFillMode fillMode) GDIP_INTERNAL; 57 | GpStatus cairo_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset, 58 | int numOfSegments, float tension) GDIP_INTERNAL; 59 | 60 | GpStatus cairo_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL; 61 | GpStatus cairo_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL; 62 | 63 | GpStatus cairo_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; 64 | 65 | GpStatus cairo_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; 66 | GpStatus cairo_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL; 67 | 68 | GpStatus cairo_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) GDIP_INTERNAL; 69 | GpStatus cairo_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) GDIP_INTERNAL; 70 | 71 | GpStatus cairo_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, 72 | float startAngle, float sweepAngle) GDIP_INTERNAL; 73 | GpStatus cairo_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height, 74 | float startAngle, float sweepAngle) GDIP_INTERNAL; 75 | 76 | GpStatus cairo_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL; 77 | GpStatus cairo_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count, 78 | FillMode fillMode) GDIP_INTERNAL; 79 | 80 | GpStatus cairo_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) GDIP_INTERNAL; 81 | 82 | GpStatus cairo_GraphicsClear (GpGraphics *graphics, ARGB color) GDIP_INTERNAL; 83 | GpStatus cairo_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) GDIP_INTERNAL; 84 | GpStatus cairo_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) GDIP_INTERNAL; 85 | 86 | GpStatus cairo_SetGraphicsClip (GpGraphics *graphics) GDIP_INTERNAL; 87 | GpStatus cairo_ResetClip (GpGraphics *graphics) GDIP_INTERNAL; 88 | 89 | GpStatus cairo_ResetWorldTransform (GpGraphics *graphics) GDIP_INTERNAL; 90 | GpStatus cairo_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) GDIP_INTERNAL; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/graphics-path-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __GRAPHICS_PATH_PRIVATE_H__ 36 | #define __GRAPHICS_PATH_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "graphics-private.h" 40 | #include "stringformat-private.h" 41 | 42 | typedef struct _Path { 43 | FillMode fill_mode; 44 | int count; 45 | int size; 46 | BYTE *types; 47 | GpPointF *points; 48 | BOOL start_new_fig; /* Flag to keep track if we need to start a new figure */ 49 | } Path; 50 | 51 | BOOL gdip_path_has_curve (GpPath *path) GDIP_INTERNAL; 52 | BOOL gdip_path_ensure_size (GpPath *path, int size) GDIP_INTERNAL; 53 | BOOL gdip_path_closed (GpPath *path) GDIP_INTERNAL; 54 | 55 | #include "graphics-path.h" 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/graphics-pathiterator-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __GRAPHICS_PATHITERATOR_PRIVATE__ 36 | #define __GRAPHICS_PATHITERATOR_PRIVATE__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | struct _PathIterator { 41 | GpPath *path; 42 | int markerPosition; /* The start position of next marker, index of (marker type) + 1 */ 43 | int subpathPosition; /* The start position of next subpath, index of (start type) */ 44 | int pathTypePosition; /* The position to get the next path type inside a subpath */ 45 | }; 46 | 47 | #include "graphics-pathiterator.h" 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/graphics-pathiterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Duncan Mak (duncan@ximian.com) 19 | * Ravindra (rkumar@novell.com) 20 | * Sebastien Pouliot 21 | * 22 | * Copyright (C) 2003, 2006-2007 Novell, Inc (http://www.novell.com) 23 | */ 24 | 25 | #ifndef __GRAPHICS_PATHITERATOR_H__ 26 | #define __GRAPHICS_PATHITERATOR_H__ 27 | 28 | GpStatus WINGDIPAPI GdipCreatePathIter (GpPathIterator **iterator, GpPath *path); 29 | GpStatus WINGDIPAPI GdipDeletePathIter (GpPathIterator *iterator); 30 | 31 | GpStatus WINGDIPAPI GdipPathIterGetCount (GpPathIterator *iterator, INT *count); 32 | GpStatus WINGDIPAPI GdipPathIterGetSubpathCount (GpPathIterator *iterator, INT *count); 33 | GpStatus WINGDIPAPI GdipPathIterCopyData (GpPathIterator *iterator, INT *resultCount, GpPointF *points, BYTE *types, INT startIndex, INT endIndex); 34 | GpStatus WINGDIPAPI GdipPathIterHasCurve (GpPathIterator *iterator, BOOL *hasCurve); 35 | 36 | GpStatus WINGDIPAPI GdipPathIterNextMarkerPath (GpPathIterator *iterator, INT *resultCount, GpPath *path); 37 | GpStatus WINGDIPAPI GdipPathIterNextMarker (GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex); 38 | GpStatus WINGDIPAPI GdipPathIterNextPathType (GpPathIterator *iterator, INT *resultCount, BYTE *pathType, INT *startIndex, INT *endIndex); 39 | GpStatus WINGDIPAPI GdipPathIterNextSubpathPath (GpPathIterator *iterator, INT *resultCount, GpPath *path, BOOL *isClosed); 40 | GpStatus WINGDIPAPI GdipPathIterNextSubpath (GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex, BOOL *isClosed); 41 | 42 | GpStatus WINGDIPAPI GdipPathIterEnumerate (GpPathIterator *iterator, INT *resultCount, GpPointF *points, BYTE *types, INT count); 43 | GpStatus WINGDIPAPI GdipPathIterRewind (GpPathIterator *iterator); 44 | 45 | 46 | /* missing API 47 | GdipPathIterIsValid 48 | */ 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/hatchbrush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __HATCHBRUSH_PRIVATE__ 36 | #define __HATCHBRUSH_PRIVATE__ 37 | 38 | #include "brush-private.h" 39 | 40 | #define HATCH_SIZE 7 41 | #define LINE_WIDTH 1 42 | 43 | #define gdip_hatch_get_width(hbr) (hatches_const[hbr->hatchStyle][0]) 44 | #define gdip_hatch_get_height(hbr) (hatches_const[hbr->hatchStyle][1]) 45 | #define gdip_hatch_get_line_width(hbr) (hatches_const[hbr->hatchStyle][2]) 46 | 47 | #define gdip_cairo_pixel(ct,x,y) cairo_rectangle (ct, x, y, 1, 1) 48 | 49 | typedef struct _Hatch { 50 | GpBrush base; 51 | GpHatchStyle hatchStyle; 52 | ARGB foreColor; 53 | ARGB backColor; 54 | cairo_pattern_t *pattern; 55 | BOOL alpha; 56 | } Hatch; 57 | 58 | #include "hatchbrush.h" 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/hatchbrush.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hatchbrush.h 3 | * 4 | * Author: 5 | * Ravindra (rkumar@novell.com) 6 | * 7 | * Copyright (C) 2004, 2007 Novell, Inc. http://www.novell.com 8 | */ 9 | 10 | #ifndef __HATCHBRUSH_H__ 11 | #define __HATCHBRUSH_H__ 12 | 13 | #include "brush.h" 14 | 15 | GpStatus WINGDIPAPI GdipCreateHatchBrush (GpHatchStyle hatchstyle, ARGB forecol, ARGB backcolor, GpHatch **brush); 16 | GpStatus WINGDIPAPI GdipGetHatchStyle (GpHatch *brush, GpHatchStyle *hatchstyle); 17 | GpStatus WINGDIPAPI GdipGetHatchForegroundColor (GpHatch *brush, ARGB *forecol); 18 | GpStatus WINGDIPAPI GdipGetHatchBackgroundColor (GpHatch *brush, ARGB *backcol); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/icocodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __ICOCODEC_H__ 24 | #define __ICOCODEC_H__ 25 | 26 | #include "bitmap-private.h" 27 | #include "bmpcodec.h" 28 | 29 | /* Information about the icon format can be found @ http://www.daubnet.com/formats/ICO.html */ 30 | 31 | typedef struct { 32 | BYTE bWidth; 33 | BYTE bHeight; 34 | BYTE bColorCount; 35 | BYTE bReserved; 36 | WORD wPlanes; 37 | WORD wBitCount; 38 | DWORD dwBytesInRes; 39 | DWORD dwImageOffset; 40 | } ICONDIRENTRY; 41 | 42 | #define gdip_read_ico_data gdip_read_bmp_data 43 | 44 | GpStatus gdip_load_ico_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 45 | 46 | GpStatus gdip_load_ico_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; 47 | 48 | /* no save functions as the ICO "codec" is a decoder only */ 49 | 50 | ImageCodecInfo* gdip_getcodecinfo_ico () GDIP_INTERNAL; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/image-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __IMAGE_PRIVATE_H__ 36 | #define __IMAGE_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "codecs-private.h" 40 | 41 | typedef enum { 42 | BMP, 43 | TIF, 44 | GIF, 45 | PNG, 46 | JPEG, 47 | EXIF, 48 | WMF, 49 | EMF, 50 | ICON, 51 | MEMBMP, 52 | INVALID 53 | } ImageFormat; 54 | 55 | int gdip_get_pixel_format_depth (PixelFormat pixfmt) GDIP_INTERNAL; 56 | int gdip_get_pixel_format_components (PixelFormat pixfmt) GDIP_INTERNAL; 57 | int gdip_get_pixel_format_bpp (PixelFormat pixfmt) GDIP_INTERNAL; 58 | 59 | BOOL gdip_is_an_indexed_pixelformat (PixelFormat pixfmt) GDIP_INTERNAL; 60 | 61 | void gdip_image_init (GpImage *image) GDIP_INTERNAL; 62 | 63 | #include "image.h" 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/imageattributes-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __IMAGEATTRIBUTES_PRIVATE_H__ 36 | #define __IMAGEATTRIBUTES_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | typedef enum { 41 | ImageAttributeFlagsNoOp = 0x01, 42 | ImageAttributeFlagsColorMatrixEnabled = 0x02, 43 | ImageAttributeFlagsThresholdEnabled = 0x04, 44 | ImageAttributeFlagsGammaEnabled = 0x08, 45 | ImageAttributeFlagsColorKeysEnabled = 0x10, 46 | ImageAttributeFlagsColorRemapTableEnabled = 0x20, 47 | ImageAttributeFlagsOutputChannelEnabled = 0x40, 48 | ImageAttributeFlagsGrayMatrixEnabled = 0x80, 49 | ImageAttributeFlagsOutputChannelColorProfileEnabled = 0x100 50 | } ImageAttributeFlags; 51 | 52 | typedef struct { 53 | ImageAttributeFlags flags; 54 | ColorMap *colormap; 55 | int colormap_elem; 56 | float gamma_correction; 57 | ARGB key_colorlow; 58 | ARGB key_colorhigh; 59 | ColorMatrix *colormatrix; 60 | ColorMatrix *graymatrix; 61 | ColorMatrixFlags colormatrix_flags; 62 | float threshold; // Not implemented. 63 | ColorChannelFlags outputchannel_flags; // Not implemented. 64 | char *colorprofile_filename; // Not implemented. 65 | } GpImageAttribute; 66 | 67 | typedef struct _ImageAttributes { 68 | GpImageAttribute def; 69 | GpImageAttribute bitmap; 70 | GpImageAttribute brush; 71 | GpImageAttribute pen; 72 | GpImageAttribute text; 73 | /* Globals */ 74 | WrapMode wrapmode; 75 | ARGB color; 76 | } ImageAttributes; 77 | 78 | #include "imageattributes.h" 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/imageattributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __IMAGEATTRIBUTES_H__ 32 | #define __IMAGEATTRIBUTES_H__ 33 | 34 | /* ImageAttributes public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipCreateImageAttributes (GpImageAttributes **imageattr); 37 | GpStatus WINGDIPAPI GdipCloneImageAttributes (GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr); 38 | GpStatus WINGDIPAPI GdipDisposeImageAttributes (GpImageAttributes *imageattr); 39 | 40 | GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity (GpImageAttributes *imageattr, ColorAdjustType type); 41 | GpStatus WINGDIPAPI GdipResetImageAttributes (GpImageAttributes *imageattr, ColorAdjustType type); 42 | 43 | GpStatus WINGDIPAPI GdipGetImageAttributesAdjustedPalette(GpImageAttributes *imageattr, ColorPalette *colorPalette, 44 | ColorAdjustType colorAdjustType); 45 | 46 | GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, ARGB colorLow, 47 | ARGB colorHigh); 48 | GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, 49 | GDIPCONST ColorMatrix* colorMatrix, GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags); 50 | GpStatus WINGDIPAPI GdipSetImageAttributesGamma (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL gamma); 51 | GpStatus WINGDIPAPI GdipSetImageAttributesNoOp (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag); 52 | GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannel (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, 53 | ColorChannelFlags channelFlags); 54 | GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannelColorProfile (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, 55 | GDIPCONST WCHAR *colorProfileFilename); 56 | GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, UINT mapSize, 57 | GDIPCONST ColorMap *map); 58 | GpStatus WINGDIPAPI GdipSetImageAttributesThreshold (GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, REAL threshold); 59 | GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode (GpImageAttributes *imageattr, WrapMode wrap, ARGB argb, BOOL clamp); 60 | GpStatus WINGDIPAPI GdipSetImageAttributesICMMode (GpImageAttributes *imageAttr, BOOL on); 61 | GpStatus WINGDIPAPI GdipSetImageAttributesCachedBackground (GpImageAttributes *imageattr, BOOL enableFlag); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/jpegcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jpegcodec.h : Contains function declarations for encoding decoding jpeg images 3 | * 4 | * Authors: 5 | * Sanjay Gupta (gsanjay@novell.com) 6 | * Vladimir Vukicevic (vladimir@pobox.com) 7 | * 8 | * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) 9 | */ 10 | 11 | #ifndef _JPEGCODEC_H 12 | #define _JPEGCODEC_H 13 | 14 | #include "bitmap-private.h" 15 | #include "bmpcodec.h" 16 | 17 | GpStatus gdip_load_jpeg_image_from_file (FILE *fp, const char *filename, GpImage **image) GDIP_INTERNAL; 18 | 19 | GpStatus gdip_load_jpeg_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; 20 | 21 | GpStatus gdip_save_jpeg_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 22 | 23 | GpStatus gdip_save_jpeg_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, 24 | GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 25 | 26 | ImageCodecInfo *gdip_getcodecinfo_jpeg () GDIP_INTERNAL; 27 | 28 | GpStatus gdip_fill_encoder_parameter_list_jpeg (EncoderParameters *buffer, UINT size) GDIP_INTERNAL; 29 | 30 | typedef struct 31 | { 32 | UINT count; 33 | EncoderParameter transformation; 34 | EncoderParameter quality; 35 | EncoderParameter luminanceTable; 36 | EncoderParameter chrominanceTable; 37 | EncoderParameter imageItems; 38 | LONG transformationData[5]; 39 | UINT qualityRange[2]; 40 | } JpegEncoderParameters; 41 | 42 | #endif /* _JPEGCODEC_H */ 43 | -------------------------------------------------------------------------------- /src/lineargradientbrush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __LINEARGRADIENT_PRIVATE_H__ 36 | #define __LINEARGRADIENT_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "brush-private.h" 40 | #include "matrix-private.h" 41 | 42 | #define DEFAULT_GRADIENT_ANGLE 45.0f 43 | 44 | typedef struct _LineGradient { 45 | GpBrush base; 46 | ARGB lineColors [2]; 47 | GpPointF points [2]; 48 | GpRectF rectangle; 49 | GpMatrix matrix; 50 | GpWrapMode wrapMode; 51 | float angle; 52 | Blend *blend; 53 | InterpolationColors *presetColors; 54 | cairo_pattern_t *pattern; 55 | BOOL isAngleScalable; 56 | BOOL gammaCorrection; /* FIXME: Not used */ 57 | } LineGradient; 58 | 59 | #include "lineargradientbrush.h" 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/matrix-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __MATRIX_PRIVATE_H__ 36 | #define __MATRIX_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | typedef cairo_matrix_t GpMatrix; 41 | 42 | #define gdip_matrix_get_x_translation(matrix) (matrix->x0) 43 | #define gdip_matrix_get_y_translation(matrix) (matrix->y0) 44 | #define gdip_matrix_get_x_scale(matrix) (matrix->xx) 45 | #define gdip_matrix_get_y_scale(matrix) (matrix->yy) 46 | #define gdip_matrix_reverse_order(order) ((order == MatrixOrderPrepend) ? MatrixOrderAppend : MatrixOrderPrepend) 47 | #define gdip_cairo_matrix_copy(m1,m2) memcpy (m1, m2, sizeof (cairo_matrix_t)) 48 | 49 | BOOL gdip_is_matrix_a_translation (const GpMatrix *matrix) GDIP_INTERNAL; 50 | BOOL gdip_is_matrix_empty (const GpMatrix* matrix) GDIP_INTERNAL; 51 | GpStatus gdip_matrix_init_from_rect_3points (GpMatrix *matrix, const GpRectF *rect, const GpPointF *dstplg) GDIP_INTERNAL; 52 | 53 | #include "matrix.h" 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/matrix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __MATRIX_H__ 24 | #define __MATRIX_H__ 25 | 26 | GpStatus WINGDIPAPI GdipCreateMatrix (GpMatrix **matrix); 27 | GpStatus WINGDIPAPI GdipCreateMatrix2 (REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix); 28 | GpStatus WINGDIPAPI GdipCreateMatrix3 (GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, GpMatrix **matrix); 29 | GpStatus WINGDIPAPI GdipCreateMatrix3I (GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, GpMatrix **matrix); 30 | GpStatus WINGDIPAPI GdipCloneMatrix (GpMatrix *matrix, GpMatrix **cloneMatrix); 31 | GpStatus WINGDIPAPI GdipDeleteMatrix (GpMatrix *matrix); 32 | GpStatus WINGDIPAPI GdipSetMatrixElements (GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy); 33 | GpStatus WINGDIPAPI GdipMultiplyMatrix (GpMatrix *matrix, GpMatrix *matrix2, GpMatrixOrder order); 34 | GpStatus WINGDIPAPI GdipTranslateMatrix (GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order); 35 | GpStatus WINGDIPAPI GdipScaleMatrix (GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order); 36 | GpStatus WINGDIPAPI GdipRotateMatrix (GpMatrix *matrix, REAL angle, GpMatrixOrder order); 37 | GpStatus WINGDIPAPI GdipShearMatrix (GpMatrix *matrix, REAL shearX, REAL shearY, GpMatrixOrder order); 38 | GpStatus WINGDIPAPI GdipInvertMatrix (GpMatrix *matrix); 39 | GpStatus WINGDIPAPI GdipTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, INT count); 40 | GpStatus WINGDIPAPI GdipTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, INT count); 41 | GpStatus WINGDIPAPI GdipVectorTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, INT count); 42 | GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, INT count); 43 | GpStatus WINGDIPAPI GdipGetMatrixElements (GDIPCONST GpMatrix *matrix, REAL *matrixOut); 44 | GpStatus WINGDIPAPI GdipIsMatrixInvertible (GDIPCONST GpMatrix *matrix, BOOL *result); 45 | GpStatus WINGDIPAPI GdipIsMatrixIdentity (GDIPCONST GpMatrix *matrix, BOOL *result); 46 | GpStatus WINGDIPAPI GdipIsMatrixEqual (GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/pathgradientbrush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __PATHGRADIENTBRUSH_PRIVATE_H__ 36 | #define __PATHGRADIENTBRUSH_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "brush-private.h" 40 | #include "matrix-private.h" 41 | 42 | /* _N: normalize to 0.0 .. 1.0 */ 43 | #define ARGB_ALPHA_N(argb) ((double)((argb >> 24) & 0xff) / 255.0) 44 | #define ARGB_RED_N(argb) ((double)((argb >> 16) & 0xff) / 255.0) 45 | #define ARGB_GREEN_N(argb) ((double)((argb >> 8) & 0xff) / 255.0) 46 | #define ARGB_BLUE_N(argb) ((double)((argb) & 0xff) / 255.0) 47 | 48 | struct _PathGradient { 49 | GpBrush base; 50 | GpPath *boundary; 51 | ARGB *boundaryColors; 52 | int boundaryColorsCount; 53 | GpPointF center; 54 | ARGB centerColor; 55 | GpPointF focusScales; 56 | GpRectF rectangle; 57 | Blend *blend; 58 | InterpolationColors *presetColors; 59 | GpWrapMode wrapMode; 60 | cairo_matrix_t transform; 61 | cairo_pattern_t *pattern; 62 | BOOL useGammaCorrection; 63 | }; 64 | 65 | #include "pathgradientbrush.h" 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/pen-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __PEN_PRIVATE_H__ 36 | #define __PEN_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "matrix-private.h" 40 | 41 | struct _Pen { 42 | ARGB color; 43 | GpBrush *brush; 44 | BOOL own_brush; 45 | float width; 46 | float miter_limit; 47 | GpLineJoin line_join; 48 | GpDashStyle dash_style; 49 | GpLineCap line_cap; /* Cairo supports only same kind of end caps for both the ends. */ 50 | GpLineCap end_cap; 51 | GpDashCap dash_cap; /* not supported */ 52 | int compound_count; 53 | float *compound_array; 54 | GpPenAlignment mode; 55 | float dash_offset; 56 | int dash_count; 57 | BOOL own_dash_array; /* flag to mark if pen maintains its own array or global array */ 58 | float *dash_array; 59 | GpUnit unit; /* Always set to UnitWorld. */ 60 | cairo_matrix_t matrix; 61 | BOOL changed; /* flag to mark if pen is changed and needs setup */ 62 | GpCustomLineCap *custom_start_cap; 63 | GpCustomLineCap *custom_end_cap; 64 | }; 65 | 66 | GpStatus gdip_pen_setup (GpGraphics *graphics, GpPen *pen) GDIP_INTERNAL; 67 | GpStatus gdip_pen_draw_custom_start_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2); 68 | GpStatus gdip_pen_draw_custom_end_cap (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2); 69 | 70 | #include "pen.h" 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/pngcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pngcodec.h : Contains function declarations for encoding decoding png images 3 | * 4 | * Authors: 5 | * Sanjay Gupta (gsanjay@novell.com) 6 | * Vladimir Vukicevic (vladimir@pobox.com) 7 | * 8 | * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) 9 | */ 10 | 11 | #ifndef _PNGCODEC_H 12 | #define _PNGCODEC_H 13 | 14 | #include "bitmap-private.h" 15 | #include "bmpcodec.h" 16 | 17 | GpStatus gdip_load_png_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 18 | 19 | GpStatus gdip_load_png_image_from_stream_delegate (GetBytesDelegate getBytesFunc, SeekDelegate seeknFunc, 20 | GpImage **image) GDIP_INTERNAL; 21 | 22 | GpStatus gdip_save_png_image_to_file (FILE *fp, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 23 | 24 | GpStatus gdip_save_png_image_to_stream_delegate (PutBytesDelegate putBytesFunc, GpImage *image, 25 | GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 26 | 27 | ImageCodecInfo *gdip_getcodecinfo_png () GDIP_INTERNAL; 28 | 29 | GpStatus gdip_fill_encoder_parameter_list_png (EncoderParameters *buffer, UINT size) GDIP_INTERNAL; 30 | 31 | typedef struct 32 | { 33 | UINT count; 34 | EncoderParameter imageItems; 35 | } PngEncoderParameters; 36 | 37 | #endif /* _PNGCODEC_H */ 38 | -------------------------------------------------------------------------------- /src/print.c: -------------------------------------------------------------------------------- 1 | /* 2 | * print.c 3 | * 4 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 7 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 8 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all copies or substantial 13 | * portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 16 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | * 21 | * Authors: 22 | * Jordi Mas (jordi@ximian.com) 23 | * Sebastien Pouliot 24 | */ 25 | 26 | #include 27 | 28 | #ifdef CAIRO_HAS_PS_SURFACE 29 | 30 | #include "graphics-private.h" 31 | #include 32 | 33 | /* 34 | * NOTE: The functions in this file aren't part of GDI+ and can only be called 35 | * from Mono's System.Drawing.dll on non-Windows operating systems 36 | */ 37 | 38 | /* coverity[+alloc : arg-*5] */ 39 | GpStatus 40 | GdipGetPostScriptGraphicsContext (char* filename, int width, int height, double dpix, double dpiy, GpGraphics **graphics) 41 | { 42 | GpGraphics *gfx; 43 | cairo_surface_t *surface; 44 | 45 | if (!graphics) 46 | return InvalidParameter; 47 | 48 | surface = cairo_ps_surface_create (filename, (double) width, (double) height); 49 | cairo_surface_set_fallback_resolution (surface, dpix, dpiy); 50 | 51 | gfx = gdip_graphics_new (surface); 52 | gfx->dpi_x = dpix; 53 | gfx->dpi_y = dpiy; 54 | cairo_surface_destroy (surface); 55 | 56 | gfx->type = gtPostScript; 57 | *graphics = gfx; 58 | return Ok; 59 | } 60 | 61 | GpStatus 62 | GdipGetPostScriptSavePage (GpGraphics* graphics) 63 | { 64 | if (!graphics) 65 | return InvalidParameter; 66 | 67 | cairo_show_page (graphics->ct); 68 | return Ok; 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/region-bitmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | /* 24 | * NOTE: This is a private header files and everything is subject to changes. 25 | */ 26 | 27 | #ifndef __REGION_BITMAP_H__ 28 | #define __REGION_BITMAP_H__ 29 | 30 | #include "gdiplus-private.h" 31 | #include "bitmap-private.h" 32 | 33 | /* 34 | * REGION_MAX_BITMAP_SIZE defines the size limit of the region bitmap we keep 35 | * in memory. The current value is 2 megabits which should be enough for any 36 | * on-screen region. Before changing this value remember that a "real", but 37 | * temporary, ARGB32 bitmap (32 times bigger, i.e. 8MB) may be allocated when 38 | * converting the path into the region bitmap. 39 | */ 40 | #define REGION_MAX_BITMAP_SIZE (2 * 1024 * 1024 >> 3) 41 | 42 | #define SHAPE_SIZE(shape) (((shape)->Width * (shape)->Height) >> 3) 43 | 44 | 45 | typedef struct { 46 | int X; 47 | int Y; 48 | int Width; 49 | int Height; 50 | unsigned char *Mask; 51 | BOOL reduced; 52 | } GpRegionBitmap; 53 | 54 | 55 | void gdip_region_bitmap_ensure (GpRegion *region) GDIP_INTERNAL; 56 | GpRegionBitmap* gdip_region_bitmap_from_path (GpPath *path) GDIP_INTERNAL; 57 | GpRegionBitmap* gdip_region_bitmap_clone (GpRegionBitmap *bitmap) GDIP_INTERNAL; 58 | 59 | void gdip_region_bitmap_free (GpRegionBitmap *bitmap) GDIP_INTERNAL; 60 | void gdip_region_bitmap_invalidate (GpRegion *region) GDIP_INTERNAL; 61 | 62 | BOOL gdip_region_bitmap_compare (GpRegionBitmap *shape1, GpRegionBitmap *shape2) GDIP_INTERNAL; 63 | BOOL gdip_region_bitmap_is_point_visible (GpRegionBitmap *bitmap, int x, int y) GDIP_INTERNAL; 64 | BOOL gdip_region_bitmap_is_rect_visible (GpRegionBitmap *bitmap, GpRect *rect) GDIP_INTERNAL; 65 | 66 | int gdip_region_bitmap_get_scans (GpRegionBitmap *bitmap, GpRectF *rect) GDIP_INTERNAL; 67 | 68 | void gdip_region_bitmap_get_smallest_rect (GpRegionBitmap *bitmap, GpRect *rect) GDIP_INTERNAL; 69 | void gdip_region_bitmap_shrink (GpRegionBitmap *bitmap, BOOL always_shrink) GDIP_INTERNAL; 70 | 71 | cairo_surface_t *gdip_region_bitmap_to_cairo_surface (GpRegionBitmap *bitmap) GDIP_INTERNAL; 72 | 73 | GpRegionBitmap* gdip_region_bitmap_combine (GpRegionBitmap *bitmap1, GpRegionBitmap* bitmap2, CombineMode combineMode) GDIP_INTERNAL; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/region-path-tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef _REGION_PATH_TREE_H_ 24 | #define _REGION_PATH_TREE_H_ 25 | 26 | #include "gdiplus-private.h" 27 | #include "matrix-private.h" 28 | 29 | /* internal (private) API for regions path trees */ 30 | 31 | #define REGION_TAG_PATH 1 32 | #define REGION_TAG_TREE 2 33 | 34 | typedef struct GpPathTree { 35 | CombineMode mode; 36 | GpPath* path; 37 | struct GpPathTree* branch1; 38 | struct GpPathTree* branch2; 39 | } GpPathTree; 40 | 41 | void gdip_region_clear_tree (GpPathTree *tree) GDIP_INTERNAL; 42 | GpStatus gdip_region_copy_tree (GpPathTree *source, GpPathTree *dest) GDIP_INTERNAL; 43 | 44 | UINT gdip_region_get_tree_size (GpPathTree *tree) GDIP_INTERNAL; 45 | BOOL gdip_region_deserialize_tree (BYTE *data, int size, GpPathTree *tree) GDIP_INTERNAL; 46 | BOOL gdip_region_serialize_tree (GpPathTree *tree, BYTE *buffer, UINT bufferSize, UINT *sizeFilled) GDIP_INTERNAL; 47 | 48 | void gdip_region_translate_tree (GpPathTree *tree, float dx, float dy) GDIP_INTERNAL; 49 | GpStatus gdip_region_transform_tree (GpPathTree *tree, GpMatrix *matrix) GDIP_INTERNAL; 50 | 51 | #endif /* _REGION_PATH_TREE_H_ */ 52 | -------------------------------------------------------------------------------- /src/region-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __REGION_PRIVATE_H__ 36 | #define __REGION_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "matrix-private.h" 40 | #include "region-bitmap.h" 41 | #include "region-path-tree.h" 42 | 43 | /* In the integer world infinity has limited bounds ;-) */ 44 | #define REGION_INFINITE_POSITION -4194304 45 | #define REGION_INFINITE_LENGTH 8388608 46 | 47 | typedef enum { 48 | RegionTypeRect, 49 | RegionTypePath, 50 | RegionTypeInfinite 51 | } RegionType; 52 | 53 | typedef enum { 54 | RegionDataRect = 0x10000000, 55 | RegionDataPath = 0x10000001, 56 | RegionDataEmptyRect = 0x10000002, 57 | RegionDataInfiniteRect = 0x10000003 58 | } RegionDataType; 59 | 60 | typedef struct { 61 | DWORD size; 62 | DWORD checksum; 63 | DWORD magic; 64 | DWORD combiningOps; 65 | } RegionHeader; 66 | 67 | struct _Region { 68 | guint32 type; 69 | int cnt; 70 | GpRectF* rects; 71 | GpPathTree* tree; 72 | GpRegionBitmap* bitmap; 73 | }; 74 | 75 | BOOL gdip_is_InfiniteRegion (const GpRegion *region) GDIP_INTERNAL; 76 | BOOL gdip_is_Point_in_RectF_inclusive (float x, float y, GpRectF* rect) GDIP_INTERNAL; 77 | 78 | void gdip_clear_region (GpRegion *region) GDIP_INTERNAL; 79 | GpStatus gdip_copy_region (GpRegion *source, GpRegion *dest) GDIP_INTERNAL; 80 | 81 | #include "region.h" 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/region.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __REGION_H__ 24 | #define __REGION_H__ 25 | 26 | GpStatus WINGDIPAPI GdipCreateRegion (GpRegion **region); 27 | GpStatus WINGDIPAPI GdipCreateRegionRect (GDIPCONST GpRectF *rect, GpRegion **region); 28 | GpStatus WINGDIPAPI GdipCreateRegionRectI (GDIPCONST GpRect *rect, GpRegion **region); 29 | GpStatus WINGDIPAPI GdipCreateRegionPath (GpPath *path, GpRegion **region); 30 | GpStatus WINGDIPAPI GdipCreateRegionRgnData (GDIPCONST BYTE *regionData, INT size, GpRegion **region); 31 | 32 | GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); 33 | GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region); 34 | GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region); 35 | GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region); 36 | 37 | GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, CombineMode combineMode); 38 | GpStatus WINGDIPAPI GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, CombineMode combineMode); 39 | GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); 40 | GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, CombineMode combineMode); 41 | 42 | GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect); 43 | GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn); 44 | GpStatus WINGDIPAPI GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); 45 | GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *result); 46 | 47 | GpStatus WINGDIPAPI GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, GpGraphics *graphics, BOOL *result); 48 | GpStatus WINGDIPAPI GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, GpGraphics *graphics, BOOL *result); 49 | GpStatus WINGDIPAPI GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, REAL height, GpGraphics *graphics, BOOL *result); 50 | GpStatus WINGDIPAPI GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, INT height, GpGraphics *graphics, BOOL *result); 51 | 52 | GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMatrix *matrix); 53 | GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *rects, INT *count, GpMatrix *matrix); 54 | GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *rects, INT *count, GpMatrix *matrix); 55 | 56 | GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics, BOOL *result); 57 | GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); 58 | GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT *sizeFilled); 59 | 60 | GpStatus WINGDIPAPI GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy); 61 | GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *region, INT dx, INT dy); 62 | GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/solidbrush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __SOLIDBRUSH_PRIVATE_H__ 36 | #define __SOLIDBRUSH_PRIVATE_H__ 37 | 38 | #include "brush-private.h" 39 | 40 | typedef struct _SolidFill { 41 | Brush base; 42 | int color; 43 | /* We cache the color components */ 44 | double A; 45 | double R; 46 | double G; 47 | double B; 48 | } SolidFill; 49 | 50 | #include "solidbrush.h" 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/solidbrush.c: -------------------------------------------------------------------------------- 1 | /* 2 | * solidbrush.c 3 | * 4 | * Copyright (c) 2003 Alexandre Pigolkine 5 | * Copyright (C) 2007 Novell, Inc. http://www.novell.com 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 8 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 9 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial 14 | * portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 17 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * Authors: 23 | * Alexandre Pigolkine(pigolkine@gmx.de) 24 | * Ravindra (rkumar@novell.com) 25 | */ 26 | 27 | #include "solidbrush-private.h" 28 | #include "general-private.h" 29 | #include "graphics-private.h" 30 | 31 | static GpStatus gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush); 32 | static GpStatus gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush); 33 | static GpStatus gdip_solidfill_destroy (GpBrush *brush); 34 | 35 | /* 36 | * we have a single copy of vtable for 37 | * all instances of solidbrush. 38 | */ 39 | 40 | static BrushClass vtable = { BrushTypeSolidColor, 41 | gdip_solidfill_setup, 42 | gdip_solidfill_clone, 43 | gdip_solidfill_destroy }; 44 | 45 | static void 46 | gdip_solidfill_init (GpSolidFill *brush) 47 | { 48 | gdip_brush_init (&brush->base, &vtable); 49 | brush->color = 0x00000000; 50 | } 51 | 52 | static GpSolidFill* 53 | gdip_solidfill_new () 54 | { 55 | GpSolidFill *result = (GpSolidFill *) GdipAlloc (sizeof (GpSolidFill)); 56 | 57 | if (result) 58 | gdip_solidfill_init (result); 59 | 60 | return result; 61 | } 62 | 63 | GpStatus 64 | gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush) 65 | { 66 | GpSolidFill *solid; 67 | 68 | if (!graphics || !brush) 69 | return InvalidParameter; 70 | 71 | solid = (GpSolidFill *) brush; 72 | 73 | /* We extract the ARGB components of the color, only if the 74 | * brush is changed. 75 | */ 76 | if (solid->base.changed) { 77 | BYTE a = (solid->color & 0xFF000000) >> 24; 78 | BYTE r = (solid->color & 0x00FF0000) >> 16; 79 | BYTE g = (solid->color & 0x0000FF00) >> 8; 80 | BYTE b = (solid->color & 0x000000FF); 81 | 82 | if (a == 0) { 83 | solid->A = 0; 84 | solid->R = 0; 85 | solid->G = 0; 86 | solid->B = 0; 87 | } 88 | else { 89 | solid->A = (double) a / 255.0; 90 | solid->R = (double) r / 255.0; 91 | solid->G = (double) g / 255.0; 92 | solid->B = (double) b / 255.0; 93 | } 94 | } 95 | 96 | cairo_set_source_rgba (graphics->ct, solid->R, solid->G, solid->B, solid->A); 97 | return Ok; 98 | } 99 | 100 | GpStatus 101 | gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush) 102 | { 103 | GpSolidFill *result; 104 | GpSolidFill *solid; 105 | 106 | result = gdip_solidfill_new (); 107 | if (!result) 108 | return OutOfMemory; 109 | 110 | solid = (GpSolidFill *) brush; 111 | 112 | result->base = solid->base; 113 | result->color = solid->color; 114 | result->base.changed = TRUE; 115 | 116 | *clonedBrush = (GpBrush *) result; 117 | return Ok; 118 | } 119 | 120 | GpStatus 121 | gdip_solidfill_destroy (GpBrush *brush) 122 | { 123 | return Ok; 124 | } 125 | 126 | // coverity[+alloc : arg-*1] 127 | GpStatus WINGDIPAPI 128 | GdipCreateSolidFill (ARGB color, GpSolidFill **brush) 129 | { 130 | GpSolidFill *result; 131 | 132 | if (!gdiplusInitialized) 133 | return GdiplusNotInitialized; 134 | 135 | if (!brush) 136 | return InvalidParameter; 137 | 138 | result = gdip_solidfill_new (); 139 | if (!result) 140 | return OutOfMemory; 141 | 142 | result->color = color; 143 | 144 | *brush = result; 145 | return Ok; 146 | } 147 | 148 | GpStatus WINGDIPAPI 149 | GdipSetSolidFillColor (GpSolidFill *brush, ARGB color) 150 | { 151 | if (!brush) 152 | return InvalidParameter; 153 | 154 | brush->color = color; 155 | brush->base.changed = TRUE; 156 | 157 | return Ok; 158 | } 159 | 160 | GpStatus WINGDIPAPI 161 | GdipGetSolidFillColor (GpSolidFill *brush, ARGB *color) 162 | { 163 | if (!brush || !color) 164 | return InvalidParameter; 165 | 166 | *color = brush->color; 167 | return Ok; 168 | } 169 | -------------------------------------------------------------------------------- /src/solidbrush.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Ravindra (rkumar@novell.com) 19 | * Sebastien Pouliot 20 | * 21 | * Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) 22 | */ 23 | 24 | #ifndef __SOLIDBRUSH_H__ 25 | #define __SOLIDBRUSH_H__ 26 | 27 | #include "brush.h" 28 | 29 | GpStatus WINGDIPAPI GdipCreateSolidFill (ARGB color, GpSolidFill **brush); 30 | GpStatus WINGDIPAPI GdipGetSolidFillColor (GpSolidFill *brush, ARGB *color); 31 | GpStatus WINGDIPAPI GdipSetSolidFillColor (GpSolidFill *brush, ARGB color); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/stringformat-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __STRINGFORMAT_PRIVATE_H__ 36 | #define __STRINGFORMAT_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | 40 | struct _StringFormat { 41 | StringAlignment alignment; 42 | StringAlignment lineAlignment; 43 | HotkeyPrefix hotkeyPrefix; 44 | StringFormatFlags formatFlags; 45 | StringTrimming trimming; 46 | StringDigitSubstitute substitute; 47 | LANGID language; 48 | CharacterRange *charRanges; 49 | float firstTabOffset; 50 | float *tabStops; 51 | int numtabStops; 52 | int charRangeCount; 53 | }; 54 | 55 | void gdip_create_generic_stringformats () GDIP_INTERNAL; 56 | void gdip_delete_generic_stringformats () GDIP_INTERNAL; 57 | 58 | #include "stringformat.h" 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/stringformat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | #ifndef __STRINGFORMAT_H__ 32 | #define __STRINGFORMAT_H__ 33 | 34 | /* StringFormat public API (only!) */ 35 | 36 | GpStatus WINGDIPAPI GdipCreateStringFormat (INT formatAttributes, LANGID language, GpStringFormat **format); 37 | GpStatus WINGDIPAPI GdipStringFormatGetGenericDefault (GpStringFormat **format); 38 | GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic (GpStringFormat **format); 39 | GpStatus WINGDIPAPI GdipCloneStringFormat (GDIPCONST GpStringFormat* format, GpStringFormat** newFormat); 40 | GpStatus WINGDIPAPI GdipDeleteStringFormat (GpStringFormat *format); 41 | 42 | GpStatus WINGDIPAPI GdipGetStringFormatAlign (GDIPCONST GpStringFormat *format, StringAlignment *align); 43 | GpStatus WINGDIPAPI GdipSetStringFormatAlign (GpStringFormat *format, StringAlignment align); 44 | 45 | GpStatus WINGDIPAPI GdipGetStringFormatDigitSubstitution (GDIPCONST GpStringFormat *format, LANGID *language, StringDigitSubstitute *substitute); 46 | GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution (GpStringFormat *format, LANGID language, StringDigitSubstitute substitute); 47 | 48 | GpStatus WINGDIPAPI GdipGetStringFormatFlags (GDIPCONST GpStringFormat *format, INT *flags); 49 | GpStatus WINGDIPAPI GdipSetStringFormatFlags (GpStringFormat *format, INT flags); 50 | 51 | GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix (GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); 52 | GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix (GpStringFormat *format, INT hotkeyPrefix); 53 | 54 | GpStatus WINGDIPAPI GdipGetStringFormatLineAlign (GDIPCONST GpStringFormat *format, StringAlignment *align); 55 | GpStatus WINGDIPAPI GdipSetStringFormatLineAlign (GpStringFormat *format, StringAlignment align); 56 | 57 | GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount (GDIPCONST GpStringFormat *format, INT *count); 58 | GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges (GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges); 59 | 60 | GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount (GDIPCONST GpStringFormat *format, INT *count); 61 | GpStatus WINGDIPAPI GdipGetStringFormatTabStops (GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); 62 | GpStatus WINGDIPAPI GdipSetStringFormatTabStops (GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); 63 | 64 | GpStatus WINGDIPAPI GdipGetStringFormatTrimming (GDIPCONST GpStringFormat *format, StringTrimming *trimming); 65 | GpStatus WINGDIPAPI GdipSetStringFormatTrimming (GpStringFormat *format, StringTrimming trimming); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/text-cairo-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __TEXT_CAIRO_PRIVATE_H__ 36 | #define __TEXT_CAIRO_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "graphics-private.h" 40 | #include "stringformat-private.h" 41 | 42 | /* Flags and Support structure for MeasureOrDrawString */ 43 | #define STRING_DETAIL_TAB (1<<0) 44 | #define STRING_DETAIL_LF (1<<1) 45 | #define STRING_DETAIL_HOTKEY (1<<2) 46 | #define STRING_DETAIL_BREAK (1<<3) 47 | #define STRING_DETAIL_HIDDEN (1<<4) 48 | #define STRING_DETAIL_LINESTART (1<<5) 49 | 50 | #define text_DrawString cairo_DrawString 51 | #define text_MeasureString cairo_MeasureString 52 | #define text_MeasureCharacterRanges cairo_MeasureCharacterRanges 53 | 54 | /* cache for computed information during MeasureString that can be reused during DrawString */ 55 | typedef struct { 56 | BOOL has_hotkeys; 57 | int align_horz; 58 | int align_vert; 59 | int line_height; 60 | int max_y; 61 | int descent; 62 | } GpDrawTextData; 63 | 64 | typedef struct { 65 | unsigned long Flags; 66 | unsigned long Linefeeds; 67 | float PosX; /* We call it X, even though it might become Y for vertical drawing */ 68 | float PosY; /* We call it Y, even though it might become X for vertical drawing */ 69 | float Width; /* Width of the character; height is defined in font structure */ 70 | int LineLen; /* If LineStart how many chars is the line long? */ 71 | } GpStringDetailStruct; 72 | 73 | GpStatus cairo_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 74 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; 75 | 76 | GpStatus cairo_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 77 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled) 78 | GDIP_INTERNAL; 79 | 80 | GpStatus cairo_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 81 | GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, INT regionCount, GpRegion **regions) GDIP_INTERNAL; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/text-metafile-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | /* 24 | * NOTE: This is a private header files and everything is subject to changes. 25 | */ 26 | 27 | #ifndef __TEXT_METAFILE_PRIVATE_H__ 28 | #define __TEXT_METAFILE_PRIVATE_H__ 29 | 30 | #include "gdiplus-private.h" 31 | 32 | GpStatus metafile_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 33 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/text-metafile.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #include "text-metafile-private.h" 24 | 25 | /* 26 | * NOTE: all parameter's validations are done inside text.c 27 | */ 28 | 29 | /* 30 | * http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/DrawString.html 31 | */ 32 | 33 | GpStatus 34 | metafile_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 35 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) 36 | { 37 | /* TODO */ 38 | return Ok; 39 | } 40 | -------------------------------------------------------------------------------- /src/text-pango-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Sebastien Pouliot 19 | * 20 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 21 | */ 22 | 23 | /* 24 | * NOTE: This is a private header files and everything is subject to changes. 25 | */ 26 | 27 | #ifndef __TEXT_PANGO_PRIVATE_H__ 28 | #define __TEXT_PANGO_PRIVATE_H__ 29 | 30 | #include "gdiplus-private.h" 31 | 32 | #ifdef USE_PANGO_RENDERING 33 | 34 | #include 35 | #include 36 | #include "graphics-private.h" 37 | #include "stringformat-private.h" 38 | 39 | #define PANGO_MAX (G_MAXINT / PANGO_SCALE) 40 | #define MAKE_SAFE_FOR_PANGO(x) ((x) == G_MAXINT32 ? 0 :((x) > G_MAXINT/PANGO_SCALE ? G_MAXINT/PANGO_SCALE : ((x) < G_MININT/PANGO_SCALE ? G_MININT/PANGO_SCALE : (x)))) 41 | 42 | #define GDIP_WINDOWS_ACCELERATOR '&' 43 | 44 | #define text_DrawString pango_DrawString 45 | #define text_MeasureString pango_MeasureString 46 | #define text_MeasureCharacterRanges pango_MeasureCharacterRanges 47 | 48 | 49 | PangoLayout* gdip_pango_setup_layout (cairo_t *cr, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 50 | GDIPCONST RectF *rc, RectF *box, PointF *box_offset, GDIPCONST GpStringFormat *format, INT **charsRemoved); 51 | 52 | GpStatus pango_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 53 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; 54 | 55 | GpStatus pango_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 56 | GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled) 57 | GDIP_INTERNAL; 58 | 59 | GpStatus pango_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, 60 | GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, INT regionCount, GpRegion **regions) GDIP_INTERNAL; 61 | 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/text.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Alexandre Pigolkine, Novell Inc. 3 | * Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 7 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | * subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all copies or substantial 12 | * portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 15 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 18 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | * 20 | * Authors: 21 | * Alexandre Pigolkine (pigolkine@gmx.de) 22 | * Duncan Mak (duncan@ximian.com) 23 | * Sebastien Pouliot 24 | */ 25 | 26 | #ifndef __TEXT_H__ 27 | #define __TEXT_H__ 28 | 29 | /* Text public API (only!) */ 30 | 31 | GpStatus WINGDIPAPI GdipDrawString (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, 32 | GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GpBrush *brush); 33 | 34 | GpStatus WINGDIPAPI GdipMeasureString (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, 35 | GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, 36 | INT *linesFilled); 37 | 38 | GpStatus WINGDIPAPI GdipMeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, 39 | GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions); 40 | 41 | GpStatus WINGDIPAPI GdipDrawDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, 42 | GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix); 43 | 44 | GpStatus WINGDIPAPI GdipMeasureDriverString (GpGraphics *graphics, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, 45 | GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix, RectF *boundingBox); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/text.notes: -------------------------------------------------------------------------------- 1 | Notes, funny facts and $#&^*@# stuff on text rendering 2 | ------------------------------------------------------ 3 | 4 | Since there's not much documentation on every options (and parts of it is 5 | wrong) here's are my little rambling^H notes on the subject... 6 | 7 | 8 | GDI+ 9 | 10 | - It seems that HotkeyPrefixShow is never seen when we use an underline font; 11 | 12 | - StringFormatFlagsMeasureTrailingSpaces not only measure the trailing space, 13 | it also render them (e.g. underline and strikeout) - but that's not true if 14 | - DirectionRightToLeft is specified; or 15 | - DirectionVertical is specified; or 16 | - both DirectionRightToLeft and DirectionVertical are specified; or 17 | - there's more than a single line being rendered 18 | 19 | 20 | - StringFormatFlagsMeasureTrailingSpaces doesn't affect the number of 21 | characters reported by GdipMeasureString *codepointsFitted out parameter. 22 | I.e. all trailing space are "fitted" - even if not measured. 23 | 24 | - HotkeyPrefix[None|Hide|Show] also has no effect on GdipMeasureString 25 | *codepointsFitted out parameter. 26 | -------------------------------------------------------------------------------- /src/texturebrush-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 3 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 6 | * subject to the following conditions: 7 | * 8 | * The above copyright notice and this permission notice shall be included in all copies or substantial 9 | * portions of the Software. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 12 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 13 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 15 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | * 17 | * Authors: 18 | * Alexandre Pigolkine (pigolkine@gmx.de) 19 | * Duncan Mak (duncan@ximian.com) 20 | * Miguel de Icaza (miguel@ximian.com) 21 | * Ravindra (rkumar@novell.com) 22 | * Sanjay Gupta (gsanjay@novell.com) 23 | * Vladimir Vukicevic (vladimir@pobox.com) 24 | * Geoff Norton (gnorton@customerdna.com) 25 | * Jonathan Gilbert (logic@deltaq.org) 26 | * Sebastien Pouliot 27 | * 28 | * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) 29 | */ 30 | 31 | /* 32 | * NOTE: This is a private header files and everything is subject to changes. 33 | */ 34 | 35 | #ifndef __TEXTUREBRUSH_PRIVATE_H__ 36 | #define __TEXTUREBRUSH_PRIVATE_H__ 37 | 38 | #include "gdiplus-private.h" 39 | #include "brush-private.h" 40 | #include "matrix-private.h" 41 | 42 | typedef struct _Texture { 43 | GpBrush base; 44 | GpImage *image; 45 | cairo_matrix_t matrix; 46 | GpRect rectangle; 47 | GpWrapMode wrapMode; 48 | cairo_pattern_t *pattern; 49 | } Texture; 50 | 51 | #include "texturebrush.h" 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/texturebrush.h: -------------------------------------------------------------------------------- 1 | /* 2 | * texturebrush.h 3 | * 4 | * Author: 5 | * Ravindra (rkumar@novell.com) 6 | * 7 | * Copyright (C) 2004,2006-2007 Novell, Inc. http://www.novell.com 8 | */ 9 | 10 | /* 11 | * NOTE: This header file contains ONLY public definitions and MUST match the GDI+ definitions. 12 | */ 13 | 14 | #ifndef __TEXTUREBRUSH_H__ 15 | #define __TEXTUREBRUSH_H__ 16 | 17 | GpStatus WINGDIPAPI GdipCreateTexture (GpImage *image, GpWrapMode wrapmode, GpTexture **texture); 18 | GpStatus WINGDIPAPI GdipCreateTexture2 (GpImage *image, GpWrapMode wrapmode, REAL x, REAL y, REAL width, REAL height, GpTexture **texture); 19 | GpStatus WINGDIPAPI GdipCreateTexture2I (GpImage *image, GpWrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture **texture); 20 | GpStatus WINGDIPAPI GdipCreateTextureIA (GpImage *image, GpImageAttributes *imageAttributes, REAL x, REAL y, REAL width, REAL height, GpTexture **texture); 21 | GpStatus WINGDIPAPI GdipCreateTextureIAI (GpImage *image, GpImageAttributes *imageAttributes, INT x, INT y, INT width, INT height, GpTexture **texture); 22 | GpStatus WINGDIPAPI GdipGetTextureTransform (GpTexture *texture, GpMatrix *matrix); 23 | GpStatus WINGDIPAPI GdipSetTextureTransform (GpTexture *texture, GDIPCONST GpMatrix *matrix); 24 | GpStatus WINGDIPAPI GdipResetTextureTransform (GpTexture *texture); 25 | GpStatus WINGDIPAPI GdipMultiplyTextureTransform (GpTexture *texture, GpMatrix *matrix, GpMatrixOrder order); 26 | GpStatus WINGDIPAPI GdipTranslateTextureTransform (GpTexture *texture, REAL dx, REAL dy, GpMatrixOrder order); 27 | GpStatus WINGDIPAPI GdipScaleTextureTransform (GpTexture *texture, REAL sx, REAL sy, GpMatrixOrder order); 28 | GpStatus WINGDIPAPI GdipRotateTextureTransform (GpTexture *texture, REAL angle, GpMatrixOrder order); 29 | GpStatus WINGDIPAPI GdipSetTextureWrapMode (GpTexture *texture, GpWrapMode wrapmode); 30 | GpStatus WINGDIPAPI GdipGetTextureWrapMode (GpTexture *texture, GpWrapMode *wrapmode); 31 | GpStatus WINGDIPAPI GdipGetTextureImage (GpTexture *texture, GpImage **image); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/tiffcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * tiffcodec.h : Contains function declarations for encoding decoding tiff images 3 | * 4 | * Authors: 5 | * Sanjay Gupta (gsanjay@novell.com) 6 | * Vladimir Vukicevic (vladimir@pobox.com) 7 | * 8 | * Copyright (C) 2003-2004, 2007 Novell, Inc (http://www.novell.com) 9 | */ 10 | 11 | #ifndef _TIFFCODEC_H 12 | #define _TIFFCODEC_H 13 | 14 | #include "bitmap-private.h" 15 | #include "bmpcodec.h" 16 | 17 | GpStatus gdip_load_tiff_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 18 | 19 | GpStatus gdip_load_tiff_image_from_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, 20 | SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage **image) GDIP_INTERNAL; 21 | 22 | GpStatus gdip_save_tiff_image_to_file (unsigned char *filename, GpImage *image, GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 23 | 24 | GpStatus gdip_save_tiff_image_to_stream_delegate (GetBytesDelegate getBytesFunc, PutBytesDelegate putBytesFunc, 25 | SeekDelegate seekFunc, CloseDelegate closeFunc, SizeDelegate sizeFunc, GpImage *image, 26 | GDIPCONST EncoderParameters *params) GDIP_INTERNAL; 27 | 28 | ImageCodecInfo* gdip_getcodecinfo_tiff () GDIP_INTERNAL; 29 | 30 | GpStatus gdip_fill_encoder_parameter_list_tiff (EncoderParameters *buffer, UINT size) GDIP_INTERNAL; 31 | 32 | typedef struct 33 | { 34 | UINT count; 35 | EncoderParameter compression; 36 | EncoderParameter colorDepth; 37 | EncoderParameter saveFlag; 38 | EncoderParameter saveAsCYMK; 39 | LONG compressionData[5]; 40 | LONG colorDepthData[5]; 41 | LONG saveFlagValue; 42 | LONG saveAsCYMKValue; 43 | } TiffEncoderParameters; 44 | 45 | #endif /* _TIFFCODEC_H */ 46 | -------------------------------------------------------------------------------- /src/win32-private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Quamotion bvba 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Frederik Carlier 21 | */ 22 | 23 | #include "win32-private.h" 24 | 25 | #include 26 | 27 | FILE *CreateTempFile (char *filename) 28 | { 29 | TCHAR temppath[MAX_PATH]; 30 | DWORD ret = 0; 31 | 32 | ret = GetTempPath (MAX_PATH, temppath); 33 | if (ret > MAX_PATH || ret == 0) { 34 | return NULL; 35 | } 36 | 37 | ret = GetTempFileName (temppath, "ff", 0, (LPSTR)filename); 38 | if (ret == 0) { 39 | return NULL; 40 | } 41 | 42 | return fopen (filename, "wb"); 43 | } 44 | 45 | int gdip_get_display_dpi_win32 () 46 | { 47 | int dpis; 48 | HDC dc; 49 | dc = GetDC (0); 50 | dpis = GetDeviceCaps (dc, LOGPIXELSX); 51 | ReleaseDC (0, dc); 52 | return dpis; 53 | } 54 | -------------------------------------------------------------------------------- /src/win32-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Quamotion bvba 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Frederik Carlier 21 | */ 22 | 23 | #include 24 | 25 | // Creates a temporary file. Saves the value of the temporary file in filename, 26 | // and returns a handle to the temp file. 27 | FILE *CreateTempFile (char *filename); 28 | 29 | int gdip_get_display_dpi_win32 (); 30 | -------------------------------------------------------------------------------- /src/wmfcodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Novell, Inc (http://www.novell.com) 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 8 | * subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all copies or substantial 11 | * portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 14 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 15 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 17 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | * 19 | * Authors: 20 | * Sebastien Pouliot 21 | */ 22 | 23 | #ifndef __WMFCODEC_H__ 24 | #define __WMFCODEC_H__ 25 | 26 | #include "gdiplus-private.h" 27 | #include "graphics-private.h" 28 | #include "metafile-private.h" 29 | 30 | #define WMF_MIN_RECORD_SIZE 6 31 | 32 | #define WMF_CHECK_PARAMS(x) do { \ 33 | if (params < (x)) goto cleanup; \ 34 | } while (0) 35 | 36 | #define RECORDSIZE 0 37 | #define FUNCTION 4 38 | #define WP1 6 39 | #define WP2 8 40 | #define WP3 10 41 | #define WP4 12 42 | #define WP5 14 43 | #define WP6 16 44 | #define WP7 18 45 | #define WP8 20 46 | #define WP9 22 47 | #define WP10 24 48 | #define WP11 26 49 | #define WP12 28 50 | #define WP(y) (4 + ((y) << 1)) 51 | 52 | #define gdip_read_wmf_data gdip_read_bmp_data 53 | 54 | 55 | GpStatus gdip_load_wmf_image_from_file (FILE *fp, GpImage **image) GDIP_INTERNAL; 56 | 57 | GpStatus gdip_load_wmf_image_from_stream_delegate (dstream_t *loader, GpImage **image) GDIP_INTERNAL; 58 | 59 | /* no save functions as the WMF "codec" is a decoder only */ 60 | 61 | ImageCodecInfo* gdip_getcodecinfo_wmf () GDIP_INTERNAL; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | .deps/ 3 | .libs/ 4 | Makefile 5 | Makefile.in 6 | TestResult.xml 7 | testadjustablearrowcap 8 | testbits 9 | testbitmap 10 | testbmpcodec 11 | testbrush 12 | testclip 13 | testcodecs 14 | testcustomlinecap 15 | testemfcodec 16 | testfont 17 | testgeneral 18 | testgifcodec 19 | testgpimage 20 | testgraphics 21 | testgraphicsdraw 22 | testgraphicsfill 23 | testgraphicspath 24 | testgdi 25 | testhatchbrush 26 | testicocodec 27 | testimageattributes 28 | testjpegcodec 29 | testlineargradientbrush 30 | testmatrix 31 | testmetafile 32 | testpathgradientbrush 33 | testpen 34 | testpng 35 | testpngcodec 36 | testregion 37 | testreversepath 38 | testsolidbrush 39 | teststringformat 40 | testtext 41 | testtexturebrush 42 | testtiffcodec 43 | testwmfcodec 44 | test-image 45 | gtest 46 | -------------------------------------------------------------------------------- /tests/AdobeRGB1998.icc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/AdobeRGB1998.icc -------------------------------------------------------------------------------- /tests/lsansuppressions.txt: -------------------------------------------------------------------------------- 1 | leak:XGetDefault 2 | leak:FcConfigAppFontAddFile 3 | -------------------------------------------------------------------------------- /tests/test-exif.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test-exif.jpg -------------------------------------------------------------------------------- /tests/test-gsa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test-gsa.png -------------------------------------------------------------------------------- /tests/test-trns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test-trns.png -------------------------------------------------------------------------------- /tests/test.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.bmp -------------------------------------------------------------------------------- /tests/test.emf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.emf -------------------------------------------------------------------------------- /tests/test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.gif -------------------------------------------------------------------------------- /tests/test.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.ico -------------------------------------------------------------------------------- /tests/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.jpg -------------------------------------------------------------------------------- /tests/test.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.otf -------------------------------------------------------------------------------- /tests/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.png -------------------------------------------------------------------------------- /tests/test.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.tif -------------------------------------------------------------------------------- /tests/test.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.ttf -------------------------------------------------------------------------------- /tests/test.wmf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test.wmf -------------------------------------------------------------------------------- /tests/test3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/libgdiplus/94a49875487e296376f209fe64b921c6020f74c0/tests/test3.ico -------------------------------------------------------------------------------- /tests/testbrush.c: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #ifndef __cplusplus 3 | #error Please compile with a C++ compiler. 4 | #endif 5 | #endif 6 | 7 | #if defined(USE_WINDOWS_GDIPLUS) 8 | #include 9 | #include 10 | 11 | #pragma comment(lib, "gdiplus.lib") 12 | #else 13 | #include 14 | #endif 15 | 16 | #if defined(USE_WINDOWS_GDIPLUS) 17 | using namespace Gdiplus; 18 | using namespace DllExports; 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | #include "testhelpers.h" 25 | 26 | static void test_getBrushType () 27 | { 28 | GpStatus status; 29 | GpSolidFill *brush; 30 | GpBrushType brushType; 31 | 32 | GdipCreateSolidFill (1, &brush); 33 | 34 | // Negative tests. 35 | status = GdipGetBrushType (NULL, &brushType); 36 | assertEqualInt (status, InvalidParameter); 37 | 38 | status = GdipGetBrushType ((GpBrush *) brush, NULL); 39 | assertEqualInt (status, InvalidParameter); 40 | 41 | GdipDeleteBrush ((GpBrush *) brush); 42 | } 43 | 44 | static void test_clone () 45 | { 46 | GpStatus status; 47 | GpSolidFill *brush; 48 | GpBrush *clone; 49 | 50 | GdipCreateSolidFill (1, &brush); 51 | 52 | // Negative tests. 53 | status = GdipCloneBrush (NULL, &clone); 54 | assertEqualInt (status, InvalidParameter); 55 | 56 | status = GdipCloneBrush ((GpBrush *) brush, NULL); 57 | assertEqualInt (status, InvalidParameter); 58 | 59 | GdipDeleteBrush ((GpBrush *) brush); 60 | } 61 | 62 | static void test_delete () 63 | { 64 | GpStatus status; 65 | GpSolidFill *brush; 66 | 67 | GdipCreateSolidFill (1, &brush); 68 | 69 | status = GdipDeleteBrush ((GpBrush *) brush); 70 | assertEqualInt (status, Ok); 71 | 72 | // Negative tests. 73 | status = GdipDeleteBrush (NULL); 74 | assertEqualInt (status, InvalidParameter); 75 | } 76 | 77 | int 78 | main (int argc, char**argv) 79 | { 80 | STARTUP; 81 | 82 | test_getBrushType (); 83 | test_clone (); 84 | test_delete (); 85 | 86 | SHUTDOWN; 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /tests/testicocodec.c: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #ifndef __cplusplus 3 | #error Please compile with a C++ compiler. 4 | #endif 5 | #endif 6 | 7 | #if defined(USE_WINDOWS_GDIPLUS) 8 | #include 9 | #include 10 | 11 | #pragma comment(lib, "gdiplus.lib") 12 | #else 13 | #include 14 | #endif 15 | 16 | #if defined(USE_WINDOWS_GDIPLUS) 17 | using namespace Gdiplus; 18 | using namespace DllExports; 19 | #endif 20 | 21 | #include 22 | #include "testhelpers.h" 23 | 24 | static const char *file = "temp_asset.ico"; 25 | static WCHAR wFile[] = {'t', 'e', 'm', 'p', '_', 'a', 's', 's', 'e', 't', '.', 'i', 'c', 'o', 0}; 26 | GpImage *image; 27 | 28 | #define createFile(buffer, expectedStatus) \ 29 | { \ 30 | GpStatus status; \ 31 | FILE *f = fopen (file, "wb+"); \ 32 | assert (f); \ 33 | fwrite ((void *) buffer, sizeof (BYTE), sizeof (buffer), f); \ 34 | fclose (f); \ 35 | \ 36 | status = GdipLoadImageFromFile (wFile, &image); \ 37 | assertEqualInt (status, expectedStatus); \ 38 | } 39 | 40 | static void test_invalidHeader () 41 | { 42 | BYTE noCount[] = {0, 0, 1, 0}; 43 | BYTE zeroCount[] = {0, 0, 1, 0, 0, 0}; 44 | 45 | createFile (noCount, OutOfMemory); 46 | createFile (zeroCount, OutOfMemory); 47 | } 48 | 49 | static void test_invalidEntry () 50 | { 51 | BYTE noEntries[] = {0, 0, 1, 0, 1, 0}; 52 | 53 | createFile (noEntries, OutOfMemory); 54 | } 55 | 56 | static void test_invalidImage () 57 | { 58 | BYTE noBitmapHeader[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0}; 59 | BYTE invalidPalette[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}; 60 | BYTE noRGBEntries[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 61 | BYTE fewRGBEntries[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 62 | BYTE noXorData[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 63 | BYTE noAndData[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4}; 64 | 65 | #if defined(USE_WINDOWS_GDIPLUS) 66 | BYTE invalidData[] = {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 22, 0, 0, 0, 40, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 128, 0, 0, 0, 0, 0, 0, 0}; 67 | #endif 68 | 69 | createFile (noBitmapHeader, OutOfMemory); 70 | createFile (invalidPalette, OutOfMemory); 71 | createFile (noRGBEntries, OutOfMemory); 72 | createFile (fewRGBEntries, OutOfMemory); 73 | createFile (noXorData, OutOfMemory); 74 | createFile (noAndData, OutOfMemory); 75 | 76 | // FIXME: this returns Ok with libgdiplus. 77 | #if defined(USE_WINDOWS_GDIPLUS) 78 | createFile (invalidData, OutOfMemory); 79 | #endif 80 | } 81 | 82 | static void test_getPixel () 83 | { 84 | WCHAR *unis; 85 | GpBitmap *bitmap; 86 | GpStatus status; 87 | PixelFormat pixel_format; 88 | ARGB color; 89 | 90 | unis = createWchar ("test3.ico"); 91 | status = GdipCreateBitmapFromFile (unis, &bitmap); 92 | assertEqualInt (status, Ok); 93 | freeWchar (unis); 94 | status = GdipGetImagePixelFormat (bitmap, &pixel_format); 95 | assertEqualInt (status, Ok); 96 | assertEqualInt (pixel_format, PixelFormat32bppARGB); 97 | status = GdipBitmapGetPixel (bitmap, 0, 0, &color); 98 | assertEqualInt (status, Ok); 99 | assertEqualInt (color, 0x879EE532u); 100 | GdipDisposeImage (bitmap); 101 | } 102 | 103 | int 104 | main (int argc, char**argv) 105 | { 106 | STARTUP; 107 | 108 | test_invalidHeader (); 109 | test_invalidEntry (); 110 | test_invalidImage (); 111 | test_getPixel (); 112 | 113 | deleteFile (file); 114 | 115 | SHUTDOWN; 116 | return 0; 117 | } 118 | -------------------------------------------------------------------------------- /tests/testpng.c: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #ifndef __cplusplus 3 | #error Please compile with a C++ compiler. 4 | #endif 5 | #endif 6 | 7 | #if defined(USE_WINDOWS_GDIPLUS) 8 | #include 9 | #include 10 | 11 | #pragma comment(lib, "gdiplus.lib") 12 | #else 13 | #include 14 | #endif 15 | 16 | #if defined(USE_WINDOWS_GDIPLUS) 17 | using namespace Gdiplus; 18 | using namespace DllExports; 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | #include "testhelpers.h" 25 | 26 | static int status_counter = 0; 27 | 28 | #define CHECK_STATUS(x) do { if (status != Ok) { printf ("status[%d] == %d!\n", status_counter++, status); if(x) { exit(-1); } } else { printf ("status[%d] == Ok\n", status_counter++); } } while (0) 29 | #define CHECK_ASSERT(x) do { if (!(x)) { printf ("check %s at %s:%d failed\n", #x, __FILE__, __LINE__); exit(-1); } else { printf("check %s at %s:%d passed\n", #x, __FILE__, __LINE__); } } while (0) 30 | 31 | CLSID png_clsid = { 0x557cf406, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; 32 | 33 | int 34 | main (int argc, char **argv) 35 | { 36 | GpImage *img; 37 | WCHAR *unis; 38 | GpBitmap *bitmap; 39 | GpStatus status; 40 | int original_palette_size; 41 | int reloaded_palette_size; 42 | ColorPalette *original_palette; 43 | ColorPalette *reloaded_palette; 44 | PixelFormat pixel_format; 45 | ARGB color; 46 | 47 | STARTUP; 48 | 49 | // PNG resave should preserve the palette transparency. Let's test it 50 | // by loading a PNG file and its palette, then resaving it and loading 51 | // it again for comparison. 52 | unis = createWchar ("test-trns.png"); 53 | status = GdipLoadImageFromFile (unis, &img); 54 | CHECK_STATUS(1); 55 | freeWchar (unis); 56 | 57 | status = GdipGetImagePaletteSize (img, &original_palette_size); 58 | CHECK_STATUS(1); 59 | CHECK_ASSERT(original_palette_size > 0); 60 | original_palette = (ColorPalette *) malloc (original_palette_size); 61 | GdipGetImagePalette (img, original_palette, original_palette_size); 62 | CHECK_STATUS(1); 63 | 64 | unis = createWchar ("test-trns-resave.png"); 65 | status = GdipSaveImageToFile (img, unis, &png_clsid, NULL); 66 | CHECK_STATUS(1); 67 | GdipDisposeImage (img); 68 | status = GdipLoadImageFromFile (unis, &img); 69 | CHECK_STATUS(1); 70 | freeWchar (unis); 71 | 72 | status = GdipGetImagePaletteSize (img, &reloaded_palette_size); 73 | CHECK_STATUS(1); 74 | CHECK_ASSERT(reloaded_palette_size > 0); 75 | CHECK_ASSERT(reloaded_palette_size == original_palette_size); 76 | reloaded_palette = (ColorPalette *) malloc (reloaded_palette_size); 77 | GdipGetImagePalette (img, reloaded_palette, reloaded_palette_size); 78 | CHECK_STATUS(1); 79 | 80 | CHECK_ASSERT(memcmp (original_palette, reloaded_palette, original_palette_size) == 0); 81 | 82 | GdipDisposeImage (img); 83 | img = NULL; 84 | #if defined(_WIN32) 85 | _unlink ("test-trns-resave.png"); 86 | #else 87 | unlink ("test-trns-resave.png"); 88 | #endif 89 | free (original_palette); 90 | free (reloaded_palette); 91 | 92 | // Test grayscale image with alpha channel. The image should be converted 93 | // into 32-bit ARGB format and the alpha channel should be preserved. 94 | unis = createWchar ("test-gsa.png"); 95 | status = GdipCreateBitmapFromFile (unis, &bitmap); 96 | CHECK_STATUS(1); 97 | freeWchar (unis); 98 | status = GdipGetImagePixelFormat (bitmap, &pixel_format); 99 | CHECK_STATUS(1); 100 | CHECK_ASSERT(pixel_format == PixelFormat32bppARGB); 101 | status = GdipBitmapGetPixel (bitmap, 0, 0, &color); 102 | CHECK_STATUS(1); 103 | CHECK_ASSERT(color == 0xffffff); 104 | status = GdipBitmapGetPixel (bitmap, 1, 7, &color); 105 | CHECK_STATUS(1); 106 | CHECK_ASSERT(color == 0xe8b3b3b3); 107 | GdipDisposeImage (bitmap); 108 | 109 | SHUTDOWN; 110 | 111 | return 0; 112 | } 113 | -------------------------------------------------------------------------------- /update_submodules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date' 3 | SUBMODULE_OK='Git submodules updated successfully' 4 | if test -e .git; then \ 5 | (git submodule update --init --recursive && echo $SUBMODULE_OK) \ 6 | || (git submodule init && git submodule update --recursive && echo $SUBMODULE_OK) \ 7 | || (git submodule init && git submodule update && echo $SUBMODULE_ERROR) \ 8 | || (echo 'Git submodules could not be updated. Compilation will fail') \ 9 | fi 10 | 11 | if ! test -e external/googletest/README.md; then 12 | echo "Error: Couldn't find the required submodules. This usually happens when using an archive from GitHub instead of https://download.mono-project.com/sources/mono/, or something went wrong while updating submodules." 13 | exit 1 14 | fi 15 | -------------------------------------------------------------------------------- /winconfig.h.in: -------------------------------------------------------------------------------- 1 | /* winconfig.h.in. Template used on Windows/MSVC and processed by libgdiplus.vcxproj PreBuildEvent. */ 2 | 3 | /* Version number of package */ 4 | #define VERSION "#LIBGDIPLUS_VERSION#" 5 | --------------------------------------------------------------------------------