soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SRender-i.h
1#ifndef __SRENDER_I__H__
2#define __SRENDER_I__H__
3
4#include <interface/obj-ref-i.h>
6#include <interface/SGradient-i.h>
7#include <interface/SPathEffect-i.h>
9#include <interface/sxml-i.h>
10
11SNSBEGIN
12
13typedef struct IRenderFactory IRenderFactory;
14
15// Enumerations
16typedef enum EXPEND_MODE
17{
18 EM_NULL = 0, /*< 不变 */
19 EM_STRETCH, /*< 拉伸 */
20 EM_TILE, /*< 平铺 */
21} EXPEND_MODE;
22
23typedef enum FilterLevel
24{
25 kUndef_FilterLevel = 100, // don't use -1 as filter level will pass to render in word and will get 65535
26 kNone_FilterLevel = 0,
27 kLow_FilterLevel,
28 kMedium_FilterLevel,
29 kHigh_FilterLevel
30} FilterLevel;
31
32typedef enum GradientType
33{
34 linear = 0, /*< 线性渐变 */
35 radial, /*< 辐射渐变 */
36 sweep /*< 扫描渐变 */
37} GradientType;
38
39typedef enum RopMode
40{
41 kClear_Mode, //!< [0, 0]
42 kSrc_Mode, //!< [Sa, Sc]
43 kDst_Mode, //!< [Da, Dc]
44 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
45 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
46 kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
47 kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
48 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
49 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
50 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
51 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
52 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
53 kPlus_Mode, //!< [Sa + Da, Sc + Dc]
54 kModulate_Mode, // multiplies all components (= alpha and color)
55
56 // Following blend modes are defined in the CSS Compositing standard:
57 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
58 kScreen_Mode,
59 kLastCoeffMode = kScreen_Mode,
60
61 kOverlay_Mode,
62 kDarken_Mode,
63 kLighten_Mode,
64 kColorDodge_Mode,
65 kColorBurn_Mode,
66 kHardLight_Mode,
67 kSoftLight_Mode,
68 kDifference_Mode,
69 kExclusion_Mode,
70 kMultiply_Mode,
71 kLastSeparableMode = kMultiply_Mode,
72
73 kHue_Mode,
74 kSaturation_Mode,
75 kColor_Mode,
76 kLuminosity_Mode,
77
78 // extend xfermode
79 kSrcCopy = SRCCOPY,
80 kDstInvert = DSTINVERT,
81 kSrcInvert = SRCINVERT,
82 kSrcAnd = SRCAND,
83} RopMode;
84
85typedef struct fPoint
86{
87 float fX, fY;
88} fPoint;
89
90typedef struct fRect
91{
92 float fLeft, fTop, fRight, fBottom;
93} fRect;
94
95typedef enum _BlurStyle
96{
97 kNone_BLurStyle = -1,
98 kNormal_BlurStyle = 0, //!< 模糊内部和外部
99 kSolid_BlurStyle, //!< 固定内部,模糊外部
100 kOuter_BlurStyle, //!< 无内部,模糊外部
101 kInner_BlurStyle, //!< 模糊内部,无外部
102
103 kLastEnum_BlurStyle = kInner_BlurStyle
104} BlurStyle;
105
106typedef enum _BlurFlags
107{
108 kNone_BlurFlag = 0x00,
109 /** The blur layer's radius is not affected by transforms */
110 kIgnoreTransform_BlurFlag = 0x01,
111 /** Use a smoother, higher quality blur algorithm */
112 kHighQuality_BlurFlag = 0x02,
113 /** mask for all blur flags */
114 kAll_BlurFlag = 0x03
115} BlurFlags;
116
117// Interfaces
118#undef INTERFACE
119#define INTERFACE IMaskFilter
120DECLARE_INTERFACE_(IMaskFilter, IObjRef)
121{
122 // Retrieves a pointer to the mask filter
123 STDMETHOD_(void *, GetPtr)(THIS) PURE;
124};
125
126typedef enum _OBJTYPE
127{
128 OT_NULL = 0,
129 OT_PEN,
130 OT_BRUSH,
131 OT_BITMAP,
132 OT_FONT,
133 OT_RGN,
134 OT_PATH,
135} OBJTYPE;
136/**
137 * @struct IRenderObj
138 * @brief Base class for all renderable objects.
139 *
140 * @details All renderable objects use reference counting to manage their lifecycle.
141 */
142#undef INTERFACE
143#define INTERFACE IRenderObj
144DECLARE_INTERFACE_(IRenderObj, IObjRef)
145{
146 /**
147 * @brief Increments the reference count for the object.
148 *
149 * @details This method is used to increase the reference count of the object,
150 * ensuring it remains valid as long as references exist.
151 *
152 * @return long The new reference count after incrementing.
153 */
154 STDMETHOD_(long, AddRef)(THIS) PURE;
155
156 /**
157 * @brief Decrements the reference count for the object.
158 *
159 * @details This method decreases the reference count of the object.
160 * When the count reaches zero, the object may be released.
161 *
162 * @return long The new reference count after decrementing.
163 */
164 STDMETHOD_(long, Release)(THIS) PURE;
165
166 /**
167 * @brief Called when the final release of the object occurs.
168 *
169 * @details This method is invoked when the reference count reaches zero,
170 * allowing for any necessary cleanup before the object is destroyed.
171 */
172 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
173
174 /**
175 * @brief Obtains the render factory that created this rendering object.
176 *
177 * @details Retrieves a pointer to the render factory responsible for creating this object.
178 *
179 * @return IRenderFactory* Pointer to the render factory.
180 */
181 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
182
183 /**
184 * @brief Queries the type of the rendering object.
185 *
186 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
187 *
188 * @return OBJTYPE The type of the rendering object.
189 */
190 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
191};
192
193/**
194 * @enum _BrushType
195 * @brief Enumeration defining types of brushes.
196 *
197 * @details Specifies the different types of brushes available for rendering purposes.
198 */
199typedef enum _BrushType
200{
201 Brush_Color = 0, //!< Color brush.
202 Brush_Bitmap, //!< Bitmap brush.
203 Brush_Shader //!< Shader brush.
204} BrushType;
205
206typedef enum _TileMode
207{
208 /** replicate the edge color if the shader draws outside of its
209 * original bounds
210 */
211 kClamp_TileMode = 0,
212
213 /** repeat the shader's image horizontally and vertically */
214 kRepeat_TileMode,
215
216 /** repeat the shader's image horizontally and vertically, alternating
217 * mirror images so that adjacent images always seam
218 */
219 kMirror_TileMode,
220} TileMode;
221
222/**
223 * @struct IBrushS
224 * @brief Brush object interface.
225 *
226 * @describe
227 */
228#undef INTERFACE
229#define INTERFACE IBrushS
230/**
231 * @struct IBrushS
232 * @brief Brush object interface.
233 *
234 * @details This interface represents a brush used for rendering operations.
235 * It inherits from the IRenderObj interface and provides methods to query
236 * the brush type and manage the brush's lifecycle.
237 */
238DECLARE_INTERFACE_(IBrushS, IRenderObj)
239{
240 /**
241 * @brief Increments the reference count for the object.
242 *
243 * @details This method is used to increase the reference count of the object,
244 * ensuring it remains valid as long as references exist.
245 *
246 * @return long The new reference count after incrementing.
247 */
248 STDMETHOD_(long, AddRef)(THIS) PURE;
249
250 /**
251 * @brief Decrements the reference count for the object.
252 *
253 * @details This method decreases the reference count of the object.
254 * When the count reaches zero, the object may be released.
255 *
256 * @return long The new reference count after decrementing.
257 */
258 STDMETHOD_(long, Release)(THIS) PURE;
259
260 /**
261 * @brief Called when the final release of the object occurs.
262 *
263 * @details This method is invoked when the reference count reaches zero,
264 * allowing for any necessary cleanup before the object is destroyed.
265 */
266 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
267
268 /**
269 * @brief Obtains the render factory that created this rendering object.
270 *
271 * @details Retrieves a pointer to the render factory responsible for creating this object.
272 *
273 * @return IRenderFactory* Pointer to the render factory.
274 */
275 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
276
277 /**
278 * @brief Queries the type of the rendering object.
279 *
280 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
281 *
282 * @return OBJTYPE The type of the rendering object.
283 */
284 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
285
286 /**
287 * @brief Queries the type of the brush.
288 *
289 * @details Returns an enumeration value representing the type of the brush (e.g., color, bitmap, shader).
290 *
291 * @return BrushType The type of the brush.
292 */
293 STDMETHOD_(BrushType, GetBrushType)(CTHIS) SCONST PURE;
294};
295
296/**
297 * @struct IPenS
298 * @brief Pen object interface.
299 *
300 * @details This interface represents a pen used for rendering operations.
301 * It inherits from the IRenderObj interface and provides methods to manage
302 * the pen's properties and lifecycle.
303 */
304#undef INTERFACE
305#define INTERFACE IPenS
306DECLARE_INTERFACE_(IPenS, IRenderObj)
307{
308 /**
309 * @brief Increments the reference count for the object.
310 *
311 * @details This method is used to increase the reference count of the object,
312 * ensuring it remains valid as long as references exist.
313 *
314 * @return long The new reference count after incrementing.
315 */
316 STDMETHOD_(long, AddRef)(THIS) PURE;
317
318 /**
319 * @brief Decrements the reference count for the object.
320 *
321 * @details This method decreases the reference count of the object.
322 * When the count reaches zero, the object may be released.
323 *
324 * @return long The new reference count after decrementing.
325 */
326 STDMETHOD_(long, Release)(THIS) PURE;
327
328 /**
329 * @brief Called when the final release of the object occurs.
330 *
331 * @details This method is invoked when the reference count reaches zero,
332 * allowing for any necessary cleanup before the object is destroyed.
333 */
334 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
335
336 /**
337 * @brief Obtains the render factory that created this rendering object.
338 *
339 * @details Retrieves a pointer to the render factory responsible for creating this object.
340 *
341 * @return IRenderFactory* Pointer to the render factory.
342 */
343 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
344
345 /**
346 * @brief Queries the type of the rendering object.
347 *
348 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
349 *
350 * @return OBJTYPE The type of the rendering object.
351 */
352 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
353
354 /**
355 * @brief Retrieves the width of the pen.
356 *
357 * @details Returns the current width of the pen.
358 *
359 * @return int The width of the pen.
360 */
361 STDMETHOD_(int, GetWidth)(CTHIS) SCONST PURE;
362
363 /**
364 * @brief Sets the width of the pen.
365 *
366 * @details Sets the width of the pen to the specified value.
367 *
368 * @param nWid The new width of the pen.
369 */
370 STDMETHOD_(void, SetWidth)(THIS_ int nWid) PURE;
371
372 /**
373 * @brief Retrieves the style of the pen.
374 *
375 * @details Returns the current style of the pen.
376 *
377 * @return int The style of the pen.
378 */
379 STDMETHOD_(int, GetStyle)(CTHIS) SCONST PURE;
380
381 /**
382 * @brief Sets the style of the pen.
383 *
384 * @details Sets the style of the pen to the specified value.
385 *
386 * @param nStyle The new style of the pen.
387 */
388 STDMETHOD_(void, SetStyle)(THIS_ int nStyle) PURE;
389
390 /**
391 * @brief Retrieves the color of the pen.
392 *
393 * @details Returns the current color of the pen.
394 *
395 * @return COLORREF The color of the pen.
396 */
397 STDMETHOD_(COLORREF, GetColor)(CTHIS) SCONST PURE;
398
399 /**
400 * @brief Sets the color of the pen.
401 *
402 * @details Sets the color of the pen to the specified value.
403 *
404 * @param cr The new color of the pen.
405 */
406 STDMETHOD_(void, SetColor)(THIS_ COLORREF cr) PURE;
407};
408/**
409 * @struct IBitmapS
410 * @brief Bitmap object interface.
411 *
412 * @details This interface represents a bitmap used for rendering operations.
413 * It inherits from the IRenderObj interface and provides methods to manage
414 * the bitmap's properties and lifecycle, including initialization, loading,
415 * saving, and scaling operations.
416 */
417#undef INTERFACE
418#define INTERFACE IBitmapS
419DECLARE_INTERFACE_(IBitmapS, IRenderObj)
420{
421 /**
422 * @brief Increments the reference count for the object.
423 *
424 * @details This method is used to increase the reference count of the object,
425 * ensuring it remains valid as long as references exist.
426 *
427 * @return long The new reference count after incrementing.
428 */
429 STDMETHOD_(long, AddRef)(THIS) PURE;
430
431 /**
432 * @brief Decrements the reference count for the object.
433 *
434 * @details This method decreases the reference count of the object.
435 * When the count reaches zero, the object may be released.
436 *
437 * @return long The new reference count after decrementing.
438 */
439 STDMETHOD_(long, Release)(THIS) PURE;
440
441 /**
442 * @brief Called when the final release of the object occurs.
443 *
444 * @details This method is invoked when the reference count reaches zero,
445 * allowing for any necessary cleanup before the object is destroyed.
446 */
447 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
448
449 /**
450 * @brief Obtains the render factory that created this rendering object.
451 *
452 * @details Retrieves a pointer to the render factory responsible for creating this object.
453 *
454 * @return IRenderFactory* Pointer to the render factory.
455 */
456 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
457
458 /**
459 * @brief Queries the type of the rendering object.
460 *
461 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
462 *
463 * @return OBJTYPE The type of the rendering object.
464 */
465 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
466
467 /**
468 * @brief Initializes the bitmap from 32-bit bitmap data.
469 *
470 * @details Initializes the bitmap with the specified width, height, and pixel data.
471 *
472 * @param nWid The width of the bitmap.
473 * @param nHei The height of the bitmap.
474 * @param pBits Pointer to the 32-bit bitmap data.
475 * @return HRESULT indicating success or failure.
476 */
477 STDMETHOD_(HRESULT, Init)(THIS_ int nWid, int nHei, const LPVOID pBits) PURE;
478
479 /**
480 * @brief Initializes the bitmap from an IImgFrame object.
481 *
482 * @details Initializes the bitmap using the data from the specified IImgFrame object.
483 *
484 * @param pImgFrame Pointer to the IImgFrame object.
485 * @return HRESULT indicating success or failure.
486 */
487 STDMETHOD_(HRESULT, Init2)(THIS_ IImgFrame * pImgFrame) PURE;
488
489 /**
490 * @brief Loads the bitmap from a file.
491 *
492 * @details Loads the bitmap data from the specified file.
493 *
494 * @param pszFileName Path to the file containing the bitmap data.
495 * @return HRESULT indicating success or failure.
496 */
497 STDMETHOD_(HRESULT, LoadFromFile)(THIS_ LPCTSTR pszFileName) PURE;
498
499 /**
500 * @brief Loads the bitmap from memory.
501 *
502 * @details Loads the bitmap data from the specified memory buffer.
503 *
504 * @param pBuf Pointer to the memory buffer containing the bitmap data.
505 * @param szLen Size of the memory buffer.
506 * @return HRESULT indicating success or failure.
507 */
508 STDMETHOD_(HRESULT, LoadFromMemory)(THIS_ LPBYTE pBuf, size_t szLen) PURE;
509
510 /**
511 * @brief Retrieves the width of the bitmap.
512 *
513 * @details Returns the current width of the bitmap.
514 *
515 * @return UINT The width of the bitmap.
516 */
517 STDMETHOD_(UINT, Width)(CTHIS) SCONST PURE;
518
519 /**
520 * @brief Retrieves the height of the bitmap.
521 *
522 * @details Returns the current height of the bitmap.
523 *
524 * @return UINT The height of the bitmap.
525 */
526 STDMETHOD_(UINT, Height)(CTHIS) SCONST PURE;
527
528 /**
529 * @brief Retrieves the size of the bitmap.
530 *
531 * @details Returns the current size of the bitmap as a SIZE structure.
532 *
533 * @return SIZE The size of the bitmap.
534 */
535 STDMETHOD_(SIZE, Size)(CTHIS) SCONST PURE;
536
537 /**
538 * @brief Locks the pixel bits of the bitmap for writing.
539 *
540 * @details Locks the pixel data of the bitmap for writing operations.
541 *
542 * @return LPVOID Pointer to the locked pixel data.
543 */
544 STDMETHOD_(LPVOID, LockPixelBits)(THIS) PURE;
545
546 /**
547 * @brief Unlocks the pixel bits of the bitmap.
548 *
549 * @details Unlocks the pixel data of the bitmap after writing operations.
550 *
551 * @param pBuf Pointer to the locked pixel data.
552 */
553 STDMETHOD_(void, UnlockPixelBits)(THIS_ LPVOID pBuf) PURE;
554
555 /**
556 * @brief Retrieves the pixel bits of the bitmap for reading.
557 *
558 * @details Retrieves the pixel data of the bitmap for reading operations.
559 *
560 * @return const LPVOID Pointer to the pixel data.
561 */
562 STDMETHOD_(const LPVOID, GetPixelBits)(CTHIS) SCONST PURE;
563
564 /**
565 * @brief Clones the bitmap.
566 *
567 * @details Creates a copy of the bitmap.
568 *
569 * @param ppClone Pointer to receive the cloned bitmap object.
570 * @return HRESULT indicating success or failure.
571 */
572 STDMETHOD_(HRESULT, Clone)(CTHIS_ IBitmapS * *ppClone) SCONST PURE;
573
574 /**
575 * @brief Scales the bitmap and clones it.
576 *
577 * @details Scales the bitmap by the specified factor and creates a copy.
578 *
579 * @param pOutput Pointer to receive the scaled bitmap object.
580 * @param nScale Scaling factor.
581 * @param filterLevel Filter level for scaling.
582 * @return HRESULT indicating success or failure.
583 */
584 STDMETHOD_(HRESULT, Scale)
585 (CTHIS_ IBitmapS * *pOutput, int nScale, FilterLevel filterLevel) SCONST PURE;
586
587 /**
588 * @brief Scales the bitmap to specified dimensions and clones it.
589 *
590 * @details Scales the bitmap to the specified width and height and creates a copy.
591 *
592 * @param pOutput Pointer to receive the scaled bitmap object.
593 * @param nWid New width of the bitmap.
594 * @param nHei New height of the bitmap.
595 * @param filterLevel Filter level for scaling.
596 * @return HRESULT indicating success or failure.
597 */
598 STDMETHOD_(HRESULT, Scale2)
599 (CTHIS_ IBitmapS * *pOutput, int nWid, int nHei, FilterLevel filterLevel) SCONST PURE;
600
601 /**
602 * @brief Saves the bitmap to a file.
603 *
604 * @details Saves the bitmap data to the specified file with the given format.
605 *
606 * @param pszFileName Path to the file where the bitmap data will be saved.
607 * @param pFormat Format of the saved file.
608 * @return HRESULT indicating success or failure.
609 */
610 STDMETHOD_(HRESULT, Save)(THIS_ LPCWSTR pszFileName, const LPVOID pFormat) SCONST PURE;
611
612 /**
613 * @brief Saves the bitmap to a file with a specified format.
614 *
615 * @details Saves the bitmap data to the specified file with the given image format.
616 *
617 * @param pszFileName Path to the file where the bitmap data will be saved.
618 * @param imgFmt Image format for saving.
619 * @return HRESULT indicating success or failure.
620 */
621 STDMETHOD_(HRESULT, Save2)(THIS_ LPCWSTR pszFileName, ImgFmt imgFmt) SCONST PURE;
622};
623
624typedef IBitmapS *IBitmapPtr;
625
626/**
627 * @enum _FillStyle
628 * @brief Enumeration defining fill styles.
629 *
630 * @details Specifies the different fill styles available for rendering purposes.
631 */
632typedef enum _FillStyle
633{
634 kFill_Style = 0, //!< Fill only.
635 kStroke_Style = 1, //!< Stroke only.
636 kStrokeAndFill_Style = 2, //!< Stroke and fill.
637} FillStyle;
638
639/**
640 * @struct IFontS
641 * @brief Font object interface.
642 *
643 * @details This interface represents a font used for rendering operations.
644 * It inherits from the IRenderObj interface and provides methods to manage
645 * the font's properties and lifecycle.
646 */
647#undef INTERFACE
648#define INTERFACE IFontS
649DECLARE_INTERFACE_(IFontS, IRenderObj)
650{
651 /**
652 * @brief Increments the reference count for the object.
653 *
654 * @details This method is used to increase the reference count of the object,
655 * ensuring it remains valid as long as references exist.
656 *
657 * @return long The new reference count after incrementing.
658 */
659 STDMETHOD_(long, AddRef)(THIS) PURE;
660
661 /**
662 * @brief Decrements the reference count for the object.
663 *
664 * @details This method decreases the reference count of the object.
665 * When the count reaches zero, the object may be released.
666 *
667 * @return long The new reference count after decrementing.
668 */
669 STDMETHOD_(long, Release)(THIS) PURE;
670
671 /**
672 * @brief Called when the final release of the object occurs.
673 *
674 * @details This method is invoked when the reference count reaches zero,
675 * allowing for any necessary cleanup before the object is destroyed.
676 */
677 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
678
679 /**
680 * @brief Obtains the render factory that created this rendering object.
681 *
682 * @details Retrieves a pointer to the render factory responsible for creating this object.
683 *
684 * @return IRenderFactory* Pointer to the render factory.
685 */
686 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
687
688 /**
689 * @brief Queries the type of the rendering object.
690 *
691 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
692 *
693 * @return OBJTYPE The type of the rendering object.
694 */
695 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
696
697 /**
698 * @brief Retrieves the LOGFONT structure of the font.
699 *
700 * @details Returns a pointer to the LOGFONT structure defining the font attributes.
701 *
702 * @return const LOGFONT* Pointer to the LOGFONT structure.
703 */
704 STDMETHOD_(const LOGFONT *, LogFont)(CTHIS) SCONST PURE;
705
706 /**
707 * @brief Retrieves the family name of the font.
708 *
709 * @details Returns the family name of the font.
710 *
711 * @return LPCTSTR The family name of the font.
712 */
713 STDMETHOD_(LPCTSTR, FamilyName)(CTHIS) SCONST PURE;
714
715 /**
716 * @brief Retrieves the text size of the font.
717 *
718 * @details Returns the text size of the font.
719 *
720 * @return int The text size of the font.
721 */
722 STDMETHOD_(int, TextSize)(CTHIS) SCONST PURE;
723
724 /**
725 * @brief Checks if the font is bold.
726 *
727 * @details Returns a boolean indicating whether the font is bold.
728 *
729 * @return BOOL TRUE if the font is bold, FALSE otherwise.
730 */
731 STDMETHOD_(BOOL, IsBold)(CTHIS) SCONST PURE;
732
733 /**
734 * @brief Checks if the font has an underline.
735 *
736 * @details Returns a boolean indicating whether the font has an underline.
737 *
738 * @return BOOL TRUE if the font has an underline, FALSE otherwise.
739 */
740 STDMETHOD_(BOOL, IsUnderline)(CTHIS) SCONST PURE;
741
742 /**
743 * @brief Checks if the font is italic.
744 *
745 * @details Returns a boolean indicating whether the font is italic.
746 *
747 * @return BOOL TRUE if the font is italic, FALSE otherwise.
748 */
749 STDMETHOD_(BOOL, IsItalic)(CTHIS) SCONST PURE;
750
751 /**
752 * @brief Checks if the font has a strikeout.
753 *
754 * @details Returns a boolean indicating whether the font has a strikeout.
755 *
756 * @return BOOL TRUE if the font has a strikeout, FALSE otherwise.
757 */
758 STDMETHOD_(BOOL, IsStrikeOut)(CTHIS) SCONST PURE;
759
760 /**
761 * @brief Updates the font properties.
762 *
763 * @details Updates the font properties using the specified LOGFONT structure.
764 *
765 * @param pLogFont Pointer to the LOGFONT structure defining the new font attributes.
766 * @return BOOL TRUE if the update was successful, FALSE otherwise.
767 */
768 STDMETHOD_(BOOL, UpdateFont)(THIS_ const LOGFONT *pLogFont) PURE;
769
770 /**
771 * @brief Sets properties from an XML node.
772 *
773 * @details Sets the font properties based on the attributes specified in the XML node.
774 *
775 * @param pXmlNode Pointer to the XML node containing the font properties.
776 */
777 STDMETHOD_(void, SetProp)(THIS_ IXmlNode * pXmlNode) PURE;
778};
779
780/**
781 * @struct IRegionS
782 * @brief Region object interface.
783 *
784 * @details This interface represents a region used for clipping and other rendering operations.
785 * It inherits from the IRenderObj interface and provides methods to manage
786 * the region's properties and lifecycle, including combining shapes, checking containment,
787 * and offsetting the region.
788 */
789#undef INTERFACE
790#define INTERFACE IRegionS
791DECLARE_INTERFACE_(IRegionS, IRenderObj)
792{
793 /**
794 * @brief Increments the reference count for the object.
795 *
796 * @details This method is used to increase the reference count of the object,
797 * ensuring it remains valid as long as references exist.
798 *
799 * @return long The new reference count after incrementing.
800 */
801 STDMETHOD_(long, AddRef)(THIS) PURE;
802
803 /**
804 * @brief Decrements the reference count for the object.
805 *
806 * @details This method decreases the reference count of the object.
807 * When the count reaches zero, the object may be released.
808 *
809 * @return long The new reference count after decrementing.
810 */
811 STDMETHOD_(long, Release)(THIS) PURE;
812
813 /**
814 * @brief Called when the final release of the object occurs.
815 *
816 * @details This method is invoked when the reference count reaches zero,
817 * allowing for any necessary cleanup before the object is destroyed.
818 */
819 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
820
821 /**
822 * @brief Obtains the render factory that created this rendering object.
823 *
824 * @details Retrieves a pointer to the render factory responsible for creating this object.
825 *
826 * @return IRenderFactory* Pointer to the render factory.
827 */
828 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
829
830 /**
831 * @brief Queries the type of the rendering object.
832 *
833 * @details Returns an enumeration value representing the type of the object (e.g., brush, pen, bitmap).
834 *
835 * @return OBJTYPE The type of the rendering object.
836 */
837 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
838
839 /**
840 * @brief Combines a rectangle with the region.
841 *
842 * @details Combines the specified rectangle with the current region using the specified mode.
843 *
844 * @param lprect Pointer to the rectangle to combine.
845 * @param nCombineMode Mode for combining the rectangle with the region.
846 */
847 STDMETHOD_(void, CombineRect)(THIS_ LPCRECT lprect, int nCombineMode) PURE;
848
849 /**
850 * @brief Combines another region with the current region.
851 *
852 * @details Combines the specified region with the current region using the specified mode.
853 *
854 * @param pRgnSrc Pointer to the region to combine.
855 * @param nCombineMode Mode for combining the regions.
856 */
857 STDMETHOD_(void, CombineRgn)(THIS_ const IRegionS *pRgnSrc, int nCombineMode) PURE;
858
859 /**
860 * @brief Combines a rounded rectangle with the region.
861 *
862 * @details Combines the specified rounded rectangle with the current region using the specified mode.
863 *
864 * @param lprect Pointer to the rectangle defining the bounds of the rounded rectangle.
865 * @param ptConner Point defining the corner radii of the rounded rectangle.
866 * @param nCombineMode Mode for combining the rounded rectangle with the region.
867 */
868 STDMETHOD_(void, CombineRoundRect)(THIS_ LPCRECT lprect, POINT ptConner, int nCombineMode) PURE;
869
870 /**
871 * @brief Combines an ellipse with the region.
872 *
873 * @details Combines the specified ellipse with the current region using the specified mode.
874 *
875 * @param lprect Pointer to the rectangle defining the bounds of the ellipse.
876 * @param nCombineMode Mode for combining the ellipse with the region.
877 */
878 STDMETHOD_(void, CombineEllipse)(THIS_ LPCRECT lprect, int nCombineMode) PURE;
879
880 /**
881 * @brief Combines a polygon with the region.
882 *
883 * @details Combines the specified polygon with the current region using the specified mode.
884 *
885 * @param pts Array of points defining the polygon.
886 * @param count Number of points in the polygon.
887 * @param nPolygonMode Mode for filling the polygon.
888 * @param nCombineMode Mode for combining the polygon with the region.
889 */
890 STDMETHOD_(void, CombinePolygon)(THIS_ const POINT *pts, int count, int nPolygonMode, int nCombineMode) PURE;
891
892 /**
893 * @brief Checks if a point is inside the region.
894 *
895 * @details Determines whether the specified point lies within the region.
896 *
897 * @param pt Point to check.
898 * @return BOOL TRUE if the point is inside the region, FALSE otherwise.
899 */
900 STDMETHOD_(BOOL, PtInRegion)(CTHIS_ POINT pt) SCONST PURE;
901
902 /**
903 * @brief Checks if a rectangle intersects with the region.
904 *
905 * @details Determines whether the specified rectangle intersects with the region.
906 *
907 * @param lprect Pointer to the rectangle to check.
908 * @return BOOL TRUE if the rectangle intersects with the region, FALSE otherwise.
909 */
910 STDMETHOD_(BOOL, RectInRegion)(CTHIS_ LPCRECT lprect) SCONST PURE;
911
912 /**
913 * @brief Retrieves the bounding rectangle of the region.
914 *
915 * @details Gets the smallest rectangle that completely encloses the region.
916 *
917 * @param lprect Pointer to the rectangle to receive the bounds.
918 */
919 STDMETHOD_(void, GetRgnBox)(CTHIS_ LPRECT lprect) SCONST PURE;
920
921 /**
922 * @brief Checks if the region is empty.
923 *
924 * @details Determines whether the region contains no area.
925 *
926 * @return BOOL TRUE if the region is empty, FALSE otherwise.
927 */
928 STDMETHOD_(BOOL, IsEmpty)(CTHIS) SCONST PURE;
929
930 /**
931 * @brief Offsets the region by a specified amount.
932 *
933 * @details Moves the region by the specified offset.
934 *
935 * @param pt Offset to apply to the region.
936 */
937 STDMETHOD_(void, Offset)(THIS_ POINT pt) PURE;
938
939 /**
940 * @brief Clears the region.
941 *
942 * @details Empties the region, making it contain no area.
943 */
944 STDMETHOD_(void, Clear)(THIS) PURE;
945};
946
947/**
948 * @enum _xFormIndex
949 * @brief Enumeration defining indices for transformation matrix elements.
950 *
951 * @details Specifies the indices for accessing elements of a 3x3 transformation matrix.
952 */
953typedef enum _xFormIndex
954{
955 kMScaleX = 0, //!< Index for the X-axis scaling factor.
956 kMSkewX, //!< Index for the X-axis skew factor.
957 kMTransX, //!< Index for the X-axis translation factor.
958 kMSkewY, //!< Index for the Y-axis skew factor.
959 kMScaleY, //!< Index for the Y-axis scaling factor.
960 kMTransY, //!< Index for the Y-axis translation factor.
961 kMPersp0, //!< Index for the first perspective factor.
962 kMPersp1, //!< Index for the second perspective factor.
963 kMPersp2, //!< Index for the third perspective factor.
964 kMCount, //!< Total number of elements in the transformation matrix.
965} xFormIndex;
966
967/**
968 * @struct _IxForm
969 * @brief Structure representing a 3x3 transformation matrix.
970 *
971 * @details Contains the elements of a 3x3 transformation matrix used for transformations.
972 */
973typedef struct _IxForm
974{
975 float fMat[kMCount]; //!< Array of floats representing the matrix elements.
976} IxForm;
977
978/**
979 * @enum _FillType
980 * @brief Enumeration defining fill types for path objects.
981 *
982 * @details Specifies the different fill types available for determining the "inside" of a path.
983 */
984typedef enum _FillType
985{
986 /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings. */
987 kWinding_FillType,
988
989 /** Specifies that "inside" is computed by an odd number of edge crossings. */
990 kEvenOdd_FillType,
991
992 /** Same as Winding, but draws outside of the path rather than inside. */
993 kInverseWinding_FillType,
994
995 /** Same as EvenOdd, but draws outside of the path rather than inside. */
996 kInverseEvenOdd_FillType
997} FillType;
998
999/**
1000 * @enum _Direction
1001 * @brief Enumeration defining contour directions for path objects.
1002 *
1003 * @details Specifies the direction in which closed contours are added to a path.
1004 */
1005typedef enum _Direction
1006{
1007 /** Direction either has not been or could not be computed. */
1008 kUnknown_Direction,
1009
1010 /** Clockwise direction for adding closed contours. */
1011 kCW_Direction,
1012
1013 /** Counter-clockwise direction for adding closed contours. */
1014 kCCW_Direction,
1015} Direction;
1016
1017/**
1018 * @struct IPath
1019 * @brief Interface for path objects.
1020 *
1021 * @describe
1022 */
1023#undef INTERFACE
1024#define INTERFACE IPathS
1025DECLARE_INTERFACE_(IPathS, IRenderObj)
1026{
1027 /**
1028 * @brief Increments the reference count for the object.
1029 *
1030 * @details This method is used to increase the reference count of the object,
1031 * ensuring it remains valid as long as references exist.
1032 *
1033 * @return long The new reference count after incrementing.
1034 */
1035 STDMETHOD_(long, AddRef)(THIS) PURE;
1036
1037 /**
1038 * @brief Decrements the reference count for the object.
1039 *
1040 * @details This method decreases the reference count of the object.
1041 * When the count reaches zero, the object may be released.
1042 *
1043 * @return long The new reference count after decrementing.
1044 */
1045 STDMETHOD_(long, Release)(THIS) PURE;
1046
1047 /**
1048 * @brief Called when the final release of the object occurs.
1049 *
1050 * @details This method is invoked when the reference count reaches zero,
1051 * allowing for any necessary cleanup before the object is destroyed.
1052 */
1053 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
1054
1055 /**
1056 * GetRenderFactory
1057 * @brief Obtain the factory that created this render object.
1058 * @return IRenderFactory * -- The factory.
1059 */
1060 STDMETHOD_(IRenderFactory *, GetRenderFactory)(CTHIS) SCONST PURE;
1061
1062 /**
1063 * ObjectType
1064 * @brief Query the type of the object.
1065 * @return const UINT -- The object type.
1066 */
1067 STDMETHOD_(OBJTYPE, ObjectType)(CTHIS) SCONST PURE;
1068
1069 /**
1070 * getFillType
1071 * @brief Return the path's fill type, which defines how "inside" is computed.
1072 * @return FillType -- The path's fill type.
1073 */
1074 STDMETHOD_(FillType, getFillType)(CTHIS) SCONST PURE;
1075
1076 /**
1077 * setFillType
1078 * @brief Set the path's fill type, which defines how "inside" is computed.
1079 * @param ft The new fill type for this path.
1080 */
1081 STDMETHOD_(void, setFillType)(THIS_ FillType ft) PURE;
1082
1083 /**
1084 * reset
1085 * @brief Clear any lines and curves from the path, making it empty. This frees up internal storage.
1086 */
1087 STDMETHOD_(void, reset)(THIS) PURE;
1088
1089 /**
1090 * isEmpty
1091 * @brief Check if the path is empty (contains no lines or curves).
1092 * @return BOOL -- TRUE if the path is empty.
1093 */
1094 STDMETHOD_(BOOL, isEmpty)(CTHIS) SCONST PURE;
1095
1096 /**
1097 * getBounds
1098 * @brief Return the bounds of the path's points.
1099 * @param prc The rectangle to receive the bounds.
1100 */
1101 STDMETHOD_(void, getBounds)(CTHIS_ LPRECT prc) SCONST PURE;
1102
1103 // Construction methods
1104
1105 /**
1106 * moveTo
1107 * @brief Set the beginning of the next contour to the point (x,y).
1108 * @param x The x-coordinate of the start of a new contour.
1109 * @param y The y-coordinate of the start of a new contour.
1110 */
1111 STDMETHOD_(void, moveTo)(THIS_ float x, float y) PURE;
1112
1113 /**
1114 * rMoveTo
1115 * @brief Set the beginning of the next contour relative to the last point on the previous contour.
1116 * @param dx The amount to add to the x-coordinate of the end of the previous contour.
1117 * @param dy The amount to add to the y-coordinate of the end of the previous contour.
1118 */
1119 STDMETHOD_(void, rMoveTo)(THIS_ float dx, float dy) PURE;
1120
1121 /**
1122 * lineTo
1123 * @brief Add a line from the last point to the specified point (x,y).
1124 * @param x The x-coordinate of the end of a line.
1125 * @param y The y-coordinate of the end of a line.
1126 */
1127 STDMETHOD_(void, lineTo)(THIS_ float x, float y) PURE;
1128
1129 /**
1130 * rLineTo
1131 * @brief Add a line from the last point, but the coordinates are relative to the last point.
1132 * @param dx The amount to add to the x-coordinate of the previous point.
1133 * @param dy The amount to add to the y-coordinate of the previous point.
1134 */
1135 STDMETHOD_(void, rLineTo)(THIS_ float dx, float dy) PURE;
1136
1137 /**
1138 * quadTo
1139 * @brief Add a quadratic Bezier curve from the last point, approaching control point (x1,y1), and ending at (x2,y2).
1140 * @param x1 The x-coordinate of the control point.
1141 * @param y1 The y-coordinate of the control point.
1142 * @param x2 The x-coordinate of the end point.
1143 * @param y2 The y-coordinate of the end point.
1144 */
1145 STDMETHOD_(void, quadTo)(THIS_ float x1, float y1, float x2, float y2) PURE;
1146
1147 /**
1148 * rQuadTo
1149 * @brief Add a quadratic Bezier curve, but the coordinates are relative to the last point.
1150 * @param dx1 The amount to add to the x-coordinate of the last point to specify the control point.
1151 * @param dy1 The amount to add to the y-coordinate of the last point to specify the control point.
1152 * @param dx2 The amount to add to the x-coordinate of the last point to specify the end point.
1153 * @param dy2 The amount to add to the y-coordinate of the last point to specify the end point.
1154 */
1155 STDMETHOD_(void, rQuadTo)(THIS_ float dx1, float dy1, float dx2, float dy2) PURE;
1156
1157 /**
1158 * conicTo
1159 * @brief Add a conic Bezier curve from the last point, approaching control point (x1,y1), and ending at (x2,y2).
1160 * @param x1 The x-coordinate of the control point.
1161 * @param y1 The y-coordinate of the control point.
1162 * @param x2 The x-coordinate of the end point.
1163 * @param y2 The y-coordinate of the end point.
1164 * @param w The weight of the control point.
1165 */
1166 STDMETHOD_(void, conicTo)(THIS_ float x1, float y1, float x2, float y2, float w) PURE;
1167
1168 /**
1169 * rConicTo
1170 * @brief Add a conic Bezier curve, but the coordinates are relative to the last point.
1171 * @param dx1 The amount to add to the x-coordinate of the last point to specify the control point.
1172 * @param dy1 The amount to add to the y-coordinate of the last point to specify the control point.
1173 * @param dx2 The amount to add to the x-coordinate of the last point to specify the end point.
1174 * @param dy2 The amount to add to the y-coordinate of the last point to specify the end point.
1175 * @param w The weight of the control point.
1176 */
1177 STDMETHOD_(void, rConicTo)(THIS_ float dx1, float dy1, float dx2, float dy2, float w) PURE;
1178
1179 /**
1180 * cubicTo
1181 * @brief Add a cubic Bezier curve from the last point, approaching control points (x1,y1) and (x2,y2), and ending at (x3,y3).
1182 * @param x1 The x-coordinate of the 1st control point.
1183 * @param y1 The y-coordinate of the 1st control point.
1184 * @param x2 The x-coordinate of the 2nd control point.
1185 * @param y2 The y-coordinate of the 2nd control point.
1186 * @param x3 The x-coordinate of the end point.
1187 * @param y3 The y-coordinate of the end point.
1188 */
1189 STDMETHOD_(void, cubicTo)(THIS_ float x1, float y1, float x2, float y2, float x3, float y3) PURE;
1190
1191 /**
1192 * rCubicTo
1193 * @brief Add a cubic Bezier curve, but the coordinates are relative to the last point.
1194 * @param x1 The x-coordinate of the 1st control point.
1195 * @param y1 The y-coordinate of the 1st control point.
1196 * @param x2 The x-coordinate of the 2nd control point.
1197 * @param y2 The y-coordinate of the 2nd control point.
1198 * @param x3 The x-coordinate of the end point.
1199 * @param y3 The y-coordinate of the end point.
1200 */
1201 STDMETHOD_(void, rCubicTo)(THIS_ float x1, float y1, float x2, float y2, float x3, float y3) PURE;
1202
1203 /**
1204 * addRect
1205 * @brief Add a closed rectangle contour to the path.
1206 * @param rect The rectangle to add as a closed contour.
1207 * @param dir The direction to wind the rectangle's contour. Cannot be kUnknown_Direction.
1208 */
1209 STDMETHOD_(void, addRect)(THIS_ const RECT *rect, Direction dir DEF_VAL(kCW_Direction)) PURE;
1210
1211 /**
1212 * addRect2
1213 * @brief Add a closed rectangle contour to the path.
1214 * @param left The left side of the rectangle.
1215 * @param top The top of the rectangle.
1216 * @param right The right side of the rectangle.
1217 * @param bottom The bottom of the rectangle.
1218 * @param dir The direction to wind the rectangle's contour. Cannot be kUnknown_Direction.
1219 */
1220 STDMETHOD_(void, addRect2)(THIS_ float left, float top, float right, float bottom, Direction dir DEF_VAL(kCW_Direction)) PURE;
1221
1222 /**
1223 * addOval
1224 * @brief Add a closed oval contour to the path.
1225 * @param oval The bounding oval to add as a closed contour.
1226 * @param dir The direction to wind the oval's contour. Cannot be kUnknown_Direction.
1227 */
1228 STDMETHOD_(void, addOval)(THIS_ const RECT *oval, Direction dir DEF_VAL(kCW_Direction)) PURE;
1229
1230 /**
1231 * addOval2
1232 * @brief Add a closed oval contour to the path.
1233 * @param left The left side of the oval.
1234 * @param top The top of the oval.
1235 * @param right The right side of the oval.
1236 * @param bottom The bottom of the oval.
1237 * @param dir The direction to wind the oval's contour. Cannot be kUnknown_Direction.
1238 */
1239 STDMETHOD_(void, addOval2)(THIS_ float left, float top, float right, float bottom, Direction dir DEF_VAL(kCW_Direction)) PURE;
1240
1241 /**
1242 * addCircle
1243 * @brief Add a closed circle contour to the path.
1244 * @param x The x-coordinate of the center of the circle.
1245 * @param y The y-coordinate of the center of the circle.
1246 * @param radius The radius of the circle.
1247 * @param dir The direction to wind the circle's contour. Cannot be kUnknown_Direction.
1248 */
1249 STDMETHOD_(void, addCircle)(THIS_ float x, float y, float radius, Direction dir DEF_VAL(kCW_Direction)) PURE;
1250
1251 /**
1252 * addArc
1253 * @brief Add the specified arc to the path as a new contour.
1254 * @param oval The bounds of the oval used to define the size of the arc.
1255 * @param startAngle The starting angle (in degrees) where the arc begins.
1256 * @param sweepAngle The sweep angle (in degrees) measured clockwise.
1257 */
1258 STDMETHOD_(void, addArc)(THIS_ const RECT *oval, float startAngle, float sweepAngle) PURE;
1259
1260 /**
1261 * addArc2
1262 * @brief Add the specified arc to the path as a new contour.
1263 * @param left The left side of the oval.
1264 * @param top The top of the oval.
1265 * @param right The right side of the oval.
1266 * @param bottom The bottom of the oval.
1267 * @param startAngle The starting angle (in degrees) where the arc begins.
1268 * @param sweepAngle The sweep angle (in degrees) measured clockwise.
1269 */
1270 STDMETHOD_(void, addArc2)(THIS_ float left, float top, float right, float bottom, float startAngle, float sweepAngle) PURE;
1271
1272 /**
1273 * addRoundRect
1274 * @brief Add a closed round-rectangle contour to the path.
1275 * @param rect The bounds of the round-rectangle.
1276 * @param rx The x-radius of the rounded corners.
1277 * @param ry The y-radius of the rounded corners.
1278 * @param dir The direction to wind the rectangle's contour. Cannot be kUnknown_Direction.
1279 */
1280 STDMETHOD_(void, addRoundRect)(THIS_ const RECT *rect, float rx, float ry, Direction dir DEF_VAL(kCW_Direction)) PURE;
1281
1282 /**
1283 * addRoundRect2
1284 * @brief Add a closed round-rectangle contour to the path.
1285 * @param left The left side of the round-rectangle.
1286 * @param top The top of the round-rectangle.
1287 * @param right The right side of the round-rectangle.
1288 * @param bottom The bottom of the round-rectangle.
1289 * @param rx The x-radius of the rounded corners.
1290 * @param ry The y-radius of the rounded corners.
1291 * @param dir The direction to wind the rectangle's contour. Cannot be kUnknown_Direction.
1292 */
1293 STDMETHOD_(void, addRoundRect2)(THIS_ float left, float top, float right, float bottom, float rx, float ry, Direction dir DEF_VAL(kCW_Direction)) PURE;
1294
1295 /**
1296 * addPoly
1297 * @brief Add a new contour made of just lines.
1298 * @param pts The array of points defining the polygon.
1299 * @param count The number of points in the array.
1300 * @param close Whether to close the polygon.
1301 */
1302 STDMETHOD_(void, addPoly)(THIS_ const POINT pts[], int count, BOOL close) PURE;
1303
1304 /**
1305 * offset
1306 * @brief Offset the path by (dx,dy).
1307 * @param dx The amount in the X direction to offset the entire path.
1308 * @param dy The amount in the Y direction to offset the entire path.
1309 */
1310 STDMETHOD_(void, offset)(THIS_ float dx, float dy) PURE;
1311
1312 /**
1313 * transform
1314 * @brief Transform the points in this path by the given matrix.
1315 * @param matrix The transformation matrix to apply to the path.
1316 */
1317 STDMETHOD_(void, transform)(THIS_ const IxForm *matrix) PURE;
1318
1319 /**
1320 * getLastPt
1321 * @brief Return the last point on the path.
1322 * @param lastPt The structure to receive the last point.
1323 * @return BOOL -- TRUE if there are points, FALSE otherwise.
1324 */
1325 STDMETHOD_(BOOL, getLastPt)(CTHIS_ fPoint * lastPt) SCONST PURE;
1326
1327 /**
1328 * addString
1329 * @brief Add a string to the path.
1330 * @param pszText The string to add.
1331 * @param nLen The length of the string.
1332 * @param x The x-coordinate of the starting position.
1333 * @param y The y-coordinate of the starting position.
1334 * @param pFont The font to use for the text.
1335 */
1336 STDMETHOD_(void, addString)(THIS_ LPCTSTR pszText, int nLen, float x, float y, const IFontS *pFont) PURE;
1337
1338 /**
1339 * clone
1340 * @brief Clone the current path.
1341 * @return IPathS* -- A pointer to the cloned path.
1342 */
1343 STDMETHOD_(IPathS *, clone)(CTHIS) SCONST PURE;
1344
1345 /**
1346 * beginFigure
1347 * @brief Begin a new figure in the path.
1348 * @param x The x-coordinate of the starting point.
1349 * @param y The y-coordinate of the starting point.
1350 * @param bFill Whether to fill the figure. Default is TRUE.
1351 * @return BOOL -- TRUE if successful.
1352 */
1353 STDMETHOD_(BOOL, beginFigure)(THIS_ float x, float y, BOOL bFill DEF_VAL(TRUE)) PURE;
1354
1355 /**
1356 * endFigure
1357 * @brief End the current figure in the path.
1358 * @param bClose Whether to close the figure.
1359 * @return BOOL -- TRUE if successful.
1360 */
1361 STDMETHOD_(BOOL, endFigure)(THIS_ BOOL bClose) PURE;
1362
1363 /**
1364 * getLength
1365 * @brief Get the length of the path.
1366 * @return float -- The length of the path.
1367 */
1368 STDMETHOD_(float, getLength)(CTHIS) SCONST PURE;
1369
1370 /**
1371 * getPosTan
1372 * @brief Get the position and tangent at a given distance along the path.
1373 * @param distance The distance along the path.
1374 * @param pos The structure to receive the position.
1375 * @param vec The structure to receive the tangent vector.
1376 * @return BOOL -- TRUE if successful.
1377 */
1378 STDMETHOD_(BOOL, getPosTan)(CTHIS_ float distance, fPoint *pos, fPoint *vec) SCONST PURE;
1379
1380 /**
1381 * close
1382 * @brief Close the current path to stop editing.
1383 */
1384 STDMETHOD_(void, close)(THIS) PURE;
1385
1386 /**
1387 * hitTest
1388 * @brief Test if a point hits the path.
1389 * @param x The x-coordinate of the point.
1390 * @param y The y-coordinate of the point.
1391 * @return BOOL -- TRUE if the point hits the path.
1392 */
1393 STDMETHOD_(BOOL, hitTest)(CTHIS_ float x, float y) SCONST PURE;
1394
1395 /**
1396 * hitTestStroke
1397 * @brief Test if a point hits the stroked path.
1398 * @param x The x-coordinate of the point.
1399 * @param y The y-coordinate of the point.
1400 * @param strokeSize The stroke size.
1401 * @return BOOL -- TRUE if the point hits the stroked path.
1402 */
1403 STDMETHOD_(BOOL, hitTestStroke)(CTHIS_ float x, float y, float strokeSize) SCONST PURE;
1404};
1405
1406/**
1407 * @struct _GradientInfo
1408 * @brief Structure to define gradient information for creating gradient brushes.
1409 */
1410typedef struct _GradientInfo
1411{
1412 GradientType type;
1413 union {
1414 float angle; // for linear
1415 struct
1416 {
1417 float radius; // Radius for radial gradient.
1418 float centerX; // X-coordinate of the center (0.0 -> 1.0, 0.5 is center).
1419 float centerY; // Y-coordinate of the center (0.0 -> 1.0, 0.5 is center).
1420 } radial; // Parameters for radial gradient.
1421 struct
1422 {
1423 BOOL bFullArc; // True if the sweep gradient is rendered for a full circle.
1424 float centerX; // X-coordinate of the center (0.0 -> 1.0, 0.5 is center).
1425 float centerY; // Y-coordinate of the center (0.0 -> 1.0, 0.5 is center).
1426 } sweep; // Parameters for sweep gradient.
1427 };
1428} GradientInfo;
1429
1430/**
1431 * @struct IRenderTarget
1432 * @brief Interface for rendering target objects.
1433 *
1434 * @details This interface provides methods for drawing, clipping, transforming, and managing rendering resources
1435 * such as pens, brushes, and bitmaps. It also supports advanced operations like anti-aliasing, blending, and path-based drawing.
1436 */
1437#undef INTERFACE
1438#define INTERFACE IRenderTarget
1439DECLARE_INTERFACE_(IRenderTarget, IObjRef)
1440{
1441 /**
1442 * @brief Increment the reference count.
1443 * @return New reference count.
1444 */
1445 STDMETHOD_(long, AddRef)(THIS) PURE;
1446
1447 /**
1448 * @brief Decrement the reference count and destroy the object if the count reaches zero.
1449 * @return New reference count.
1450 */
1451 STDMETHOD_(long, Release)(THIS) PURE;
1452
1453 /**
1454 * @brief Called when the reference count reaches zero.
1455 */
1456 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
1457
1458 /**
1459 * @brief Start a drawing operation.
1460 */
1461 STDMETHOD_(void, BeginDraw)(THIS) PURE;
1462
1463 /**
1464 * @brief End a drawing operation.
1465 */
1466 STDMETHOD_(void, EndDraw)(THIS) PURE;
1467
1468 /**
1469 * @brief Check if the render target is offscreen.
1470 * @return TRUE if offscreen, FALSE otherwise.
1471 */
1472 STDMETHOD_(BOOL, IsOffscreen)(CTHIS) SCONST PURE;
1473
1474 /**
1475 * @brief Create a pen object.
1476 * @param iStyle Pen style.
1477 * @param cr Pen color.
1478 * @param cWidth Pen width.
1479 * @param ppPen Pointer to the created pen object.
1480 * @return HRESULT indicating success or failure.
1481 */
1482 STDMETHOD_(HRESULT, CreatePen)(THIS_ int iStyle, COLORREF cr, int cWidth, IPenS **ppPen) PURE;
1483
1484 /**
1485 * @brief Create a solid color brush.
1486 * @param cr Brush color.
1487 * @param ppBrush Pointer to the created brush object.
1488 * @return HRESULT indicating success or failure.
1489 */
1490 STDMETHOD_(HRESULT, CreateSolidColorBrush)(THIS_ COLORREF cr, IBrushS * *ppBrush) PURE;
1491
1492 /**
1493 * @brief Create a bitmap brush.
1494 * @param pBmp Bitmap object.
1495 * @param xtm X-axis tile mode.
1496 * @param ytm Y-axis tile mode.
1497 * @param ppBrush Pointer to the created brush object.
1498 * @return HRESULT indicating success or failure.
1499 */
1500 STDMETHOD_(HRESULT, CreateBitmapBrush)(THIS_ IBitmapS * pBmp, TileMode xtm, TileMode ytm, IBrushS * *ppBrush) PURE;
1501
1502 /**
1503 * @brief Create a gradient brush.
1504 * @param pGradients Array of gradient items.
1505 * @param nCount Number of gradient items.
1506 * @param info Gradient information.
1507 * @param byAlpha Alpha value for the gradient.
1508 * @param tileMode Tile mode for the gradient.
1509 * @param ppBrush Pointer to the created brush object.
1510 * @return HRESULT indicating success or failure.
1511 */
1512 STDMETHOD_(HRESULT, CreateGradientBrush)(THIS_ const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha, TileMode tileMode, IBrushS **ppBrush) PURE;
1513
1514 /**
1515 * @brief Create a region object.
1516 * @param ppRegion Pointer to the created region object.
1517 * @return HRESULT indicating success or failure.
1518 */
1519 STDMETHOD_(HRESULT, CreateRegion)(THIS_ IRegionS * *ppRegion) PURE;
1520
1521 /**
1522 * @brief Resize the render target.
1523 * @param sz New size.
1524 * @return HRESULT indicating success or failure.
1525 */
1526 STDMETHOD_(HRESULT, Resize)(THIS_ SIZE sz) PURE;
1527
1528 /**
1529 * @brief Offset the viewport origin.
1530 * @param xOff Offset in the X direction.
1531 * @param yOff Offset in the Y direction.
1532 * @param lpPoint Optional pointer to receive the previous viewport origin.
1533 * @return HRESULT indicating success or failure.
1534 */
1535 STDMETHOD_(HRESULT, OffsetViewportOrg)(THIS_ int xOff, int yOff, LPPOINT lpPoint DEF_VAL(NULL)) PURE;
1536
1537 /**
1538 * @brief Get the current viewport origin.
1539 * @param lpPoint Pointer to receive the viewport origin.
1540 * @return HRESULT indicating success or failure.
1541 */
1542 STDMETHOD_(HRESULT, GetViewportOrg)(THIS_ LPPOINT lpPoint) PURE;
1543
1544 /**
1545 * @brief Set the viewport origin.
1546 * @param pt New viewport origin.
1547 * @return HRESULT indicating success or failure.
1548 */
1549 STDMETHOD_(HRESULT, SetViewportOrg)(THIS_ POINT pt) PURE;
1550
1551 /**
1552 * @brief Push a rectangular clip region.
1553 * @param pRect Rectangle defining the clip region.
1554 * @param mode Region operation mode.
1555 * @return HRESULT indicating success or failure.
1556 */
1557 STDMETHOD_(HRESULT, PushClipRect)(THIS_ LPCRECT pRect, UINT mode DEF_VAL(RGN_AND)) PURE;
1558
1559 /**
1560 * @brief Push a region-based clip.
1561 * @param pRegion Region object.
1562 * @param mode Region operation mode.
1563 * @return HRESULT indicating success or failure.
1564 */
1565 STDMETHOD_(HRESULT, PushClipRegion)(THIS_ IRegionS * pRegion, UINT mode DEF_VAL(RGN_AND)) PURE;
1566
1567 /**
1568 * @brief Pop the last clip region from the stack.
1569 * @return HRESULT indicating success or failure.
1570 */
1571 STDMETHOD_(HRESULT, PopClip)(THIS) PURE;
1572
1573 /**
1574 * @brief Exclude a rectangle from the current clip region.
1575 * @param pRc Rectangle to exclude.
1576 * @return HRESULT indicating success or failure.
1577 */
1578 STDMETHOD_(HRESULT, ExcludeClipRect)(THIS_ LPCRECT pRc) PURE;
1579
1580 /**
1581 * @brief Save the current clip state.
1582 * @param pnState Pointer to receive the clip state identifier.
1583 * @return HRESULT indicating success or failure.
1584 */
1585 STDMETHOD_(HRESULT, SaveClip)(THIS_ int *pnState) PURE;
1586
1587 /**
1588 * @brief Restore a previously saved clip state.
1589 * @param nState Clip state identifier. If -1, restores the last saved state.
1590 * @return HRESULT indicating success or failure.
1591 */
1592 STDMETHOD_(HRESULT, RestoreClip)(THIS_ int nState DEF_VAL(-1)) PURE;
1593
1594 /**
1595 * @brief Get the current clip region.
1596 * @param ppRegion Pointer to receive the clip region object.
1597 * @return HRESULT indicating success or failure.
1598 */
1599 STDMETHOD_(HRESULT, GetClipRegion)(THIS_ IRegionS * *ppRegion) PURE;
1600
1601 /**
1602 * @brief Get the bounding box of the current clip region.
1603 * @param prc Pointer to receive the bounding box rectangle.
1604 * @return HRESULT indicating success or failure.
1605 */
1606 STDMETHOD_(HRESULT, GetClipBox)(THIS_ LPRECT prc) PURE;
1607
1608 /**
1609 * @brief Draw text within a rectangle.
1610 * @param pszText Text to draw.
1611 * @param cchLen Length of the text.
1612 * @param pRc Rectangle defining the drawing area.
1613 * @param uFormat Text formatting options.
1614 * @return HRESULT indicating success or failure.
1615 */
1616 STDMETHOD_(HRESULT, DrawText)(THIS_ LPCTSTR pszText, int cchLen, LPRECT pRc, UINT uFormat) PURE;
1617
1618 /**
1619 * @brief Measure the size of the text.
1620 * @param pszText Text to measure.
1621 * @param cchLen Length of the text.
1622 * @param psz Pointer to receive the measured size.
1623 * @return HRESULT indicating success or failure.
1624 */
1625 STDMETHOD_(HRESULT, MeasureText)(THIS_ LPCTSTR pszText, int cchLen, SIZE *psz) PURE;
1626
1627 /**
1628 * @brief Output text at a specified position.
1629 * @param x X-coordinate of the text position.
1630 * @param y Y-coordinate of the text position.
1631 * @param lpszString Text to output.
1632 * @param nCount Number of characters to output.
1633 * @return HRESULT indicating success or failure.
1634 */
1635 STDMETHOD_(HRESULT, TextOut)(THIS_ int x, int y, LPCTSTR lpszString, int nCount) PURE;
1636
1637 /**
1638 * @brief Draw a rectangle outline.
1639 * @param pRect Rectangle to draw.
1640 * @return HRESULT indicating success or failure.
1641 */
1642 STDMETHOD_(HRESULT, DrawRectangle)(THIS_ LPCRECT pRect) PURE;
1643
1644 /**
1645 * @brief Fill a rectangle with the current brush.
1646 * @param pRect Rectangle to fill.
1647 * @return HRESULT indicating success or failure.
1648 */
1649 STDMETHOD_(HRESULT, FillRectangle)(THIS_ LPCRECT pRect) PURE;
1650
1651 /**
1652 * @brief Fill a rectangle with a solid color.
1653 * @param pRect Rectangle to fill.
1654 * @param cr Solid color.
1655 * @return HRESULT indicating success or failure.
1656 */
1657 STDMETHOD_(HRESULT, FillSolidRect)(THIS_ LPCRECT pRect, COLORREF cr) PURE;
1658
1659 /**
1660 * @brief Draw a rounded rectangle outline.
1661 * @param pRect Rectangle defining the bounds of the rounded rectangle.
1662 * @param pt X and Y radii for the rounded corners.
1663 * @return HRESULT indicating success or failure.
1664 */
1665 STDMETHOD_(HRESULT, DrawRoundRect)(THIS_ LPCRECT pRect, POINT pt) PURE;
1666
1667 /**
1668 * @brief Fill a rounded rectangle with the current brush.
1669 * @param pRect Rectangle defining the bounds of the rounded rectangle.
1670 * @param pt X and Y radii for the rounded corners.
1671 * @return HRESULT indicating success or failure.
1672 */
1673 STDMETHOD_(HRESULT, FillRoundRect)(THIS_ LPCRECT pRect, POINT pt) PURE;
1674
1675 /**
1676 * @brief Fill a rounded rectangle with a solid color.
1677 * @param pRect Rectangle defining the bounds of the rounded rectangle.
1678 * @param pt X and Y radii for the rounded corners.
1679 * @param cr Solid color.
1680 * @return HRESULT indicating success or failure.
1681 */
1682 STDMETHOD_(HRESULT, FillSolidRoundRect)(THIS_ LPCRECT pRect, POINT pt, COLORREF cr) PURE;
1683
1684 /**
1685 * @brief Clear a rectangle with a solid color.
1686 * @param pRect Rectangle to clear.
1687 * @param cr Clear color.
1688 * @return HRESULT indicating success or failure.
1689 */
1690 STDMETHOD_(HRESULT, ClearRect)(THIS_ LPCRECT pRect, COLORREF cr) PURE;
1691
1692 /**
1693 * @brief Invert the colors in a rectangle.
1694 * @param pRect Rectangle to invert.
1695 * @return HRESULT indicating success or failure.
1696 */
1697 STDMETHOD_(HRESULT, InvertRect)(THIS_ LPCRECT pRect) PURE;
1698
1699 /**
1700 * @brief Draw an ellipse outline.
1701 * @param pRect Rectangle defining the bounds of the ellipse.
1702 * @return HRESULT indicating success or failure.
1703 */
1704 STDMETHOD_(HRESULT, DrawEllipse)(THIS_ LPCRECT pRect) PURE;
1705
1706 /**
1707 * @brief Fill an ellipse with the current brush.
1708 * @param pRect Rectangle defining the bounds of the ellipse.
1709 * @return HRESULT indicating success or failure.
1710 */
1711 STDMETHOD_(HRESULT, FillEllipse)(THIS_ LPCRECT pRect) PURE;
1712
1713 /**
1714 * @brief Fill an ellipse with a solid color.
1715 * @param pRect Rectangle defining the bounds of the ellipse.
1716 * @param cr Solid color.
1717 * @return HRESULT indicating success or failure.
1718 */
1719 STDMETHOD_(HRESULT, FillSolidEllipse)(THIS_ LPCRECT pRect, COLORREF cr) PURE;
1720
1721 /**
1722 * @brief Draw an arc.
1723 * @param pRect Rectangle defining the bounds of the arc.
1724 * @param startAngle Starting angle (in degrees) where the arc begins.
1725 * @param sweepAngle Sweep angle (in degrees) measured clockwise.
1726 * @param useCenter Whether to use the center point.
1727 * @return HRESULT indicating success or failure.
1728 */
1729 STDMETHOD_(HRESULT, DrawArc)(THIS_ LPCRECT pRect, float startAngle, float sweepAngle, BOOL useCenter) PURE;
1730
1731 /**
1732 * @brief Draw an arc with a specified line width.
1733 * @param pRect Rectangle defining the bounds of the arc.
1734 * @param startAngle Starting angle (in degrees) where the arc begins.
1735 * @param sweepAngle Sweep angle (in degrees) measured clockwise.
1736 * @param width Line width of the arc.
1737 * @return HRESULT indicating success or failure.
1738 */
1739 STDMETHOD_(HRESULT, DrawArc2)(THIS_ LPCRECT pRect, float startAngle, float sweepAngle, int width) PURE;
1740
1741 /**
1742 * @brief Fill an arc.
1743 * @param pRect Rectangle defining the bounds of the arc.
1744 * @param startAngle Starting angle (in degrees) where the arc begins.
1745 * @param sweepAngle Sweep angle (in degrees) measured clockwise.
1746 * @return HRESULT indicating success or failure.
1747 */
1748 STDMETHOD_(HRESULT, FillArc)(THIS_ LPCRECT pRect, float startAngle, float sweepAngle) PURE;
1749
1750 /**
1751 * @brief Draw a series of connected lines.
1752 * @param pPt Array of points defining the lines.
1753 * @param nCount Number of points.
1754 * @return HRESULT indicating success or failure.
1755 */
1756 STDMETHOD_(HRESULT, DrawLines)(THIS_ LPPOINT pPt, size_t nCount) PURE;
1757
1758 /**
1759 * @brief Draw a gradient-filled rectangle.
1760 * @param pRect Rectangle to fill.
1761 * @param bVert Vertical gradient flag.
1762 * @param ptRoundCorner X and Y radii for rounded corners.
1763 * @param pGradients Array of gradient items.
1764 * @param nCount Number of gradient items.
1765 * @param byAlpha Alpha value for the gradient.
1766 * @return HRESULT indicating success or failure.
1767 */
1768 STDMETHOD_(HRESULT, DrawGradientRect)(THIS_ LPCRECT pRect, BOOL bVert, POINT ptRoundCorner, const GradientItem *pGradients, int nCount, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1769
1770 /**
1771 * @brief Draw an extended gradient-filled rectangle.
1772 * @param pRect Rectangle to fill.
1773 * @param ptRoundCorner X and Y radii for rounded corners.
1774 * @param pGradients Array of gradient items.
1775 * @param nCount Number of gradient items.
1776 * @param info Gradient information.
1777 * @param byAlpha Alpha value for the gradient.
1778 * @return HRESULT indicating success or failure.
1779 */
1780 STDMETHOD_(HRESULT, DrawGradientRectEx)(THIS_ LPCRECT pRect, POINT ptRoundCorner, const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1781
1782 /**
1783 * @brief Draw a gradient-filled path.
1784 * @param path Path object.
1785 * @param pGradients Array of gradient items.
1786 * @param nCount Number of gradient items.
1787 * @param info Gradient information.
1788 * @param byAlpha Alpha value for the gradient.
1789 * @return HRESULT indicating success or failure.
1790 */
1791 STDMETHOD_(HRESULT, DrawGradientPath)(THIS_ const IPathS *path, const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1792
1793 /**
1794 * @brief Draw an icon.
1795 * @param xLeft Left position of the icon.
1796 * @param yTop Top position of the icon.
1797 * @param hIcon Icon handle.
1798 * @param cxWidth Width of the icon.
1799 * @param cyWidth Height of the icon.
1800 * @param diFlags Drawing flags.
1801 * @return HRESULT indicating success or failure.
1802 */
1803 STDMETHOD_(HRESULT, DrawIconEx)(THIS_ int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT diFlags) PURE;
1804
1805 /**
1806 * @brief Draw a bitmap.
1807 * @param pRcDest Destination rectangle.
1808 * @param pBitmap Bitmap object.
1809 * @param xSrc Source X position.
1810 * @param ySrc Source Y position.
1811 * @param byAlpha Alpha value for blending.
1812 * @return HRESULT indicating success or failure.
1813 */
1814 STDMETHOD_(HRESULT, DrawBitmap)(THIS_ LPCRECT pRcDest, const IBitmapS *pBitmap, int xSrc, int ySrc, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1815
1816 /**
1817 * @brief Draws a bitmap with expansion mode.
1818 * @param pRcDest Destination rectangle for the bitmap.
1819 * @param pBitmap Pointer to the bitmap object to draw.
1820 * @param pRcSrc Source rectangle within the bitmap.
1821 * @param expendMode Expansion mode (e.g., stretch, tile).
1822 * @param byAlpha Optional alpha value for blending (default is 0xFF).
1823 * @return HRESULT indicating success or failure.
1824 */
1825 STDMETHOD_(HRESULT, DrawBitmapEx)
1826 (THIS_ LPCRECT pRcDest, const IBitmapS *pBitmap, LPCRECT pRcSrc, UINT expendMode, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1827
1828 /**
1829 * @brief Draws a 9-patch bitmap.
1830 * @param pRcDest Destination rectangle for the bitmap.
1831 * @param pBitmap Pointer to the bitmap object to draw.
1832 * @param pRcSrc Source rectangle within the bitmap.
1833 * @param pRcSourMargin Margins for the 9-patch source.
1834 * @param expendMode Expansion mode (e.g., stretch, tile).
1835 * @param byAlpha Optional alpha value for blending (default is 0xFF).
1836 * @return HRESULT indicating success or failure.
1837 */
1838 STDMETHOD_(HRESULT, DrawBitmap9Patch)
1839 (THIS_ LPCRECT pRcDest, const IBitmapS *pBitmap, LPCRECT pRcSrc, LPCRECT pRcSourMargin, UINT expendMode, BYTE byAlpha DEF_VAL(0xFF)) PURE;
1840
1841 /**
1842 * @brief Performs a bit-block transfer (BitBlt) operation.
1843 * @param pRcDest Destination rectangle for the BitBlt operation.
1844 * @param pRTSour Pointer to the source render target.
1845 * @param xSrc X-coordinate of the source point.
1846 * @param ySrc Y-coordinate of the source point.
1847 * @param dwRop Raster operation code (default is kSrcCopy).
1848 * @return HRESULT indicating success or failure.
1849 */
1850 STDMETHOD_(HRESULT, BitBlt)
1851 (THIS_ LPCRECT pRcDest, IRenderTarget * pRTSour, int xSrc, int ySrc, DWORD dwRop DEF_VAL(kSrcCopy)) PURE;
1852
1853 /**
1854 * @brief Performs an alpha-blended transfer from one render target to another.
1855 * @param pRcDest Destination rectangle for the alpha blend.
1856 * @param pRTSrc Pointer to the source render target.
1857 * @param pRcSrc Source rectangle for the alpha blend.
1858 * @param byAlpha Alpha value for blending.
1859 * @return HRESULT indicating success or failure.
1860 */
1861 STDMETHOD_(HRESULT, AlphaBlend)
1862 (THIS_ LPCRECT pRcDest, IRenderTarget * pRTSrc, LPCRECT pRcSrc, BYTE byAlpha) PURE;
1863
1864 /**
1865 * @brief Retrieves the current rendering object of the specified type.
1866 * @param uType Type of the rendering object (e.g., pen, brush).
1867 * @return Pointer to the current rendering object.
1868 */
1869 STDMETHOD_(IRenderObj *, GetCurrentObject)(THIS_ OBJTYPE uType) PURE;
1870
1871 /**
1872 * @brief Resets the specified rendering object to its default state.
1873 * @param objType Type of the rendering object to reset.
1874 * @param pOldObj Optional pointer to receive the previous object (default is NULL).
1875 * @return HRESULT indicating success or failure.
1876 */
1877 STDMETHOD_(HRESULT, SelectDefaultObject)
1878 (THIS_ OBJTYPE objType, IRenderObj * *pOldObj DEF_VAL(NULL)) PURE;
1879
1880 /**
1881 * @brief Selects a new rendering object and optionally retrieves the previous one.
1882 * @param pObj Pointer to the new rendering object.
1883 * @param pOldObj Optional pointer to receive the previous object (default is NULL).
1884 * @return HRESULT indicating success or failure.
1885 */
1886 STDMETHOD_(HRESULT, SelectObject)
1887 (THIS_ IRenderObj * pObj, IRenderObj * *pOldObj DEF_VAL(NULL)) PURE;
1888
1889 /**
1890 * @brief Retrieves the current text color.
1891 * @return COLORREF representing the current text color.
1892 */
1893 STDMETHOD_(COLORREF, GetTextColor)(THIS) PURE;
1894
1895 /**
1896 * @brief Sets the current text color.
1897 * @param color New text color.
1898 * @return COLORREF representing the previous text color.
1899 */
1900 STDMETHOD_(COLORREF, SetTextColor)(THIS_ COLORREF color) PURE;
1901
1902 /**
1903 * @brief Sets the mask filter for anti-aliasing effects.
1904 * @param pMaskFilter Pointer to the mask filter object.
1905 */
1906 STDMETHOD_(void, SetMaskFilter)(THIS_ IMaskFilter * pMaskFilter) PURE;
1907
1908 /**
1909 * @brief Retrieves the current mask filter.
1910 * @return Pointer to the current mask filter object.
1911 */
1912 STDMETHOD_(IMaskFilter *, GetMaskFilter)(THIS) PURE;
1913
1914 /**
1915 * @brief Retrieves a device context (DC) compatible with the render target.
1916 * @param uFlag Flags for DC retrieval.
1917 * @return Handle to the device context (HDC).
1918 */
1919 STDMETHOD_(HDC, GetDC)(THIS_ UINT uFlag) PURE;
1920
1921 /**
1922 * @brief Releases a previously retrieved device context (DC).
1923 * @param hdc Handle to the device context to release.
1924 * @param pRc Optional pointer to a rectangle defining the area to update (default is NULL).
1925 */
1926 STDMETHOD_(void, ReleaseDC)(THIS_ HDC hdc, LPCRECT pRc DEF_VAL(NULL)) PURE;
1927
1928 /**
1929 * @brief Sets the coordinate transformation matrix.
1930 * @param matrix Array of 9 floats representing the new 3x3 transformation matrix.
1931 * @param oldMatrix Optional array of 9 floats to store the previous transformation matrix (default is NULL).
1932 * @return HRESULT indicating success or failure.
1933 */
1934 STDMETHOD_(HRESULT, SetTransform)
1935 (THIS_ const float matrix[9], float oldMatrix[9] DEF_VAL(NULL)) PURE;
1936
1937 /**
1938 * @brief Retrieves the current coordinate transformation matrix.
1939 * @param matrix Array of 9 floats to store the current 2x3 transformation matrix.
1940 * @return HRESULT indicating success or failure.
1941 */
1942 STDMETHOD_(HRESULT, GetTransform)(CTHIS_ float matrix[9]) SCONST PURE;
1943
1944 /**
1945 * @brief Retrieves the color of a specific pixel.
1946 * @param x X-coordinate of the pixel.
1947 * @param y Y-coordinate of the pixel.
1948 * @return COLORREF representing the color of the pixel.
1949 */
1950 STDMETHOD_(COLORREF, GetPixel)(THIS_ int x, int y) PURE;
1951
1952 /**
1953 * @brief Sets the color of a specific pixel.
1954 * @param x X-coordinate of the pixel.
1955 * @param y Y-coordinate of the pixel.
1956 * @param cr New color for the pixel.
1957 * @return COLORREF representing the previous color of the pixel.
1958 */
1959 STDMETHOD_(COLORREF, SetPixel)(THIS_ int x, int y, COLORREF cr) PURE;
1960
1961 /**
1962 * @brief Modifies the current clipping region using a path.
1963 * @param path Pointer to the path object to combine with the current clip.
1964 * @param mode Region operation mode (e.g., RGN_AND, RGN_OR).
1965 * @param doAntiAlias Boolean indicating whether anti-aliasing should be applied (default is FALSE).
1966 * @return HRESULT indicating success or failure.
1967 */
1968 STDMETHOD_(HRESULT, PushClipPath)
1969 (THIS_ const IPathS *path, UINT mode, BOOL doAntiAlias DEF_VAL(FALSE)) PURE;
1970
1971 /**
1972 * @brief Draws the outline of a path using the currently selected pen.
1973 * @param path Pointer to the path object to draw.
1974 * @param pathEffect Optional pointer to a path effect object (default is NULL).
1975 * @return HRESULT indicating success or failure.
1976 */
1977 STDMETHOD_(HRESULT, DrawPath)
1978 (THIS_ const IPathS *path, IPathEffect *pathEffect DEF_VAL(NULL)) PURE;
1979
1980 /**
1981 * @brief Fills the interior of a path using the currently selected brush.
1982 * @param path Pointer to the path object to fill.
1983 * @return HRESULT indicating success or failure.
1984 */
1985 STDMETHOD_(HRESULT, FillPath)(THIS_ const IPathS *path) PURE;
1986
1987 /**
1988 * @brief Sets the transfer mode for drawing operations.
1989 * @param mode New transfer mode.
1990 * @param pOldMode Optional pointer to store the previous transfer mode (default is NULL).
1991 * @return HRESULT indicating success or failure.
1992 */
1993 STDMETHOD_(HRESULT, SetXfermode)(THIS_ int mode, int *pOldMode DEF_VAL(NULL)) PURE;
1994
1995 /**
1996 * @brief Enables or disables anti-aliasing for drawing operations.
1997 * @param bAntiAlias Boolean indicating whether anti-aliasing should be enabled.
1998 * @return BOOL indicating the previous anti-aliasing state.
1999 */
2000 STDMETHOD_(BOOL, SetAntiAlias)(THIS_ BOOL bAntiAlias) PURE;
2001
2002 /**
2003 * @brief Retrieves the current anti-aliasing state.
2004 * @return BOOL indicating whether anti-aliasing is enabled.
2005 */
2006 STDMETHOD_(BOOL, GetAntiAlias)(CTHIS) SCONST PURE;
2007};
2008
2009/**
2010 * @struct IRenderFactory
2011 * @brief RenderFactory object
2012 *
2013 * Describe This interface defines a factory for creating various rendering objects and managing resources.
2014 */
2015#undef INTERFACE
2016#define INTERFACE IRenderFactory
2017DECLARE_INTERFACE_(IRenderFactory, IObjRef)
2018{
2019 /**
2020 * @brief Increments the reference count of the object.
2021 * @return long - The new reference count.
2022 */
2023 STDMETHOD_(long, AddRef)(THIS) PURE;
2024
2025 /**
2026 * @brief Decrements the reference count of the object.
2027 * @return long - The new reference count.
2028 */
2029 STDMETHOD_(long, Release)(THIS) PURE;
2030
2031 /**
2032 * @brief Final release of the object, performing cleanup if necessary.
2033 */
2034 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
2035
2036 /**
2037 * @brief Retrieves the image decoder factory associated with this render factory.
2038 * @return IImgDecoderFactory* - Pointer to the image decoder factory.
2039 */
2040 STDMETHOD_(IImgDecoderFactory *, GetImgDecoderFactory)(THIS) PURE;
2041
2042 /**
2043 * @brief Sets the image decoder factory for this render factory.
2044 * @param pImgDecoderFac - Pointer to the new image decoder factory.
2045 */
2046 STDMETHOD_(void, SetImgDecoderFactory)(THIS_ IImgDecoderFactory * pImgDecoderFac) PURE;
2047
2048 /**
2049 * @brief Creates a render target with specified dimensions.
2050 * @param ppRenderTarget - Pointer to receive the created render target.
2051 * @param nWid - Width of the render target (default is 0).
2052 * @param nHei - Height of the render target (default is 0).
2053 * @return BOOL - TRUE if successful, FALSE otherwise.
2054 */
2055 STDMETHOD_(BOOL, CreateRenderTarget)
2056 (THIS_ IRenderTarget * *ppRenderTarget, int nWid DEF_VAL(0), int nHei DEF_VAL(0)) PURE;
2057
2058 /**
2059 * @brief Creates a render target associated with a specific window handle.
2060 * @param ppRenderTarget - Pointer to receive the created render target.
2061 * @param hWnd - Handle to the window.
2062 * @return BOOL - TRUE if successful, FALSE otherwise.
2063 */
2064 STDMETHOD_(BOOL, CreateRenderTarget2)
2065 (THIS_ IRenderTarget * *ppRenderTarget, HWND hWnd) PURE;
2066
2067 /**
2068 * @brief Creates a font object with specified attributes.
2069 * @param ppFont - Pointer to receive the created font object.
2070 * @param lf - Pointer to the LOGFONT structure defining the font attributes.
2071 * @return BOOL - TRUE if successful, FALSE otherwise.
2072 */
2073 STDMETHOD_(BOOL, CreateFont)(THIS_ IFontS * *ppFont, const LOGFONT *lf) PURE;
2074
2075 /**
2076 * @brief Creates a bitmap object.
2077 * @param ppBitmap - Pointer to receive the created bitmap object.
2078 * @return BOOL - TRUE if successful, FALSE otherwise.
2079 */
2080 STDMETHOD_(BOOL, CreateBitmap)(THIS_ IBitmapS * *ppBitmap) PURE;
2081
2082 /**
2083 * @brief Creates a region object.
2084 * @param ppRgn - Pointer to receive the created region object.
2085 * @return BOOL - TRUE if successful, FALSE otherwise.
2086 */
2087 STDMETHOD_(BOOL, CreateRegion)(THIS_ IRegionS * *ppRgn) PURE;
2088
2089 /**
2090 * @brief Creates a path object.
2091 * @param ppPath - Pointer to receive the created path object.
2092 * @return BOOL - TRUE if successful, FALSE otherwise.
2093 */
2094 STDMETHOD_(BOOL, CreatePath)(THIS_ IPathS * *ppPath) PURE;
2095
2096 /**
2097 * @brief Creates a blur mask filter with specified parameters.
2098 * @param radius - Blur radius.
2099 * @param style - Blur style (e.g., normal, solid, outer, inner).
2100 * @param flag - Blur flags (e.g., ignore transform, high quality).
2101 * @param ppMaskFilter - Pointer to receive the created mask filter.
2102 * @return HRESULT - S_OK if successful, error code otherwise.
2103 */
2104 STDMETHOD_(HRESULT, CreateBlurMaskFilter)
2105 (THIS_ float radius, BlurStyle style, BlurFlags flag, IMaskFilter **ppMaskFilter) PURE;
2106
2107 /**
2108 * @brief Creates an emboss mask filter with specified parameters.
2109 * @param direction - Array of 3 floats defining the light direction.
2110 * @param ambient - Ambient light intensity.
2111 * @param specular - Specular light intensity.
2112 * @param blurRadius - Blur radius for the emboss effect.
2113 * @param ppMaskFilter - Pointer to receive the created mask filter.
2114 * @return HRESULT - S_OK if successful, error code otherwise.
2115 */
2116 STDMETHOD_(HRESULT, CreateEmbossMaskFilter)
2117 (THIS_ float direction[3], float ambient, float specular, float blurRadius, IMaskFilter **ppMaskFilter) PURE;
2118
2119 /**
2120 * @brief Creates a path effect with specified GUID.
2121 * @param guidEffect - GUID identifying the path effect type.
2122 * @param ppPathEffect - Pointer to receive the created path effect.
2123 * @return BOOL - TRUE if successful, FALSE otherwise.
2124 */
2125 STDMETHOD_(BOOL, CreatePathEffect)(THIS_ REFGUID guidEffect, IPathEffect * *ppPathEffect) PURE;
2126
2127 /**
2128 * @brief Retrieves the default font object.
2129 * @return IFontS* - Pointer to the default font object.
2130 */
2131 STDMETHOD_(IFontS *, GetDefFont)(CTHIS) PURE;
2132};
2133
2134#ifdef __cplusplus
2135// Simplify naming conventions for compatibility with SOUI3 without conflicting with system interfaces.
2136typedef IFontS IFont;
2137typedef IPenS IPen;
2138typedef IBrushS IBrush;
2139typedef IBitmapS IBitmap;
2140typedef IRegionS IRegion;
2141typedef IPathS IPath;
2142#endif //__cplusplus
2143
2144SNSEND
2145
2146/**
2147 * @brief Font fallback callback interface, specific to Skia rendering.
2148 * @param u8FontName - Current font name in UTF-8 encoding.
2149 * @param pWord - Character that cannot be rendered.
2150 * @param wordLen - Length of the character (1 or 2).
2151 * @param u8FontNameFallback - Output buffer for the fallback font name in UTF-8 encoding.
2152 * @param charset - Output parameter for the charset attribute of the fallback font.
2153 * @return TRUE if a fallback font is found, FALSE otherwise.
2154 */
2155typedef BOOL (*FontFallback)(LPCSTR u8FontName, const wchar_t *pWord, size_t wordLen, char u8FontNameFallback[100], int *charset);
2156
2157#endif // __SRENDER_I__H__
Interface definitions for image decoding.
Structure to define gradient information for creating gradient brushes.
Definition SRender-i.h:1411
Structure representing a 3x3 transformation matrix.
Definition SRender-i.h:974
float fMat[kMCount]
Array of floats representing the matrix elements.
Definition SRender-i.h:975
Bitmap object interface.
Definition SRender-i.h:420
HRESULT Scale(IBitmapS **pOutput, int nScale, FilterLevel filterLevel) SCONST PURE
Scales the bitmap and clones it.
const LPVOID GetPixelBits() SCONST PURE
Retrieves the pixel bits of the bitmap for reading.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
UINT Height() SCONST PURE
Retrieves the height of the bitmap.
HRESULT LoadFromMemory(LPBYTE pBuf, size_t szLen) PURE
Loads the bitmap from memory.
SIZE Size() SCONST PURE
Retrieves the size of the bitmap.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
HRESULT Save(LPCWSTR pszFileName, const LPVOID pFormat) SCONST PURE
Saves the bitmap to a file.
UINT Width() SCONST PURE
Retrieves the width of the bitmap.
HRESULT Scale2(IBitmapS **pOutput, int nWid, int nHei, FilterLevel filterLevel) SCONST PURE
Scales the bitmap to specified dimensions and clones it.
HRESULT Init(int nWid, int nHei, const LPVOID pBits) PURE
Initializes the bitmap from 32-bit bitmap data.
long AddRef() PURE
Increments the reference count for the object.
HRESULT Clone(IBitmapS **ppClone) SCONST PURE
Clones the bitmap.
HRESULT Init2(IImgFrame *pImgFrame) PURE
Initializes the bitmap from an IImgFrame object.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
HRESULT Save2(LPCWSTR pszFileName, ImgFmt imgFmt) SCONST PURE
Saves the bitmap to a file with a specified format.
HRESULT LoadFromFile(LPCTSTR pszFileName) PURE
Loads the bitmap from a file.
long Release() PURE
Decrements the reference count for the object.
LPVOID LockPixelBits() PURE
Locks the pixel bits of the bitmap for writing.
void UnlockPixelBits(LPVOID pBuf) PURE
Unlocks the pixel bits of the bitmap.
Brush object interface.
Definition SRender-i.h:239
long Release() PURE
Decrements the reference count for the object.
BrushType GetBrushType() SCONST PURE
Queries the type of the brush.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
long AddRef() PURE
Increments the reference count for the object.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
Font object interface.
Definition SRender-i.h:650
BOOL IsBold() SCONST PURE
Checks if the font is bold.
BOOL IsStrikeOut() SCONST PURE
Checks if the font has a strikeout.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
LPCTSTR FamilyName() SCONST PURE
Retrieves the family name of the font.
int TextSize() SCONST PURE
Retrieves the text size of the font.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
BOOL IsItalic() SCONST PURE
Checks if the font is italic.
BOOL IsUnderline() SCONST PURE
Checks if the font has an underline.
long AddRef() PURE
Increments the reference count for the object.
const LOGFONT * LogFont() SCONST PURE
Retrieves the LOGFONT structure of the font.
void SetProp(IXmlNode *pXmlNode) PURE
Sets properties from an XML node.
BOOL UpdateFont(const LOGFONT *pLogFont) PURE
Updates the font properties.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
long Release() PURE
Decrements the reference count for the object.
Interface for image decoder factory.
Interface for an image frame.
Interface for reference counting.
Definition obj-ref-i.h:19
Interface for path objects.
Pen object interface.
Definition SRender-i.h:307
int GetWidth() SCONST PURE
Retrieves the width of the pen.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
void SetColor(COLORREF cr) PURE
Sets the color of the pen.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
int GetStyle() SCONST PURE
Retrieves the style of the pen.
void SetStyle(int nStyle) PURE
Sets the style of the pen.
void SetWidth(int nWid) PURE
Sets the width of the pen.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
long AddRef() PURE
Increments the reference count for the object.
long Release() PURE
Decrements the reference count for the object.
COLORREF GetColor() SCONST PURE
Retrieves the color of the pen.
Region object interface.
Definition SRender-i.h:792
long Release() PURE
Decrements the reference count for the object.
void Clear() PURE
Clears the region.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
void Offset(POINT pt) PURE
Offsets the region by a specified amount.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
void CombineRgn(const IRegionS *pRgnSrc, int nCombineMode) PURE
Combines another region with the current region.
BOOL PtInRegion(POINT pt) SCONST PURE
Checks if a point is inside the region.
void CombineEllipse(LPCRECT lprect, int nCombineMode) PURE
Combines an ellipse with the region.
BOOL IsEmpty() SCONST PURE
Checks if the region is empty.
void CombinePolygon(const POINT *pts, int count, int nPolygonMode, int nCombineMode) PURE
Combines a polygon with the region.
void GetRgnBox(LPRECT lprect) SCONST PURE
Retrieves the bounding rectangle of the region.
BOOL RectInRegion(LPCRECT lprect) SCONST PURE
Checks if a rectangle intersects with the region.
long AddRef() PURE
Increments the reference count for the object.
void CombineRoundRect(LPCRECT lprect, POINT ptConner, int nCombineMode) PURE
Combines a rounded rectangle with the region.
void CombineRect(LPCRECT lprect, int nCombineMode) PURE
Combines a rectangle with the region.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
RenderFactory object.
Definition SRender-i.h:2018
HRESULT CreateBlurMaskFilter(float radius, BlurStyle style, BlurFlags flag, IMaskFilter **ppMaskFilter) PURE
Creates a blur mask filter with specified parameters.
BOOL CreateBitmap(IBitmapS **ppBitmap) PURE
Creates a bitmap object.
HRESULT CreateEmbossMaskFilter(float direction[3], float ambient, float specular, float blurRadius, IMaskFilter **ppMaskFilter) PURE
Creates an emboss mask filter with specified parameters.
long AddRef() PURE
Increments the reference count of the object.
long Release() PURE
Decrements the reference count of the object.
BOOL CreatePathEffect(REFGUID guidEffect, IPathEffect **ppPathEffect) PURE
Creates a path effect with specified GUID.
IFontS * GetDefFont() PURE
Retrieves the default font object.
BOOL CreatePath(IPathS **ppPath) PURE
Creates a path object.
IImgDecoderFactory * GetImgDecoderFactory() PURE
Retrieves the image decoder factory associated with this render factory.
BOOL CreateRenderTarget(IRenderTarget **ppRenderTarget, int nWid=0, int nHei=0) PURE
Creates a render target with specified dimensions.
BOOL CreateRegion(IRegionS **ppRgn) PURE
Creates a region object.
BOOL CreateRenderTarget2(IRenderTarget **ppRenderTarget, HWND hWnd) PURE
Creates a render target associated with a specific window handle.
BOOL CreateFont(IFontS **ppFont, const LOGFONT *lf) PURE
Creates a font object with specified attributes.
void SetImgDecoderFactory(IImgDecoderFactory *pImgDecoderFac) PURE
Sets the image decoder factory for this render factory.
void OnFinalRelease() PURE
Final release of the object, performing cleanup if necessary.
Base class for all renderable objects.
Definition SRender-i.h:145
long AddRef() PURE
Increments the reference count for the object.
OBJTYPE ObjectType() SCONST PURE
Queries the type of the rendering object.
long Release() PURE
Decrements the reference count for the object.
IRenderFactory * GetRenderFactory() SCONST PURE
Obtains the render factory that created this rendering object.
void OnFinalRelease() PURE
Called when the final release of the object occurs.
Interface for rendering target objects.
Definition SRender-i.h:1440
HRESULT DrawRectangle(LPCRECT pRect) PURE
Draw a rectangle outline.
HRESULT DrawBitmap(LPCRECT pRcDest, const IBitmapS *pBitmap, int xSrc, int ySrc, BYTE byAlpha=0xFF) PURE
Draw a bitmap.
HRESULT DrawText(LPCTSTR pszText, int cchLen, LPRECT pRc, UINT uFormat) PURE
Draw text within a rectangle.
HRESULT FillSolidRoundRect(LPCRECT pRect, POINT pt, COLORREF cr) PURE
Fill a rounded rectangle with a solid color.
HRESULT DrawEllipse(LPCRECT pRect) PURE
Draw an ellipse outline.
HRESULT SetViewportOrg(POINT pt) PURE
Set the viewport origin.
HRESULT FillEllipse(LPCRECT pRect) PURE
Fill an ellipse with the current brush.
HRESULT CreateRegion(IRegionS **ppRegion) PURE
Create a region object.
HRESULT FillPath(const IPathS *path) PURE
Fills the interior of a path using the currently selected brush.
HRESULT DrawBitmapEx(LPCRECT pRcDest, const IBitmapS *pBitmap, LPCRECT pRcSrc, UINT expendMode, BYTE byAlpha=0xFF) PURE
Draws a bitmap with expansion mode.
HRESULT AlphaBlend(LPCRECT pRcDest, IRenderTarget *pRTSrc, LPCRECT pRcSrc, BYTE byAlpha) PURE
Performs an alpha-blended transfer from one render target to another.
HRESULT DrawArc(LPCRECT pRect, float startAngle, float sweepAngle, BOOL useCenter) PURE
Draw an arc.
COLORREF GetPixel(int x, int y) PURE
Retrieves the color of a specific pixel.
HRESULT CreateGradientBrush(const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha, TileMode tileMode, IBrushS **ppBrush) PURE
Create a gradient brush.
long Release() PURE
Decrement the reference count and destroy the object if the count reaches zero.
IMaskFilter * GetMaskFilter() PURE
Retrieves the current mask filter.
HRESULT DrawArc2(LPCRECT pRect, float startAngle, float sweepAngle, int width) PURE
Draw an arc with a specified line width.
HRESULT DrawGradientRectEx(LPCRECT pRect, POINT ptRoundCorner, const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha=0xFF) PURE
Draw an extended gradient-filled rectangle.
HRESULT GetTransform(float matrix[9]) SCONST PURE
Retrieves the current coordinate transformation matrix.
HRESULT BitBlt(LPCRECT pRcDest, IRenderTarget *pRTSour, int xSrc, int ySrc, DWORD dwRop=kSrcCopy) PURE
Performs a bit-block transfer (BitBlt) operation.
BOOL IsOffscreen() SCONST PURE
Check if the render target is offscreen.
HDC GetDC(UINT uFlag) PURE
Retrieves a device context (DC) compatible with the render target.
IRenderObj * GetCurrentObject(OBJTYPE uType) PURE
Retrieves the current rendering object of the specified type.
HRESULT DrawPath(const IPathS *path, IPathEffect *pathEffect=NULL) PURE
Draws the outline of a path using the currently selected pen.
HRESULT CreateBitmapBrush(IBitmapS *pBmp, TileMode xtm, TileMode ytm, IBrushS **ppBrush) PURE
Create a bitmap brush.
HRESULT SelectObject(IRenderObj *pObj, IRenderObj **pOldObj=NULL) PURE
Selects a new rendering object and optionally retrieves the previous one.
void OnFinalRelease() PURE
Called when the reference count reaches zero.
HRESULT SetTransform(const float matrix[9], float oldMatrix[9]=NULL) PURE
Sets the coordinate transformation matrix.
HRESULT SetXfermode(int mode, int *pOldMode=NULL) PURE
Sets the transfer mode for drawing operations.
HRESULT FillArc(LPCRECT pRect, float startAngle, float sweepAngle) PURE
Fill an arc.
HRESULT GetViewportOrg(LPPOINT lpPoint) PURE
Get the current viewport origin.
HRESULT CreateSolidColorBrush(COLORREF cr, IBrushS **ppBrush) PURE
Create a solid color brush.
void EndDraw() PURE
End a drawing operation.
HRESULT PushClipRect(LPCRECT pRect, UINT mode=RGN_AND) PURE
Push a rectangular clip region.
HRESULT CreatePen(int iStyle, COLORREF cr, int cWidth, IPenS **ppPen) PURE
Create a pen object.
HRESULT RestoreClip(int nState=-1) PURE
Restore a previously saved clip state.
HRESULT PopClip() PURE
Pop the last clip region from the stack.
HRESULT DrawGradientPath(const IPathS *path, const GradientItem *pGradients, int nCount, const GradientInfo *info, BYTE byAlpha=0xFF) PURE
Draw a gradient-filled path.
HRESULT Resize(SIZE sz) PURE
Resize the render target.
HRESULT FillSolidRect(LPCRECT pRect, COLORREF cr) PURE
Fill a rectangle with a solid color.
HRESULT FillRectangle(LPCRECT pRect) PURE
Fill a rectangle with the current brush.
HRESULT DrawBitmap9Patch(LPCRECT pRcDest, const IBitmapS *pBitmap, LPCRECT pRcSrc, LPCRECT pRcSourMargin, UINT expendMode, BYTE byAlpha=0xFF) PURE
Draws a 9-patch bitmap.
HRESULT DrawRoundRect(LPCRECT pRect, POINT pt) PURE
Draw a rounded rectangle outline.
HRESULT SelectDefaultObject(OBJTYPE objType, IRenderObj **pOldObj=NULL) PURE
Resets the specified rendering object to its default state.
void BeginDraw() PURE
Start a drawing operation.
HRESULT FillRoundRect(LPCRECT pRect, POINT pt) PURE
Fill a rounded rectangle with the current brush.
HRESULT PushClipPath(const IPathS *path, UINT mode, BOOL doAntiAlias=FALSE) PURE
Modifies the current clipping region using a path.
HRESULT DrawGradientRect(LPCRECT pRect, BOOL bVert, POINT ptRoundCorner, const GradientItem *pGradients, int nCount, BYTE byAlpha=0xFF) PURE
Draw a gradient-filled rectangle.
HRESULT SaveClip(int *pnState) PURE
Save the current clip state.
HRESULT GetClipBox(LPRECT prc) PURE
Get the bounding box of the current clip region.
HRESULT TextOut(int x, int y, LPCTSTR lpszString, int nCount) PURE
Output text at a specified position.
HRESULT OffsetViewportOrg(int xOff, int yOff, LPPOINT lpPoint=NULL) PURE
Offset the viewport origin.
HRESULT GetClipRegion(IRegionS **ppRegion) PURE
Get the current clip region.
long AddRef() PURE
Increment the reference count.
HRESULT InvertRect(LPCRECT pRect) PURE
Invert the colors in a rectangle.
COLORREF GetTextColor() PURE
Retrieves the current text color.
HRESULT ClearRect(LPCRECT pRect, COLORREF cr) PURE
Clear a rectangle with a solid color.
BOOL GetAntiAlias() SCONST PURE
Retrieves the current anti-aliasing state.
HRESULT FillSolidEllipse(LPCRECT pRect, COLORREF cr) PURE
Fill an ellipse with a solid color.
BOOL SetAntiAlias(BOOL bAntiAlias) PURE
Enables or disables anti-aliasing for drawing operations.
COLORREF SetTextColor(COLORREF color) PURE
Sets the current text color.
HRESULT DrawLines(LPPOINT pPt, size_t nCount) PURE
Draw a series of connected lines.
HRESULT PushClipRegion(IRegionS *pRegion, UINT mode=RGN_AND) PURE
Push a region-based clip.
void ReleaseDC(HDC hdc, LPCRECT pRc=NULL) PURE
Releases a previously retrieved device context (DC).
COLORREF SetPixel(int x, int y, COLORREF cr) PURE
Sets the color of a specific pixel.
HRESULT DrawIconEx(int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT diFlags) PURE
Draw an icon.
void SetMaskFilter(IMaskFilter *pMaskFilter) PURE
Sets the mask filter for anti-aliasing effects.
HRESULT MeasureText(LPCTSTR pszText, int cchLen, SIZE *psz) PURE
Measure the size of the text.
HRESULT ExcludeClipRect(LPCRECT pRc) PURE
Exclude a rectangle from the current clip region.
Interface for XML nodes.
Definition sxml-i.h:128