gdiplustypes.h 4.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
/*
 * Copyright (C) 2007 Google (Evan Stade)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef _GDIPLUSTYPES_H
#define _GDIPLUSTYPES_H

typedef float REAL;

enum Status{
    Ok                          = 0,
    GenericError                = 1,
    InvalidParameter            = 2,
    OutOfMemory                 = 3,
    ObjectBusy                  = 4,
    InsufficientBuffer          = 5,
    NotImplemented              = 6,
    Win32Error                  = 7,
    WrongState                  = 8,
    Aborted                     = 9,
    FileNotFound                = 10,
    ValueOverflow               = 11,
    AccessDenied                = 12,
    UnknownImageFormat          = 13,
    FontFamilyNotFound          = 14,
    FontStyleNotFound           = 15,
    NotTrueTypeFont             = 16,
    UnsupportedGdiplusVersion   = 17,
    GdiplusNotInitialized       = 18,
    PropertyNotFound            = 19,
45 46
    PropertyNotSupported        = 20,
    ProfileNotFound             = 21
47 48
};

49 50 51 52 53 54 55 56 57

#ifdef __cplusplus
extern "C" {
#endif

typedef BOOL (CALLBACK * ImageAbort)(VOID *);
typedef ImageAbort DrawImageAbort;
typedef ImageAbort GetThumbnailImageAbort;

58 59
typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*);

60 61 62 63 64
#ifdef __cplusplus
}
#endif


65 66
#ifdef __cplusplus

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
class Point
{
public:
   Point()
   {
       X = Y = 0;
   }

   Point(IN const Point &pt)
   {
       X = pt.X;
       Y = pt.Y;
   }

   /* FIXME: missing constructor that takes a Size */

   Point(IN INT x, IN INT y)
   {
       X = x;
       Y = y;
   }

   Point operator+(IN const Point& pt) const
   {
       return Point(X + pt.X, Y + pt.Y);
   }

   Point operator-(IN const Point& pt) const
   {
       return Point(X - pt.X, Y - pt.Y);
   }

   BOOL Equals(IN const Point& pt)
   {
       return (X == pt.X) && (Y == pt.Y);
   }

public:
    INT X;
    INT Y;
};

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
class PointF
{
public:
   PointF()
   {
       X = Y = 0.0f;
   }

   PointF(IN const PointF &pt)
   {
       X = pt.X;
       Y = pt.Y;
   }

   /* FIXME: missing constructor that takes a SizeF */

   PointF(IN REAL x, IN REAL y)
   {
       X = x;
       Y = y;
   }

   PointF operator+(IN const PointF& pt) const
   {
       return PointF(X + pt.X, Y + pt.Y);
   }

   PointF operator-(IN const PointF& pt) const
   {
       return PointF(X - pt.X, Y - pt.Y);
   }

   BOOL Equals(IN const PointF& pt)
   {
       return (X == pt.X) && (Y == pt.Y);
   }

public:
    REAL X;
    REAL Y;
};

151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
class PathData
{
public:
    PathData()
    {
        Count = 0;
        Points = NULL;
        Types = NULL;
    }

    ~PathData()
    {
        if (Points != NULL)
        {
            delete Points;
        }

        if (Types != NULL)
        {
            delete Types;
        }
    }

private:
    PathData(const PathData &);
    PathData& operator=(const PathData &);

public:
    INT Count;
    PointF* Points;
    BYTE* Types;
};

184 185 186 187 188 189 190 191 192 193
/* FIXME: missing the methods. */
class RectF
{
public:
    REAL X;
    REAL Y;
    REAL Width;
    REAL Height;
};

194
/* FIXME: missing the methods. */
195 196 197 198 199 200 201 202 203
class Rect
{
public:
    INT X;
    INT Y;
    INT Width;
    INT Height;
};

204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
class CharacterRange
{
public:
    CharacterRange()
    {
        First = Length = 0;
    }

    CharacterRange(INT first, INT length)
    {
        First = first;
        Length = length;
    }

    CharacterRange& operator=(const CharacterRange& rhs)
    {
        First = rhs.First;
        Length = rhs.Length;
        return *this;
    }
public:
    INT First;
    INT Length;
};

229 230
#else /* end of c++ typedefs */

231 232 233 234 235 236
typedef struct Point
{
    INT X;
    INT Y;
} Point;

237 238 239 240 241
typedef struct PointF
{
    REAL X;
    REAL Y;
} PointF;
242

243 244 245 246 247 248 249
typedef struct PathData
{
    INT Count;
    PointF* Points;
    BYTE* Types;
} PathData;

250 251 252 253 254 255 256 257
typedef struct RectF
{
    REAL X;
    REAL Y;
    REAL Width;
    REAL Height;
} RectF;

258 259 260 261 262 263 264 265
typedef struct Rect
{
    INT X;
    INT Y;
    INT Width;
    INT Height;
} Rect;

266 267 268 269 270 271
typedef struct CharacterRange
{
    INT First;
    INT Length;
} CharacterRange;

272 273 274 275 276
typedef enum Status Status;

#endif /* end of c typedefs */

#endif