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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
/**************************************************************************\
*
* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusHeaders.h
*
* Abstract:
*
* GDI+ Native C++ public header file
*
\**************************************************************************/
#ifndef _GDIPLUSHEADERS_H
#define _GDIPLUSHEADERS_H
//--------------------------------------------------------------------------
// Abstract base class for regions
//--------------------------------------------------------------------------
// Include the class declarations here and have inline class implementation
// in separate file to avoid circular references.
class Region : public GdiplusBase
{
public:
friend class Graphics;
Region();
Region(IN const RectF& rect);
Region(IN const Rect& rect);
Region(IN const GraphicsPath* path);
Region(IN const BYTE* regionData, IN INT size);
Region(IN HRGN hRgn);
static Region* FromHRGN(IN HRGN hRgn);
~Region();
Region* Clone() const;
Status MakeInfinite();
Status MakeEmpty();
// Get the size of the buffer needed for the GetData method
UINT GetDataSize() const;
// buffer - where to put the data
// bufferSize - how big the buffer is (should be at least as big as GetDataSize())
// sizeFilled - if not NULL, this is an OUT param that says how many bytes
// of data were written to the buffer.
Status GetData(OUT BYTE* buffer,
IN UINT bufferSize,
OUT UINT* sizeFilled = NULL) const;
Status Intersect(IN const Rect& rect);
Status Intersect(IN const RectF& rect);
Status Intersect(IN const GraphicsPath* path);
Status Intersect(IN const Region* region);
Status Union(IN const Rect& rect);
Status Union(IN const RectF& rect);
Status Union(IN const GraphicsPath* path);
Status Union(IN const Region* region);
Status Xor(IN const Rect& rect);
Status Xor(IN const RectF& rect);
Status Xor(IN const GraphicsPath* path);
Status Xor(IN const Region* region);
Status Exclude(IN const Rect& rect);
Status Exclude(IN const RectF& rect);
Status Exclude(IN const GraphicsPath* path);
Status Exclude(IN const Region* region);
Status Complement(IN const Rect& rect);
Status Complement(IN const RectF& rect);
Status Complement(IN const GraphicsPath* path);
Status Complement(IN const Region* region);
Status Translate(IN REAL dx,
IN REAL dy);
Status Translate(IN INT dx,
IN INT dy);
Status Transform(IN const Matrix* matrix);
Status GetBounds(OUT Rect* rect,
IN const Graphics* g) const;
Status GetBounds(OUT RectF* rect,
IN const Graphics* g) const;
HRGN GetHRGN (IN const Graphics * g) const;
BOOL IsEmpty(IN const Graphics *g) const;
BOOL IsInfinite(IN const Graphics *g) const;
BOOL IsVisible(IN INT x,
IN INT y,
IN const Graphics* g = NULL) const
{
return IsVisible(Point(x, y), g);
}
BOOL IsVisible(IN const Point& point,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN REAL x,
IN REAL y,
IN const Graphics* g = NULL) const
{
return IsVisible(PointF(x, y), g);
}
BOOL IsVisible(IN const PointF& point,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN INT x,
IN INT y,
IN INT width,
IN INT height,
IN const Graphics* g) const
{
return IsVisible(Rect(x, y, width, height), g);
}
BOOL IsVisible(IN const Rect& rect,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN REAL x,
IN REAL y,
IN REAL width,
IN REAL height,
IN const Graphics* g = NULL) const
{
return IsVisible(RectF(x, y, width, height), g);
}
BOOL IsVisible(IN const RectF& rect,
IN const Graphics* g = NULL) const;
BOOL Equals(IN const Region* region,
IN const Graphics* g) const;
UINT GetRegionScansCount(IN const Matrix* matrix) const;
Status GetRegionScans(IN const Matrix* matrix,
OUT RectF* rects,
OUT INT* count) const;
Status GetRegionScans(IN const Matrix* matrix,
OUT Rect* rects,
OUT INT* count) const;
Status GetLastStatus() const;
protected:
#ifdef DCR_USE_NEW_250932
private:
Region(const Region ®ion);
Region& operator=(const Region ®ion);
protected:
#else
Region(const Region ®ion)
{
region; // reference parameter
SetStatus(NotImplemented);
}
Region& operator=(const Region ®ion)
{
region; // reference parameter
SetStatus(NotImplemented);
return *this;
}
#endif
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
Region(GpRegion* nativeRegion);
VOID SetNativeRegion(GpRegion* nativeRegion);
protected:
GpRegion* nativeRegion;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Abstract base class for FontFamily
//--------------------------------------------------------------------------
class FontFamily : public GdiplusBase
{
public:
friend class Font;
friend class Graphics;
friend class GraphicsPath;
friend class FontCollection;
FontFamily();
FontFamily(
IN const WCHAR *name,
IN const FontCollection *fontCollection = NULL
);
~FontFamily();
static const FontFamily *GenericSansSerif();
static const FontFamily *GenericSerif();
static const FontFamily *GenericMonospace();
Status GetFamilyName(
OUT WCHAR name[LF_FACESIZE],
IN LANGID language = 0
) const;
// Copy operator
FontFamily * Clone() const;
BOOL IsAvailable() const
{
return (nativeFamily != NULL);
};
BOOL IsStyleAvailable(IN INT style) const;
UINT16 GetEmHeight (IN INT style) const;
UINT16 GetCellAscent (IN INT style) const;
UINT16 GetCellDescent (IN INT style) const;
UINT16 GetLineSpacing (IN INT style) const;
///////////////////////////////////////////////////////////
Status GetLastStatus() const;
#ifdef DCR_USE_NEW_250932
private:
FontFamily(const FontFamily &);
FontFamily& operator=(const FontFamily &);
#endif
protected:
Status SetStatus(Status status) const;
// private constructor for copy
FontFamily(GpFontFamily * nativeFamily, Status status);
///////////////////////////////////////
// Data members
protected:
GpFontFamily *nativeFamily;
mutable Status lastResult;
};
static FontFamily *GenericSansSerifFontFamily = NULL;
static FontFamily *GenericSerifFontFamily = NULL;
static FontFamily *GenericMonospaceFontFamily = NULL;
static BYTE GenericSansSerifFontFamilyBuffer[sizeof(FontFamily)] = {0};
static BYTE GenericSerifFontFamilyBuffer [sizeof(FontFamily)] = {0};
static BYTE GenericMonospaceFontFamilyBuffer[sizeof(FontFamily)] = {0};
//--------------------------------------------------------------------------
// Abstract base class for fonts
//--------------------------------------------------------------------------
class Font : public GdiplusBase
{
public:
friend class Graphics;
Font(IN HDC hdc);
Font(IN HDC hdc,
IN const LOGFONTA* logfont);
Font(IN HDC hdc,
IN const LOGFONTW* logfont);
#ifdef DCR_USE_NEW_127084
Font(IN HDC hdc,
IN const HFONT hfont);
#endif
Font(
IN const FontFamily * family,
IN REAL emSize,
IN INT style = FontStyleRegular,
IN Unit unit = UnitPoint
);
Font(
IN const WCHAR * familyName,
IN REAL emSize,
IN INT style = FontStyleRegular,
IN Unit unit = UnitPoint,
IN const FontCollection * fontCollection = NULL
);
Status GetLogFontA(IN const Graphics* g,
OUT LOGFONTA * logfontA) const;
Status GetLogFontW(IN const Graphics* g,
OUT LOGFONTW * logfontW) const;
Font* Clone() const;
~Font();
BOOL IsAvailable() const;
INT GetStyle() const;
REAL GetSize() const;
Unit GetUnit() const;
Status GetLastStatus() const;
REAL GetHeight(IN const Graphics *graphics = NULL) const;
#ifdef DCR_USE_NEW_125467
REAL GetHeight(IN REAL dpi) const;
#endif
Status GetFamily(OUT FontFamily *family) const;
#ifdef DCR_USE_NEW_250932
private:
Font(const Font &);
Font& operator=(const Font &);
#endif
protected:
Font(GpFont* font, Status status);
VOID SetNativeFont(GpFont *Font);
Status SetStatus(Status status) const;
protected:
/*
* handle to native line texture object
*/
GpFont* nativeFont;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Abstract base classes for font collections
//--------------------------------------------------------------------------
class FontCollection : public GdiplusBase
{
public:
friend class FontFamily;
FontCollection();
virtual ~FontCollection();
INT GetFamilyCount() const; // number of enumerable families in the collection
Status GetFamilies( // enumerate the fonts in a collection
IN INT numSought,
OUT FontFamily * gpfamilies,
OUT INT * numFound
) const;
Status GetLastStatus() const;
#ifdef DCR_USE_NEW_250932
private:
FontCollection(const FontCollection &);
FontCollection& operator=(const FontCollection &);
#endif
protected:
Status SetStatus(Status status) const ;
GpFontCollection *nativeFontCollection;
mutable Status lastResult;
};
class InstalledFontCollection : public FontCollection
{
public:
InstalledFontCollection();
~InstalledFontCollection();
#ifdef DCR_USE_NEW_250932
private:
InstalledFontCollection(const InstalledFontCollection &);
InstalledFontCollection& operator=(const InstalledFontCollection &);
#endif
protected:
#ifndef DCR_USE_NEW_235072
Status InstallFontFile(IN const WCHAR* filename);
Status UninstallFontFile(IN const WCHAR* filename);
#endif
Status SetStatus(Status status) const ;
};
class PrivateFontCollection : public FontCollection
{
public:
PrivateFontCollection();
~PrivateFontCollection();
Status AddFontFile(IN const WCHAR* filename);
Status AddMemoryFont(IN const VOID* memory,
IN INT length);
#ifdef DCR_USE_NEW_250932
private:
PrivateFontCollection(const PrivateFontCollection &);
PrivateFontCollection& operator=(const PrivateFontCollection &);
#endif
};
//--------------------------------------------------------------------------
// Abstract base class for bitmap image and metafile
//--------------------------------------------------------------------------
// !!! Note:
// Include the class declarations here and have the inline class
// implementation in a separate file. This is done to resolve a
// circular dependency since one of the Bitmap methods needs to
// access the private member nativeGraphics of the Graphics object.
class Image : public GdiplusBase
{
public:
friend class Brush;
friend class TextureBrush;
friend class Graphics;
#ifndef DCR_USE_NEW_140782
Image(
IN const WCHAR* filename
);
Image(
IN IStream* stream
);
static Image* FromFile(
IN const WCHAR* filename
);
static Image* FromStream(
IN IStream* stream
);
#else
Image(
IN const WCHAR* filename,
IN BOOL useEmbeddedColorManagement = FALSE
);
Image(
IN IStream* stream,
IN BOOL useEmbeddedColorManagement = FALSE
);
static Image* FromFile(
IN const WCHAR* filename,
IN BOOL useEmbeddedColorManagement = FALSE
);
static Image* FromStream(
IN IStream* stream,
IN BOOL useEmbeddedColorManagement = FALSE
);
#endif
virtual ~Image();
virtual Image* Clone();
Status Save(IN const WCHAR* filename,
IN const CLSID* clsidEncoder,
IN const EncoderParameters *encoderParams = NULL);
Status Save(IN IStream* stream,
IN const CLSID* clsidEncoder,
IN const EncoderParameters *encoderParams = NULL);
Status SaveAdd(IN const EncoderParameters* encoderParams);
Status SaveAdd(IN Image* newImage,
IN const EncoderParameters* encoderParams);
ImageType GetType() const;
Status GetPhysicalDimension(OUT SizeF* size);
Status GetBounds(OUT RectF* srcRect,
OUT Unit* srcUnit);
UINT GetWidth();
UINT GetHeight();
REAL GetHorizontalResolution();
REAL GetVerticalResolution();
UINT GetFlags();
Status GetRawFormat(OUT GUID *format);
PixelFormat GetPixelFormat();
INT GetPaletteSize();
Status GetPalette(OUT ColorPalette* palette,
IN INT size);
Status SetPalette(IN const ColorPalette* palette);
Image* GetThumbnailImage(IN UINT thumbWidth,
IN UINT thumbHeight,
IN GetThumbnailImageAbort callback = NULL,
IN VOID* callbackData = NULL);
UINT GetFrameDimensionsCount();
Status GetFrameDimensionsList(OUT GUID* dimensionIDs,
IN UINT count);
UINT GetFrameCount(IN const GUID* dimensionID);
Status SelectActiveFrame(IN const GUID* dimensionID,
IN UINT frameIndex);
Status RotateFlip(IN RotateFlipType rotateFlipType);
UINT GetPropertyCount();
Status GetPropertyIdList(IN UINT numOfProperty,
OUT PROPID* list);
UINT GetPropertyItemSize(IN PROPID propId);
Status GetPropertyItem(IN PROPID propId,
IN UINT propSize,
OUT PropertyItem* buffer);
Status GetPropertySize(OUT UINT* totalBufferSize,
OUT UINT* numProperties);
Status GetAllPropertyItems(IN UINT totalBufferSize,
IN UINT numProperties,
OUT PropertyItem* allItems);
Status RemovePropertyItem(IN PROPID propId);
Status SetPropertyItem(IN const PropertyItem* item);
UINT GetEncoderParameterListSize(IN const CLSID* clsidEncoder);
Status GetEncoderParameterList(IN const CLSID* clsidEncoder,
IN UINT size,
OUT EncoderParameters* buffer);
// Support for Middle East localization (right-to-left mirroring)
ImageLayout GetLayout() const;
Status SetLayout(IN const ImageLayout layout);
Status GetLastStatus() const;
protected:
Image() {}
Image(GpImage *nativeImage, Status status);
VOID SetNativeImage(GpImage* nativeImage);
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
GpImage* nativeImage;
mutable Status lastResult;
mutable Status loadStatus;
#ifdef DCR_USE_NEW_250932
private:
#else
protected:
#endif
// Disable copy constructor and assignment operator
Image(IN const Image& C);
Image& operator=(IN const Image& C);
};
class Bitmap : public Image
{
public:
friend class Image;
friend class CachedBitmap;
Bitmap(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement = FALSE
);
Bitmap(
IN IStream *stream,
IN BOOL useEmbeddedColorManagement = FALSE
);
static Bitmap* FromFile(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement = FALSE
);
static Bitmap* FromStream(
IN IStream *stream,
IN BOOL useEmbeddedColorManagement = FALSE
);
Bitmap(IN INT width,
IN INT height,
IN INT stride, PixelFormat format,
IN BYTE* scan0);
Bitmap(IN INT width,
IN INT height,
IN PixelFormat format = PixelFormat32bppARGB);
Bitmap(IN INT width,
IN INT height,
IN Graphics* target);
Bitmap* Clone(IN const Rect& rect,
IN PixelFormat format);
Bitmap* Clone(IN INT x,
IN INT y,
IN INT width,
IN INT height,
IN PixelFormat format);
Bitmap* Clone(IN const RectF& rect,
IN PixelFormat format);
Bitmap* Clone(IN REAL x,
IN REAL y,
IN REAL width,
IN REAL height,
IN PixelFormat format);
Status LockBits(IN const Rect& rect,
IN UINT flags,
IN PixelFormat format,
OUT BitmapData* lockedBitmapData);
Status UnlockBits(IN BitmapData* lockedBitmapData);
Status GetPixel(IN INT x,
IN INT y,
OUT Color *color);
Status SetPixel(IN INT x,
IN INT y,
IN const Color &color);
Status SetResolution(IN REAL xdpi,
IN REAL ydpi);
// GDI interop:
Bitmap(IN IDirectDrawSurface7* surface);
Bitmap(IN const BITMAPINFO* gdiBitmapInfo,
IN VOID* gdiBitmapData);
Bitmap(IN HBITMAP hbm,
IN HPALETTE hpal);
Bitmap(IN HICON hicon);
Bitmap(IN HINSTANCE hInstance,
IN const WCHAR * bitmapName);
static Bitmap* FromDirectDrawSurface7(IN IDirectDrawSurface7* surface);
static Bitmap* FromBITMAPINFO(IN const BITMAPINFO* gdiBitmapInfo,
IN VOID* gdiBitmapData);
static Bitmap* FromHBITMAP(IN HBITMAP hbm,
IN HPALETTE hpal);
static Bitmap* FromHICON(IN HICON hicon);
static Bitmap* FromResource(IN HINSTANCE hInstance,
IN const WCHAR * bitmapName);
Status GetHBITMAP(IN const Color& colorBackground,
OUT HBITMAP *hbmReturn);
Status GetHICON(HICON *hicon);
#ifdef DCR_USE_NEW_250932
private:
Bitmap(const Bitmap &);
Bitmap& operator=(const Bitmap &);
#endif
protected:
Bitmap(GpBitmap *nativeBitmap);
};
class CustomLineCap : public GdiplusBase
{
public:
friend class Pen;
CustomLineCap(
IN const GraphicsPath* fillPath,
IN const GraphicsPath* strokePath,
IN LineCap baseCap = LineCapFlat,
IN REAL baseInset = 0
);
virtual ~CustomLineCap();
CustomLineCap* Clone() const;
Status SetStrokeCap(IN LineCap strokeCap)
{
// This changes both start and and caps.
return SetStrokeCaps(strokeCap, strokeCap);
}
Status SetStrokeCaps(IN LineCap startCap,
IN LineCap endCap);
Status GetStrokeCaps(OUT LineCap* startCap,
OUT LineCap* endCap) const;
Status SetStrokeJoin(IN LineJoin lineJoin);
LineJoin GetStrokeJoin() const;
Status SetBaseCap(IN LineCap baseCap);
LineCap GetBaseCap() const;
Status SetBaseInset(IN REAL inset);
REAL GetBaseInset() const;
Status SetWidthScale(IN REAL widthScale);
REAL GetWidthScale() const;
protected:
CustomLineCap();
#ifdef DCR_USE_NEW_250932
private:
CustomLineCap(const CustomLineCap &);
CustomLineCap& operator=(const CustomLineCap &);
protected:
#else
CustomLineCap(const CustomLineCap& customLineCap)
{
customLineCap;
SetStatus(NotImplemented);
}
CustomLineCap& operator=(const CustomLineCap& customLineCap)
{
customLineCap;
SetStatus(NotImplemented);
return *this;
}
#endif
CustomLineCap(GpCustomLineCap* nativeCap, Status status)
{
lastResult = status;
SetNativeCap(nativeCap);
}
VOID SetNativeCap(GpCustomLineCap* nativeCap)
{
this->nativeCap = nativeCap;
}
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
protected:
GpCustomLineCap* nativeCap;
mutable Status lastResult;
};
class CachedBitmap : public GdiplusBase
{
friend Graphics;
public:
CachedBitmap(IN Bitmap *bitmap,
IN Graphics *graphics);
virtual ~CachedBitmap();
Status GetLastStatus() const;
#ifdef DCR_USE_NEW_250932
private:
CachedBitmap(const CachedBitmap &);
CachedBitmap& operator=(const CachedBitmap &);
#endif
protected:
GpCachedBitmap *nativeCachedBitmap;
mutable Status lastResult;
};
#endif // !_GDIPLUSHEADERS.HPP
|