/***************************************************************************** * GdipIsVisibleRegionPoint [GDIPLUS.@] */ GpStatus WINGDIPAPI GdipIsVisibleRegionPoint(GpRegion* region, REAL x, REAL y, GpGraphics *graphics, BOOL *res) { HRGN hrgn; GpStatus stat; TRACE("(%p, %.2f, %.2f, %p, %p)\n", region, x, y, graphics, res); if(!region || !res) return InvalidParameter; if((stat = GdipGetRegionHRgn(region, NULL, &hrgn)) != Ok) return stat; /* infinite */ if(!hrgn){ *res = TRUE; return Ok; } *res = PtInRegion(hrgn, gdip_round(x), gdip_round(y)); DeleteObject(hrgn); return Ok; }
static inline void write_packed_point(DWORD* location, INT* offset, const GpPointF* write) { packed_point *point = (packed_point *)(location + *offset); point->X = gdip_round(write->X); point->Y = gdip_round(write->Y); (*offset)++; }
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header) { ENHMETAHEADER3 emfheader; EmfPlusHeader emfplusheader; MetafileType metafile_type; TRACE("(%p,%p)\n", hemf, header); if(!hemf || !header) return InvalidParameter; if (GetEnhMetaFileHeader(hemf, sizeof(emfheader), (ENHMETAHEADER*)&emfheader) == 0) return GenericError; emfplusheader.Header.Type = 0; EnumEnhMetaFile(NULL, hemf, get_emfplus_header_proc, &emfplusheader, NULL); if (emfplusheader.Header.Type == EmfPlusRecordTypeHeader) { if ((emfplusheader.Header.Flags & 1) == 1) metafile_type = MetafileTypeEmfPlusDual; else metafile_type = MetafileTypeEmfPlusOnly; } else metafile_type = MetafileTypeEmf; header->Type = metafile_type; header->Size = emfheader.nBytes; header->DpiX = (REAL)emfheader.szlDevice.cx * 25.4 / emfheader.szlMillimeters.cx; header->DpiY = (REAL)emfheader.szlDevice.cy * 25.4 / emfheader.szlMillimeters.cy; header->X = gdip_round((REAL)emfheader.rclFrame.left / 2540.0 * header->DpiX); header->Y = gdip_round((REAL)emfheader.rclFrame.top / 2540.0 * header->DpiY); header->Width = gdip_round((REAL)(emfheader.rclFrame.right - emfheader.rclFrame.left) / 2540.0 * header->DpiX); header->Height = gdip_round((REAL)(emfheader.rclFrame.bottom - emfheader.rclFrame.top) / 2540.0 * header->DpiY); header->EmfHeader = emfheader; if (metafile_type == MetafileTypeEmfPlusDual || metafile_type == MetafileTypeEmfPlusOnly) { header->Version = emfplusheader.Version; header->EmfPlusFlags = emfplusheader.EmfPlusFlags; header->EmfPlusHeaderSize = emfplusheader.Header.Size; header->LogicalDpiX = emfplusheader.LogicalDpiX; header->LogicalDpiY = emfplusheader.LogicalDpiY; } else { header->Version = emfheader.nVersion; header->EmfPlusFlags = 0; header->EmfPlusHeaderSize = 0; header->LogicalDpiX = 0; header->LogicalDpiY = 0; } return Ok; }
/* Test to see if the path could be stored as an array of shorts */ static BOOL is_integer_path(const GpPath *path) { int i; if (!path->pathdata.Count) return FALSE; for (i = 0; i < path->pathdata.Count; i++) { short x, y; x = gdip_round(path->pathdata.Points[i].X); y = gdip_round(path->pathdata.Points[i].Y); if (path->pathdata.Points[i].X != (REAL)x || path->pathdata.Points[i].Y != (REAL)y) return FALSE; } return TRUE; }
/***************************************************************************** * GdipGetRegionBoundsI [GDIPLUS.@] */ GpStatus WINGDIPAPI GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, GpRect *rect) { GpRectF rectf; GpStatus status; TRACE("(%p, %p, %p)\n", region, graphics, rect); if(!rect) return InvalidParameter; status = GdipGetRegionBounds(region, graphics, &rectf); if(status == Ok){ rect->X = gdip_round(rectf.X); rect->Y = gdip_round(rectf.Y); rect->Width = gdip_round(rectf.Width); rect->Height = gdip_round(rectf.Height); } return status; }