push b0b97fcd59eff07f047585692fa36859b459324f
[wine/hacks.git] / dlls / gdiplus / region.c
blobf1142b78db6db60273cdf7c5d43b2b112f8ea9a1
1 /*
2 * Copyright (C) 2008 Google (Lei Zhang)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wingdi.h"
25 #include "objbase.h"
27 #include "gdiplus.h"
28 #include "gdiplus_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
33 /**********************************************************
35 * Data returned by GdipGetRegionData looks something like this:
37 * struct region_data_header
38 * {
39 * DWORD size; size in bytes of the data - 8.
40 * DWORD magic1; probably a checksum.
41 * DWORD magic2; always seems to be 0xdbc01001 - version?
42 * DWORD num_ops; number of combining ops * 2
43 * };
45 * Then follows a sequence of combining ops and region elements.
47 * A region element is either a RECTF or some path data.
49 * Combining ops are just stored as their CombineMode value.
51 * Each RECTF is preceded by the DWORD 0x10000000. An empty rect is
52 * stored as 0x10000002 (with no following RECTF) and an infinite rect
53 * is stored as 0x10000003 (again with no following RECTF).
55 * Path data is preceded by the DWORD 0x10000001. Then follows a
56 * DWORD size and then size bytes of data.
58 * The combining ops are stored in the reverse order to the region
59 * elements and in the reverse order to which the region was
60 * constructed.
62 * When two or more complex regions (ie those with more than one
63 * element) are combined, the combining op for the two regions comes
64 * first, then the combining ops for the region elements in region 1,
65 * followed by the region elements for region 1, then follows the
66 * combining ops for region 2 and finally region 2's region elements.
67 * Presumably you're supposed to use the 0x1000000x header to find the
68 * end of the op list (the count of the elements in each region is not
69 * stored).
71 * When a simple region (1 element) is combined, it's treated as if a
72 * single rect/path is being combined.
76 #define FLAGS_NOFLAGS 0x0
77 #define FLAGS_INTPATH 0x4000
79 /* Header size as far as header->size is concerned. This doesn't include
80 * header->size or header->checksum
82 static const INT sizeheader_size = sizeof(DWORD) * 2;
84 typedef struct packed_point
86 short X;
87 short Y;
88 } packed_point;
90 /* Everything is measured in DWORDS; round up if there's a remainder */
91 static inline INT get_pathtypes_size(const GpPath* path)
93 INT needed = path->pathdata.Count / sizeof(DWORD);
95 if (path->pathdata.Count % sizeof(DWORD) > 0)
96 needed++;
98 return needed * sizeof(DWORD);
101 static inline INT get_element_size(const region_element* element)
103 INT needed = sizeof(DWORD); /* DWORD for the type */
104 switch(element->type)
106 case RegionDataRect:
107 return needed + sizeof(GpRect);
108 case RegionDataPath:
109 needed += element->elementdata.pathdata.pathheader.size;
110 needed += sizeof(DWORD); /* Extra DWORD for pathheader.size */
111 return needed;
112 case RegionDataEmptyRect:
113 case RegionDataInfiniteRect:
114 return needed;
115 default:
116 needed += get_element_size(element->elementdata.combine.left);
117 needed += get_element_size(element->elementdata.combine.right);
118 return needed;
121 return 0;
124 /* Does not check parameters, caller must do that */
125 static inline GpStatus init_region(GpRegion* region, const RegionType type)
127 region->node.type = type;
128 region->header.checksum = 0xdeadbeef;
129 region->header.magic = VERSION_MAGIC;
130 region->header.num_children = 0;
131 region->header.size = sizeheader_size + get_element_size(&region->node);
133 return Ok;
136 static inline GpStatus clone_element(const region_element* element,
137 region_element** element2)
139 GpStatus stat;
141 /* root node is allocated with GpRegion */
142 if(!*element2){
143 *element2 = GdipAlloc(sizeof(region_element));
144 if (!*element2)
145 return OutOfMemory;
148 (*element2)->type = element->type;
150 switch (element->type)
152 case RegionDataRect:
153 (*element2)->elementdata.rect = element->elementdata.rect;
154 break;
155 case RegionDataEmptyRect:
156 case RegionDataInfiniteRect:
157 break;
158 case RegionDataPath:
159 (*element2)->elementdata.pathdata.pathheader = element->elementdata.pathdata.pathheader;
160 stat = GdipClonePath(element->elementdata.pathdata.path,
161 &(*element2)->elementdata.pathdata.path);
162 if (stat != Ok) goto clone_out;
163 break;
164 default:
165 (*element2)->elementdata.combine.left = NULL;
166 (*element2)->elementdata.combine.right = NULL;
168 stat = clone_element(element->elementdata.combine.left,
169 &(*element2)->elementdata.combine.left);
170 if (stat != Ok) goto clone_out;
171 stat = clone_element(element->elementdata.combine.right,
172 &(*element2)->elementdata.combine.right);
173 if (stat != Ok) goto clone_out;
174 break;
177 return Ok;
179 clone_out:
180 delete_element(*element2);
181 *element2 = NULL;
182 return stat;
185 /* Common code for CombineRegion*
186 * All the caller has to do is get its format into an element
188 static inline void fuse_region(GpRegion* region, region_element* left,
189 region_element* right, const CombineMode mode)
191 region->node.type = mode;
192 region->node.elementdata.combine.left = left;
193 region->node.elementdata.combine.right = right;
195 region->header.size = sizeheader_size + get_element_size(&region->node);
196 region->header.num_children += 2;
199 /*****************************************************************************
200 * GdipCloneRegion [GDIPLUS.@]
202 * Creates a deep copy of the region
204 * PARAMS
205 * region [I] source region
206 * clone [O] resulting clone
208 * RETURNS
209 * SUCCESS: Ok
210 * FAILURE: InvalidParameter or OutOfMemory
212 GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
214 region_element *element;
216 TRACE("%p %p\n", region, clone);
218 if (!(region && clone))
219 return InvalidParameter;
221 *clone = GdipAlloc(sizeof(GpRegion));
222 if (!*clone)
223 return OutOfMemory;
224 element = &(*clone)->node;
226 (*clone)->header = region->header;
227 return clone_element(&region->node, &element);
230 GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode mode)
232 GpRegion *path_region;
233 region_element *left, *right = NULL;
234 GpStatus stat;
236 TRACE("%p %p %d\n", region, path, mode);
238 if (!(region && path))
239 return InvalidParameter;
241 stat = GdipCreateRegionPath(path, &path_region);
242 if (stat != Ok)
243 return stat;
245 /* simply replace region data */
246 if(mode == CombineModeReplace){
247 delete_element(&region->node);
248 memcpy(region, path_region, sizeof(GpRegion));
249 return Ok;
252 left = GdipAlloc(sizeof(region_element));
253 if (!left)
254 goto out;
255 *left = region->node;
257 stat = clone_element(&path_region->node, &right);
258 if (stat != Ok)
259 goto out;
261 fuse_region(region, left, right, mode);
263 GdipDeleteRegion(path_region);
264 return Ok;
266 out:
267 GdipFree(left);
268 delete_element(right);
269 GdipDeleteRegion(path_region);
270 return stat;
273 GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
274 GDIPCONST GpRectF *rect, CombineMode mode)
276 GpRegion *rect_region;
277 region_element *left, *right = NULL;
278 GpStatus stat;
280 TRACE("%p %p %d\n", region, rect, mode);
282 if (!(region && rect))
283 return InvalidParameter;
285 stat = GdipCreateRegionRect(rect, &rect_region);
286 if (stat != Ok)
287 return stat;
289 /* simply replace region data */
290 if(mode == CombineModeReplace){
291 delete_element(&region->node);
292 memcpy(region, rect_region, sizeof(GpRegion));
293 return Ok;
296 left = GdipAlloc(sizeof(region_element));
297 if (!left)
298 goto out;
299 memcpy(left, &region->node, sizeof(region_element));
301 stat = clone_element(&rect_region->node, &right);
302 if (stat != Ok)
303 goto out;
305 fuse_region(region, left, right, mode);
307 GdipDeleteRegion(rect_region);
308 return Ok;
310 out:
311 GdipFree(left);
312 delete_element(right);
313 GdipDeleteRegion(rect_region);
314 return stat;
317 GpStatus WINGDIPAPI GdipCombineRegionRectI(GpRegion *region,
318 GDIPCONST GpRect *rect, CombineMode mode)
320 GpRectF rectf;
322 TRACE("%p %p %d\n", region, rect, mode);
324 if (!rect)
325 return InvalidParameter;
327 rectf.X = (REAL)rect->X;
328 rectf.Y = (REAL)rect->Y;
329 rectf.Height = (REAL)rect->Height;
330 rectf.Width = (REAL)rect->Width;
332 return GdipCombineRegionRect(region, &rectf, mode);
335 GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
336 GpRegion *region2, CombineMode mode)
338 region_element *left, *right = NULL;
339 GpStatus stat;
340 GpRegion *reg2copy;
342 TRACE("%p %p %d\n", region1, region2, mode);
344 if(!(region1 && region2))
345 return InvalidParameter;
347 /* simply replace region data */
348 if(mode == CombineModeReplace){
349 stat = GdipCloneRegion(region2, &reg2copy);
350 if(stat != Ok) return stat;
352 delete_element(&region1->node);
353 memcpy(region1, reg2copy, sizeof(GpRegion));
354 return Ok;
357 left = GdipAlloc(sizeof(region_element));
358 if (!left)
359 return OutOfMemory;
361 *left = region1->node;
362 stat = clone_element(&region2->node, &right);
363 if (stat != Ok)
365 GdipFree(left);
366 delete_element(right);
367 return OutOfMemory;
370 fuse_region(region1, left, right, mode);
371 region1->header.num_children += region2->header.num_children;
373 return Ok;
376 GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
378 TRACE("%p\n", region);
380 if(!region)
381 return InvalidParameter;
383 *region = GdipAlloc(sizeof(GpRegion));
384 if(!*region)
385 return OutOfMemory;
387 return init_region(*region, RegionDataInfiniteRect);
390 /*****************************************************************************
391 * GdipCreateRegionPath [GDIPLUS.@]
393 * Creates a GpRegion from a GpPath
395 * PARAMS
396 * path [I] path to base the region on
397 * region [O] pointer to the newly allocated region
399 * RETURNS
400 * SUCCESS: Ok
401 * FAILURE: InvalidParameter
403 * NOTES
404 * If a path has no floating point points, its points will be stored as shorts
405 * (INTPATH)
407 * If a path is empty, it is considered to be an INTPATH
409 GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
411 region_element* element;
412 GpPoint *pointsi;
413 GpPointF *pointsf;
415 GpStatus stat;
416 DWORD flags = FLAGS_INTPATH;
417 INT count, i;
419 TRACE("%p, %p\n", path, region);
421 if (!(path && region))
422 return InvalidParameter;
424 *region = GdipAlloc(sizeof(GpRegion));
425 if(!*region)
426 return OutOfMemory;
427 stat = init_region(*region, RegionDataPath);
428 if (stat != Ok)
430 GdipDeleteRegion(*region);
431 return stat;
433 element = &(*region)->node;
434 count = path->pathdata.Count;
436 /* Test to see if the path is an Integer path */
437 if (count)
439 pointsi = GdipAlloc(sizeof(GpPoint) * count);
440 pointsf = GdipAlloc(sizeof(GpPointF) * count);
441 if (!(pointsi && pointsf))
443 GdipFree(pointsi);
444 GdipFree(pointsf);
445 GdipDeleteRegion(*region);
446 return OutOfMemory;
449 stat = GdipGetPathPointsI(path, pointsi, count);
450 if (stat != Ok)
452 GdipDeleteRegion(*region);
453 return stat;
455 stat = GdipGetPathPoints(path, pointsf, count);
456 if (stat != Ok)
458 GdipDeleteRegion(*region);
459 return stat;
462 for (i = 0; i < count; i++)
464 if (!(pointsi[i].X == pointsf[i].X &&
465 pointsi[i].Y == pointsf[i].Y ))
467 flags = FLAGS_NOFLAGS;
468 break;
471 GdipFree(pointsi);
472 GdipFree(pointsf);
475 stat = GdipClonePath(path, &element->elementdata.pathdata.path);
476 if (stat != Ok)
478 GdipDeleteRegion(*region);
479 return stat;
482 /* 3 for headers, once again size doesn't count itself */
483 element->elementdata.pathdata.pathheader.size = ((sizeof(DWORD) * 3));
484 switch(flags)
486 /* Floats, sent out as floats */
487 case FLAGS_NOFLAGS:
488 element->elementdata.pathdata.pathheader.size +=
489 (sizeof(DWORD) * count * 2);
490 break;
491 /* INTs, sent out as packed shorts */
492 case FLAGS_INTPATH:
493 element->elementdata.pathdata.pathheader.size +=
494 (sizeof(DWORD) * count);
495 break;
496 default:
497 FIXME("Unhandled flags (%08x). Expect wrong results.\n", flags);
499 element->elementdata.pathdata.pathheader.size += get_pathtypes_size(path);
500 element->elementdata.pathdata.pathheader.magic = VERSION_MAGIC;
501 element->elementdata.pathdata.pathheader.count = count;
502 element->elementdata.pathdata.pathheader.flags = flags;
503 (*region)->header.size = sizeheader_size + get_element_size(element);
505 return Ok;
508 GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
509 GpRegion **region)
511 GpStatus stat;
513 TRACE("%p, %p\n", rect, region);
515 if (!(rect && region))
516 return InvalidParameter;
518 *region = GdipAlloc(sizeof(GpRegion));
519 stat = init_region(*region, RegionDataRect);
520 if(stat != Ok)
522 GdipDeleteRegion(*region);
523 return stat;
526 (*region)->node.elementdata.rect.X = rect->X;
527 (*region)->node.elementdata.rect.Y = rect->Y;
528 (*region)->node.elementdata.rect.Width = rect->Width;
529 (*region)->node.elementdata.rect.Height = rect->Height;
531 return Ok;
534 GpStatus WINGDIPAPI GdipCreateRegionRectI(GDIPCONST GpRect *rect,
535 GpRegion **region)
537 GpRectF rectf;
539 TRACE("%p, %p\n", rect, region);
541 rectf.X = (REAL)rect->X;
542 rectf.Y = (REAL)rect->Y;
543 rectf.Width = (REAL)rect->Width;
544 rectf.Height = (REAL)rect->Height;
546 return GdipCreateRegionRect(&rectf, region);
549 GpStatus WINGDIPAPI GdipCreateRegionRgnData(GDIPCONST BYTE *data, INT size, GpRegion **region)
551 FIXME("(%p, %d, %p): stub\n", data, size, region);
553 *region = NULL;
554 return NotImplemented;
557 GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
559 FIXME("(%p, %p): stub\n", hrgn, region);
561 *region = NULL;
562 return NotImplemented;
565 GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
567 TRACE("%p\n", region);
569 if (!region)
570 return InvalidParameter;
572 delete_element(&region->node);
573 GdipFree(region);
575 return Ok;
578 GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)
580 FIXME("(%p, %p, %p): stub\n", region, graphics, rect);
582 return NotImplemented;
585 GpStatus WINGDIPAPI GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, GpRect *rect)
587 FIXME("(%p, %p, %p): stub\n", region, graphics, rect);
589 return NotImplemented;
592 static inline void write_dword(DWORD* location, INT* offset, const DWORD write)
594 location[*offset] = write;
595 (*offset)++;
598 static inline void write_float(DWORD* location, INT* offset, const FLOAT write)
600 ((FLOAT*)location)[*offset] = write;
601 (*offset)++;
604 static inline void write_packed_point(DWORD* location, INT* offset,
605 const GpPointF* write)
607 packed_point point;
609 point.X = write->X;
610 point.Y = write->Y;
611 memcpy(location + *offset, &point, sizeof(packed_point));
612 (*offset)++;
615 static inline void write_path_types(DWORD* location, INT* offset,
616 const GpPath* path)
618 memcpy(location + *offset, path->pathdata.Types, path->pathdata.Count);
620 /* The unwritten parts of the DWORD (if any) must be cleared */
621 if (path->pathdata.Count % sizeof(DWORD))
622 ZeroMemory(((BYTE*)location) + (*offset * sizeof(DWORD)) +
623 path->pathdata.Count,
624 sizeof(DWORD) - path->pathdata.Count % sizeof(DWORD));
625 *offset += (get_pathtypes_size(path) / sizeof(DWORD));
628 static void write_element(const region_element* element, DWORD *buffer,
629 INT* filled)
631 write_dword(buffer, filled, element->type);
632 switch (element->type)
634 case CombineModeReplace:
635 case CombineModeIntersect:
636 case CombineModeUnion:
637 case CombineModeXor:
638 case CombineModeExclude:
639 case CombineModeComplement:
640 write_element(element->elementdata.combine.left, buffer, filled);
641 write_element(element->elementdata.combine.right, buffer, filled);
642 break;
643 case RegionDataRect:
644 write_float(buffer, filled, element->elementdata.rect.X);
645 write_float(buffer, filled, element->elementdata.rect.Y);
646 write_float(buffer, filled, element->elementdata.rect.Width);
647 write_float(buffer, filled, element->elementdata.rect.Height);
648 break;
649 case RegionDataPath:
651 INT i;
652 const GpPath* path = element->elementdata.pathdata.path;
654 memcpy(buffer + *filled, &element->elementdata.pathdata.pathheader,
655 sizeof(element->elementdata.pathdata.pathheader));
656 *filled += sizeof(element->elementdata.pathdata.pathheader) / sizeof(DWORD);
657 switch (element->elementdata.pathdata.pathheader.flags)
659 case FLAGS_NOFLAGS:
660 for (i = 0; i < path->pathdata.Count; i++)
662 write_float(buffer, filled, path->pathdata.Points[i].X);
663 write_float(buffer, filled, path->pathdata.Points[i].Y);
665 break;
666 case FLAGS_INTPATH:
667 for (i = 0; i < path->pathdata.Count; i++)
669 write_packed_point(buffer, filled,
670 &path->pathdata.Points[i]);
673 write_path_types(buffer, filled, path);
674 break;
676 case RegionDataEmptyRect:
677 case RegionDataInfiniteRect:
678 break;
682 /*****************************************************************************
683 * GdipGetRegionData [GDIPLUS.@]
685 * Returns the header, followed by combining ops and region elements.
687 * PARAMS
688 * region [I] region to retrieve from
689 * buffer [O] buffer to hold the resulting data
690 * size [I] size of the buffer
691 * needed [O] (optional) how much data was written
693 * RETURNS
694 * SUCCESS: Ok
695 * FAILURE: InvalidParamter
697 * NOTES
698 * The header contains the size, a checksum, a version string, and the number
699 * of children. The size does not count itself or the checksum.
700 * Version is always something like 0xdbc01001 or 0xdbc01002
702 * An element is a RECT, or PATH; Combining ops are stored as their
703 * CombineMode value. Special regions (infinite, empty) emit just their
704 * op-code; GpRectFs emit their code followed by their points; GpPaths emit
705 * their code followed by a second header for the path followed by the actual
706 * path data. Followed by the flags for each point. The pathheader contains
707 * the size of the data to follow, a version number again, followed by a count
708 * of how many points, and any special flags which may apply. 0x4000 means its
709 * a path of shorts instead of FLOAT.
711 * Combining Ops are stored in reverse order from when they were constructed;
712 * the output is a tree where the left side combining area is always taken
713 * first.
715 GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size,
716 UINT *needed)
718 INT filled = 0;
720 TRACE("%p, %p, %d, %p\n", region, buffer, size, needed);
722 if (!(region && buffer && size))
723 return InvalidParameter;
725 memcpy(buffer, &region->header, sizeof(region->header));
726 filled += sizeof(region->header) / sizeof(DWORD);
727 /* With few exceptions, everything written is DWORD aligned,
728 * so use that as our base */
729 write_element(&region->node, (DWORD*)buffer, &filled);
731 if (needed)
732 *needed = filled * sizeof(DWORD);
734 return Ok;
737 GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT *needed)
739 TRACE("%p, %p\n", region, needed);
741 if (!(region && needed))
742 return InvalidParameter;
744 /* header.size doesn't count header.size and header.checksum */
745 *needed = region->header.size + sizeof(DWORD) * 2;
747 return Ok;
750 /*****************************************************************************
751 * GdipGetRegionHRgn [GDIPLUS.@]
753 GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hrgn)
755 FIXME("(%p, %p, %p): stub\n", region, graphics, hrgn);
757 *hrgn = NULL;
758 return NotImplemented;
761 GpStatus WINGDIPAPI GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, BOOL *res)
763 TRACE("(%p, %p, %p)\n", region, graphics, res);
765 if(!region || !graphics || !res)
766 return InvalidParameter;
768 *res = (region->node.type == RegionDataEmptyRect);
770 return Ok;
773 GpStatus WINGDIPAPI GdipIsEqualRegion(GpRegion *region, GpRegion *region2, GpGraphics *graphics,
774 BOOL *res)
776 FIXME("(%p, %p, %p, %p): stub\n", region, region2, graphics, res);
778 return NotImplemented;
781 /* I think graphics is ignored here */
782 GpStatus WINGDIPAPI GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, BOOL *res)
784 TRACE("(%p, %p, %p)\n", region, graphics, res);
786 if(!region || !graphics || !res)
787 return InvalidParameter;
789 *res = (region->node.type == RegionDataInfiniteRect);
791 return Ok;
794 GpStatus WINGDIPAPI GdipSetEmpty(GpRegion *region)
796 GpStatus stat;
798 TRACE("%p\n", region);
800 if (!region)
801 return InvalidParameter;
803 delete_element(&region->node);
804 stat = init_region(region, RegionDataEmptyRect);
806 return stat;
809 GpStatus WINGDIPAPI GdipSetInfinite(GpRegion *region)
811 GpStatus stat;
813 TRACE("%p\n", region);
815 if (!region)
816 return InvalidParameter;
818 delete_element(&region->node);
819 stat = init_region(region, RegionDataInfiniteRect);
821 return stat;
824 GpStatus WINGDIPAPI GdipTransformRegion(GpRegion *region, GpMatrix *matrix)
826 FIXME("(%p, %p): stub\n", region, matrix);
828 return NotImplemented;
831 GpStatus WINGDIPAPI GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy)
833 FIXME("(%p, %f, %f): stub\n", region, dx, dy);
835 return NotImplemented;
838 GpStatus WINGDIPAPI GdipTranslateRegionI(GpRegion *region, INT dx, INT dy)
840 FIXME("(%p, %d, %d): stub\n", region, dx, dy);
842 return NotImplemented;