12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613 |
- /*
- * gdiplusimpl.h
- *
- * GDI+ Bitmap, CachedBitmap, CustomLineCap, Font, FontCollection, FontFamily,
- * Image, InstalledFontCollection, PrivateFontCollection, Region
- * implementation. Definitions of these classes are in gdiplusheaders.h.
- *
- * This file is part of the w32api package.
- *
- * Contributors:
- * Created by Markus Koenig <markus@stber-koenig.de>
- *
- * THIS SOFTWARE IS NOT COPYRIGHTED
- *
- * This source code is offered for use in the public domain. You may
- * use, modify or distribute it freely.
- *
- * This code is distributed in the hope that it will be useful but
- * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- * DISCLAIMED. This includes but is not limited to warranties of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
- #ifndef __GDIPLUS_IMPL_H
- #define __GDIPLUS_IMPL_H
- #if __GNUC__ >=3
- #pragma GCC system_header
- #endif
- #ifndef __cplusplus
- #error "A C++ compiler is required to include gdiplusimpl.h."
- #endif
- /*
- * FIXME: I called this file gdiplusimpl.h, but what should it really be called?
- * Or did Microsoft create separate files for each class implemented here?
- */
- // Image
- __inline__ Image* Image::FromFile(const WCHAR *filename,
- BOOL useEmbeddedColorManagement)
- {
- return new Image(filename, useEmbeddedColorManagement);
- }
- __inline__ Image* Image::FromStream(IStream *stream,
- BOOL useEmbeddedColorManagement)
- {
- return new Image(stream, useEmbeddedColorManagement);
- }
- __inline__ Image::Image(const WCHAR *filename, BOOL useEmbeddedColorManagement):
- nativeImage(NULL), lastStatus(Ok)
- {
- if (useEmbeddedColorManagement) {
- lastStatus = DllExports::GdipLoadImageFromFileICM(
- filename, &nativeImage);
- } else {
- lastStatus = DllExports::GdipLoadImageFromFile(
- filename, &nativeImage);
- }
- }
- __inline__ Image::Image(IStream *stream, BOOL useEmbeddedColorManagement):
- nativeImage(NULL), lastStatus(Ok)
- {
- if (useEmbeddedColorManagement) {
- lastStatus = DllExports::GdipLoadImageFromStreamICM(
- stream, &nativeImage);
- } else {
- lastStatus = DllExports::GdipLoadImageFromStream(
- stream, &nativeImage);
- }
- }
- __inline__ Status Image::FindFirstItem(ImageItemData *item)
- {
- // FIXME: can't test GdipFindFirstImageItem b/c it isn't exported in 1.0
- return updateStatus(DllExports::GdipFindFirstImageItem(
- nativeImage, item));
- }
- __inline__ Status Image::FindNextItem(ImageItemData *item)
- {
- // FIXME: can't test GdipFindFirstImageItem b/c it isn't exported in 1.0
- return updateStatus(DllExports::GdipFindNextImageItem(
- nativeImage, item));
- }
- __inline__ Status Image::GetAllPropertyItems(UINT totalBufferSize,
- UINT numProperties, PropertyItem *allItems)
- {
- return updateStatus(DllExports::GdipGetAllPropertyItems(
- nativeImage, totalBufferSize, numProperties, allItems));
- }
- __inline__ Status Image::GetBounds(RectF *srcRect, Unit *srcUnit)
- {
- return updateStatus(DllExports::GdipGetImageBounds(
- nativeImage, srcRect, srcUnit));
- }
- __inline__ Status Image::GetEncoderParameterList(const CLSID *clsidEncoder,
- UINT size, EncoderParameters *buffer)
- {
- return updateStatus(DllExports::GdipGetEncoderParameterList(
- nativeImage, clsidEncoder, size, buffer));
- }
- __inline__ UINT Image::GetEncoderParameterListSize(const CLSID *clsidEncoder)
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetEncoderParameterListSize(
- nativeImage, clsidEncoder, &result));
- return result;
- }
- __inline__ UINT Image::GetFlags()
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetImageFlags(nativeImage, &result));
- return result;
- }
- __inline__ UINT Image::GetFrameCount(const GUID *dimensionID)
- {
- UINT result = 0;
- updateStatus(DllExports::GdipImageGetFrameCount(
- nativeImage, dimensionID, &result));
- return result;
- }
- __inline__ UINT Image::GetFrameDimensionsCount()
- {
- UINT result = 0;
- updateStatus(DllExports::GdipImageGetFrameDimensionsCount(
- nativeImage, &result));
- return result;
- }
- __inline__ Status Image::GetFrameDimensionsList(GUID *dimensionIDs, UINT count)
- {
- return updateStatus(DllExports::GdipImageGetFrameDimensionsList(
- nativeImage, dimensionIDs, count));
- }
- __inline__ UINT Image::GetHeight()
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetImageHeight(nativeImage, &result));
- return result;
- }
- __inline__ REAL Image::GetHorizontalResolution()
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetImageHorizontalResolution(
- nativeImage, &result));
- return result;
- }
- __inline__ Status Image::GetItemData(ImageItemData *item)
- {
- // FIXME: can't test GdipGetImageItemData b/c it isn't exported in 1.0
- return updateStatus(DllExports::GdipGetImageItemData(
- nativeImage, item));
- }
- __inline__ Status Image::GetPalette(ColorPalette *palette, INT size)
- {
- return updateStatus(DllExports::GdipGetImagePalette(
- nativeImage, palette, size));
- }
- __inline__ INT Image::GetPaletteSize()
- {
- INT result = 0;
- updateStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &result));
- return result;
- }
- __inline__ Status Image::GetPhysicalDimension(SizeF *size)
- {
- if (!size) return lastStatus = InvalidParameter;
- return updateStatus(DllExports::GdipGetImageDimension(
- nativeImage, &size->Width, &size->Height));
- }
- __inline__ PixelFormat Image::GetPixelFormat()
- {
- PixelFormat result = (PixelFormat) 0;
- updateStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &result));
- return result;
- }
- __inline__ UINT Image::GetPropertyCount()
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetPropertyCount(nativeImage, &result));
- return result;
- }
- __inline__ Status Image::GetPropertyIdList(UINT numOfProperty, PROPID *list)
- {
- return updateStatus(DllExports::GdipGetPropertyIdList(
- nativeImage, numOfProperty, list));
- }
- __inline__ Status Image::GetPropertyItem(PROPID propId, UINT propSize,
- PropertyItem *buffer)
- {
- return updateStatus(DllExports::GdipGetPropertyItem(
- nativeImage, propId, propSize, buffer));
- }
- __inline__ UINT Image::GetPropertyItemSize(PROPID propId)
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetPropertyItemSize(
- nativeImage, propId, &result));
- return result;
- }
- __inline__ Status Image::GetPropertySize(
- UINT *totalBufferSize, UINT *numProperties)
- {
- return updateStatus(DllExports::GdipGetPropertySize(
- nativeImage, totalBufferSize, numProperties));
- }
- __inline__ Status Image::GetRawFormat(GUID *format)
- {
- return updateStatus(DllExports::GdipGetImageRawFormat(
- nativeImage, format));
- }
- __inline__ Image* Image::GetThumbnailImage(UINT thumbWidth, UINT thumbHeight,
- GetThumbnailImageAbort callback, VOID *callbackData)
- {
- GpImage *thumbImage = NULL;
- Status status = updateStatus(DllExports::GdipGetImageThumbnail(
- nativeImage, thumbWidth, thumbHeight, &thumbImage,
- callback, callbackData));
- if (status == Ok) {
- Image *result = new Image(thumbImage, Ok);
- if (!result) {
- DllExports::GdipDisposeImage(thumbImage);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- __inline__ ImageType Image::GetType() const
- {
- ImageType result = ImageTypeUnknown;
- updateStatus(DllExports::GdipGetImageType(nativeImage, &result));
- return result;
- }
- __inline__ REAL Image::GetVerticalResolution()
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetImageVerticalResolution(
- nativeImage, &result));
- return result;
- }
- __inline__ UINT Image::GetWidth()
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetImageWidth(nativeImage, &result));
- return result;
- }
- __inline__ Status Image::RemovePropertyItem(PROPID propId)
- {
- return updateStatus(DllExports::GdipRemovePropertyItem(
- nativeImage, propId));
- }
- __inline__ Status Image::RotateFlip(RotateFlipType rotateFlipType)
- {
- return updateStatus(DllExports::GdipImageRotateFlip(
- nativeImage, rotateFlipType));
- }
- __inline__ Status Image::Save(const WCHAR *filename, const CLSID *clsidEncoder,
- const EncoderParameters *encoderParams)
- {
- return updateStatus(DllExports::GdipSaveImageToFile(
- nativeImage, filename, clsidEncoder, encoderParams));
- }
- __inline__ Status Image::Save(IStream *stream, const CLSID *clsidEncoder,
- const EncoderParameters *encoderParams)
- {
- return updateStatus(DllExports::GdipSaveImageToStream(
- nativeImage, stream, clsidEncoder, encoderParams));
- }
- __inline__ Status Image::SaveAdd(const EncoderParameters *encoderParams)
- {
- return updateStatus(DllExports::GdipSaveAdd(
- nativeImage, encoderParams));
- }
- __inline__ Status Image::SaveAdd(Image *newImage,
- const EncoderParameters *encoderParams)
- {
- return updateStatus(DllExports::GdipSaveAddImage(
- nativeImage,
- newImage ? newImage->nativeImage : NULL,
- encoderParams));
- }
- __inline__ Status Image::SelectActiveFrame(
- const GUID *dimensionID, UINT frameIndex)
- {
- return updateStatus(DllExports::GdipImageSelectActiveFrame(
- nativeImage, dimensionID, frameIndex));
- }
- __inline__ Status Image::SetAbort(GdiplusAbort *pIAbort)
- {
- // FIXME: can't test GdipImageSetAbort because it isn't exported in 1.0
- return updateStatus(DllExports::GdipImageSetAbort(
- nativeImage, pIAbort));
- }
- __inline__ Status Image::SetPalette(const ColorPalette *palette)
- {
- return updateStatus(DllExports::GdipSetImagePalette(
- nativeImage, palette));
- }
- __inline__ Status Image::SetPropertyItem(const PropertyItem *item)
- {
- return updateStatus(DllExports::GdipSetPropertyItem(nativeImage, item));
- }
- // Bitmap
- __inline__ Bitmap* Bitmap::FromBITMAPINFO(const BITMAPINFO *gdiBitmapInfo,
- VOID *gdiBitmapData)
- {
- return new Bitmap(gdiBitmapInfo, gdiBitmapData);
- }
- __inline__ Bitmap* Bitmap::FromDirectDrawSurface7(IDirectDrawSurface7 *surface)
- {
- return new Bitmap(surface);
- }
- __inline__ Bitmap* Bitmap::FromFile(const WCHAR *filename,
- BOOL useEmbeddedColorManagement)
- {
- return new Bitmap(filename, useEmbeddedColorManagement);
- }
- __inline__ Bitmap* Bitmap::FromHBITMAP(HBITMAP hbm, HPALETTE hpal)
- {
- return new Bitmap(hbm, hpal);
- }
- __inline__ Bitmap* Bitmap::FromHICON(HICON icon)
- {
- return new Bitmap(icon);
- }
- __inline__ Bitmap* Bitmap::FromResource(
- HINSTANCE hInstance, const WCHAR *bitmapName)
- {
- return new Bitmap(hInstance, bitmapName);
- }
- __inline__ Bitmap* Bitmap::FromStream(IStream *stream,
- BOOL useEmbeddedColorManagement)
- {
- return new Bitmap(stream, useEmbeddedColorManagement);
- }
- //TODO: [GDI+ 1.1] Bitmap::ApplyEffect
- //__inline__ Status Bitmap::ApplyEffect(Bitmap **inputs, INT numInputs,
- // Effect *effect, RECT *ROI, RECT *outputRect, Bitmap **output)
- //{
- // return NotImplemented;
- //}
- __inline__ Status Bitmap::InitializePalette(ColorPalette *palette,
- PaletteType paletteType, INT optimalColors,
- BOOL useTransparentColor, Bitmap *bitmap)
- {
- // FIXME: can't test GdipInitializePalette b/c it isn't exported in 1.0
- return DllExports::GdipInitializePalette(palette, paletteType,
- optimalColors, useTransparentColor,
- bitmap ? (GpBitmap*) bitmap->nativeImage : NULL);
- }
- __inline__ Bitmap::Bitmap(const BITMAPINFO *gdiBitmapInfo, VOID *gdiBitmapData):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromGdiDib(
- gdiBitmapInfo, gdiBitmapData, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(IDirectDrawSurface7 *surface): Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromDirectDrawSurface(
- surface, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(const WCHAR *filename,
- BOOL useEmbeddedColorManagement): Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- if (useEmbeddedColorManagement) {
- lastStatus = DllExports::GdipCreateBitmapFromFileICM(
- filename, &nativeBitmap);
- } else {
- lastStatus = DllExports::GdipCreateBitmapFromFile(
- filename, &nativeBitmap);
- }
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(HBITMAP hbm, HPALETTE hpal):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromHBITMAP(
- hbm, hpal, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(HICON hicon):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromHICON(hicon, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(HINSTANCE hInstance, const WCHAR *bitmapName):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromResource(
- hInstance, bitmapName, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(IStream *stream, BOOL useEmbeddedColorManagement):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- if (useEmbeddedColorManagement) {
- lastStatus = DllExports::GdipCreateBitmapFromStreamICM(
- stream, &nativeBitmap);
- } else {
- lastStatus = DllExports::GdipCreateBitmapFromStream(
- stream, &nativeBitmap);
- }
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(INT width, INT height, Graphics *target):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromGraphics(
- width, height, target ? target->nativeGraphics : NULL,
- &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(INT width, INT height, PixelFormat format):
- Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromScan0(
- width, height, 0, format, NULL, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap::Bitmap(INT width, INT height, INT stride,
- PixelFormat format, BYTE *scan0): Image(NULL, Ok)
- {
- GpBitmap *nativeBitmap = NULL;
- lastStatus = DllExports::GdipCreateBitmapFromScan0(
- width, height, stride, format, scan0, &nativeBitmap);
- nativeImage = nativeBitmap;
- }
- __inline__ Bitmap* Bitmap::Clone(const RectF& rect, PixelFormat format) const
- {
- return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
- }
- __inline__ Bitmap* Bitmap::Clone(const Rect& rect, PixelFormat format) const
- {
- return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
- }
- __inline__ Bitmap* Bitmap::Clone(REAL x, REAL y, REAL width, REAL height,
- PixelFormat format) const
- {
- GpBitmap *cloneBitmap = NULL;
- Status status = updateStatus(DllExports::GdipCloneBitmapArea(
- x, y, width, height, format,
- (GpBitmap*) nativeImage, &cloneBitmap));
- if (status == Ok) {
- Bitmap *result = new Bitmap(cloneBitmap, lastStatus);
- if (!result) {
- DllExports::GdipDisposeImage(cloneBitmap);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- __inline__ Bitmap* Bitmap::Clone(INT x, INT y, INT width, INT height,
- PixelFormat format) const
- {
- GpBitmap *cloneBitmap = NULL;
- Status status = updateStatus(DllExports::GdipCloneBitmapAreaI(
- x, y, width, height, format,
- (GpBitmap*) nativeImage, &cloneBitmap));
- if (status == Ok) {
- Bitmap *result = new Bitmap(cloneBitmap, lastStatus);
- if (!result) {
- DllExports::GdipDisposeImage(cloneBitmap);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- //TODO: [GDI+ 1.1] Bitmap::ApplyEffect
- //__inline__ Status Bitmap::ApplyEffect(Effect *effect, RECT *ROI)
- //{
- // return NotImplemented;
- //}
- __inline__ Status Bitmap::ConvertFormat(PixelFormat format,
- DitherType ditherType, PaletteType paletteType,
- ColorPalette *palette, REAL alphaThresholdPercent)
- {
- // FIXME: can't test GdipBitmapConvertFormat b/c it isn't exported in 1.0
- return updateStatus(DllExports::GdipBitmapConvertFormat(
- (GpBitmap*) nativeImage, format, ditherType,
- paletteType, palette, alphaThresholdPercent));
- }
- __inline__ Status Bitmap::GetHBITMAP(
- const Color& colorBackground, HBITMAP *hbmReturn) const
- {
- return updateStatus(DllExports::GdipCreateHBITMAPFromBitmap(
- (GpBitmap*) nativeImage, hbmReturn,
- colorBackground.GetValue()));
- }
- __inline__ Status Bitmap::GetHICON(HICON *icon) const
- {
- return updateStatus(DllExports::GdipCreateHICONFromBitmap(
- (GpBitmap*) nativeImage, icon));
- }
- __inline__ Status Bitmap::GetHistogram(HistogramFormat format,
- UINT numberOfEntries,
- UINT *channel0, UINT *channel1,
- UINT *channel2, UINT *channel3) const
- {
- return updateStatus(DllExports::GdipBitmapGetHistogram(
- (GpBitmap*) nativeImage, format, numberOfEntries,
- channel0, channel1, channel2, channel3));
- }
- __inline__ Status Bitmap::GetHistogramSize(HistogramFormat format,
- UINT *numberOfEntries) const
- {
- return updateStatus(DllExports::GdipBitmapGetHistogramSize(
- format, numberOfEntries));
- }
- __inline__ Status Bitmap::GetPixel(INT x, INT y, Color *color) const
- {
- return updateStatus(DllExports::GdipBitmapGetPixel(
- (GpBitmap*) nativeImage, x, y,
- color ? &color->Value : NULL));
- }
- __inline__ Status Bitmap::LockBits(const Rect *rect, UINT flags,
- PixelFormat format, BitmapData *lockedBitmapData)
- {
- return updateStatus(DllExports::GdipBitmapLockBits(
- (GpBitmap*) nativeImage, rect, flags, format,
- lockedBitmapData));
- }
- __inline__ Status Bitmap::SetPixel(INT x, INT y, const Color& color)
- {
- return updateStatus(DllExports::GdipBitmapSetPixel(
- (GpBitmap*) nativeImage, x, y, color.GetValue()));
- }
- __inline__ Status Bitmap::SetResolution(REAL xdpi, REAL ydpi)
- {
- return updateStatus(DllExports::GdipBitmapSetResolution(
- (GpBitmap*) nativeImage, xdpi, ydpi));
- }
- __inline__ Status Bitmap::UnlockBits(BitmapData *lockedBitmapData)
- {
- return updateStatus(DllExports::GdipBitmapUnlockBits(
- (GpBitmap*) nativeImage, lockedBitmapData));
- }
- // CachedBitmap
- __inline__ CachedBitmap::CachedBitmap(Bitmap *bitmap, Graphics *graphics):
- nativeCachedBitmap(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateCachedBitmap(
- bitmap ? ((GpBitmap*) bitmap->nativeImage) : NULL,
- graphics ? graphics->nativeGraphics : NULL,
- &nativeCachedBitmap);
- }
- __inline__ CachedBitmap::~CachedBitmap()
- {
- DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap);
- }
- // CustomLineCap
- __inline__ CustomLineCap::CustomLineCap(
- const GraphicsPath *fillPath,
- const GraphicsPath *strokePath,
- LineCap baseCap, REAL baseInset):
- nativeCustomLineCap(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateCustomLineCap(
- fillPath ? fillPath->nativePath : NULL,
- strokePath ? strokePath->nativePath : NULL,
- baseCap, baseInset, &nativeCustomLineCap);
- }
- __inline__ LineCap CustomLineCap::GetBaseCap() const
- {
- LineCap result = LineCapFlat;
- updateStatus(DllExports::GdipGetCustomLineCapBaseCap(
- nativeCustomLineCap, &result));
- return result;
- }
- __inline__ REAL CustomLineCap::GetBaseInset() const
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetCustomLineCapBaseInset(
- nativeCustomLineCap, &result));
- return result;
- }
- __inline__ Status CustomLineCap::GetStrokeCaps(LineCap *startCap,
- LineCap *endCap) const
- {
- return updateStatus(DllExports::GdipGetCustomLineCapStrokeCaps(
- nativeCustomLineCap, startCap, endCap));
- }
- __inline__ LineJoin CustomLineCap::GetStrokeJoin() const
- {
- LineJoin result = LineJoinMiter;
- updateStatus(DllExports::GdipGetCustomLineCapStrokeJoin(
- nativeCustomLineCap, &result));
- return result;
- }
- __inline__ REAL CustomLineCap::GetWidthScale() const
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetCustomLineCapWidthScale(
- nativeCustomLineCap, &result));
- return result;
- }
- __inline__ Status CustomLineCap::SetBaseCap(LineCap baseCap)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapBaseCap(
- nativeCustomLineCap, baseCap));
- }
- __inline__ Status CustomLineCap::SetBaseInset(REAL inset)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapBaseInset(
- nativeCustomLineCap, inset));
- }
- __inline__ Status CustomLineCap::SetStrokeCap(LineCap strokeCap)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapStrokeCaps(
- nativeCustomLineCap, strokeCap, strokeCap));
- }
- __inline__ Status CustomLineCap::SetStrokeCaps(LineCap startCap, LineCap endCap)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapStrokeCaps(
- nativeCustomLineCap, startCap, endCap));
- }
- __inline__ Status CustomLineCap::SetStrokeJoin(LineJoin lineJoin)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapStrokeJoin(
- nativeCustomLineCap, lineJoin));
- }
- __inline__ Status CustomLineCap::SetWidthScale(REAL widthScale)
- {
- return updateStatus(DllExports::GdipSetCustomLineCapWidthScale(
- nativeCustomLineCap, widthScale));
- }
- // Font
- __inline__ Font::Font(const FontFamily *family,
- REAL emSize, INT style, Unit unit):
- nativeFont(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateFont(
- family ? family->nativeFontFamily : NULL,
- emSize, style, unit, &nativeFont);
- }
- __inline__ Font::Font(HDC hdc, HFONT hfont):
- nativeFont(NULL), lastStatus(Ok)
- {
- LOGFONTA logfont;
- if (hfont && GetObjectA(hfont, sizeof logfont, &logfont)) {
- lastStatus = DllExports::GdipCreateFontFromLogfontA(
- hdc, &logfont, &nativeFont);
- } else {
- lastStatus = DllExports::GdipCreateFontFromDC(
- hdc, &nativeFont);
- }
- }
- __inline__ Font::Font(HDC hdc, const LOGFONTA *logfont):
- nativeFont(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateFontFromLogfontA(
- hdc, logfont, &nativeFont);
- }
- __inline__ Font::Font(HDC hdc, const LOGFONTW *logfont):
- nativeFont(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateFontFromLogfontW(
- hdc, logfont, &nativeFont);
- }
- __inline__ Font::Font(HDC hdc):
- nativeFont(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateFontFromDC(hdc, &nativeFont);
- }
- __inline__ Font::Font(const WCHAR *familyName, REAL emSize, INT style,
- Unit unit, const FontCollection *fontCollection):
- nativeFont(NULL), lastStatus(Ok)
- {
- GpFontFamily *nativeFamily = NULL;
- lastStatus = DllExports::GdipCreateFontFamilyFromName(
- familyName,
- fontCollection ? fontCollection->nativeFontCollection : NULL,
- &nativeFamily);
- if (nativeFamily) {
- lastStatus = DllExports::GdipCreateFont(
- nativeFamily, emSize, style, unit, &nativeFont);
- DllExports::GdipDeleteFontFamily(nativeFamily);
- }
- }
- __inline__ Font::~Font()
- {
- DllExports::GdipDeleteFont(nativeFont);
- }
- __inline__ Font* Font::Clone() const
- {
- GpFont *cloneFont = NULL;
- Status status = updateStatus(DllExports::GdipCloneFont(
- nativeFont, &cloneFont));
- if (status == Ok) {
- Font *result = new Font(cloneFont, lastStatus);
- if (!result) {
- DllExports::GdipDeleteFont(cloneFont);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- __inline__ Status Font::GetFamily(FontFamily *family) const
- {
- if (!family) return lastStatus = InvalidParameter;
- // FIXME: do we need to call GdipDeleteFontFamily first?
- return family->lastStatus = updateStatus(DllExports::GdipGetFamily(
- nativeFont, &family->nativeFontFamily));
- }
- __inline__ REAL Font::GetHeight(const Graphics *graphics) const
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetFontHeight(
- nativeFont, graphics ? graphics->nativeGraphics : NULL,
- &result));
- return result;
- }
- __inline__ REAL Font::GetHeight(REAL dpi) const
- {
- REAL result = 0.0f;
- updateStatus(DllExports::GdipGetFontHeightGivenDPI(
- nativeFont, dpi, &result));
- return result;
- }
- __inline__ Status Font::GetLogFontA(const Graphics *graphics, LOGFONTA *logfontA)
- const
- {
- return updateStatus(DllExports::GdipGetLogFontA(
- nativeFont, graphics ? graphics->nativeGraphics : NULL,
- logfontA));
- }
- __inline__ Status Font::GetLogFontW(const Graphics *graphics, LOGFONTW *logfontW)
- const
- {
- return updateStatus(DllExports::GdipGetLogFontW(
- nativeFont, graphics ? graphics->nativeGraphics : NULL,
- logfontW));
- }
- __inline__ REAL Font::GetSize() const
- {
- REAL result = 0.0;
- updateStatus(DllExports::GdipGetFontSize(nativeFont, &result));
- return result;
- }
- __inline__ INT Font::GetStyle() const
- {
- INT result = FontStyleRegular;
- updateStatus(DllExports::GdipGetFontStyle(nativeFont, &result));
- return result;
- }
- __inline__ Unit Font::GetUnit() const
- {
- Unit result = UnitPoint;
- updateStatus(DllExports::GdipGetFontUnit(nativeFont, &result));
- return result;
- }
- // FontCollection
- __inline__ FontCollection::FontCollection():
- nativeFontCollection(NULL), lastStatus(Ok)
- {
- }
- __inline__ Status FontCollection::GetFamilies(INT numSought,
- FontFamily *families, INT *numFound) const
- {
- if (numSought <= 0 || !families || !numFound)
- return lastStatus = InvalidParameter;
- for (int i = 0; i < numSought; ++i) {
- families[i].nativeFontFamily = NULL;
- families[i].lastStatus = FontFamilyNotFound;
- }
- *numFound = 0;
- GpFontFamily **nativeFamilyArray = (GpFontFamily**)
- DllExports::GdipAlloc(numSought * sizeof (GpFontFamily*));
- if (!nativeFamilyArray)
- return lastStatus = OutOfMemory;
- Status status = updateStatus(DllExports::GdipGetFontCollectionFamilyList(
- nativeFontCollection, numSought, nativeFamilyArray,
- numFound));
- // FIXME: must the native GpFontFamily objects be cloned? Seems so.
- // (if this is not done, the "Creating a Private Font Collection"
- // example crashes on "delete[] pFontFamily")
- if (status == Ok) {
- for (int i = 0; i < *numFound; ++i) {
- families[i].lastStatus =
- updateStatus(DllExports::GdipCloneFontFamily(
- nativeFamilyArray[i],
- &families[i].nativeFontFamily));
- }
- }
- DllExports::GdipFree(nativeFamilyArray);
- return status;
- }
- __inline__ INT FontCollection::GetFamilyCount() const
- {
- INT result = 0;
- updateStatus(DllExports::GdipGetFontCollectionFamilyCount(
- nativeFontCollection, &result));
- return result;
- }
- // FontFamily
- // FIXME: do FontFamily::GenericMonospace() et al. need to be thread safe?
- // FIXME: maybe put parts of this in gdiplus.c
- extern "C" void *_GdipFontFamilyCachedGenericMonospace;
- extern "C" void *_GdipFontFamilyCachedGenericSansSerif;
- extern "C" void *_GdipFontFamilyCachedGenericSerif;
- __inline__ const FontFamily* FontFamily::GenericMonospace()
- {
- if (!_GdipFontFamilyCachedGenericMonospace) {
- GpFontFamily *nativeFontFamily = 0;
- Status status = DllExports::GdipGetGenericFontFamilyMonospace(
- &nativeFontFamily);
- if (status == Ok && nativeFontFamily) {
- _GdipFontFamilyCachedGenericMonospace = (void*)
- new FontFamily(nativeFontFamily, Ok);
- }
- }
- return (FontFamily*) _GdipFontFamilyCachedGenericMonospace;
- }
- __inline__ const FontFamily* FontFamily::GenericSansSerif()
- {
- if (!_GdipFontFamilyCachedGenericSansSerif) {
- GpFontFamily *nativeFontFamily = 0;
- Status status = DllExports::GdipGetGenericFontFamilySansSerif(
- &nativeFontFamily);
- if (status == Ok && nativeFontFamily) {
- _GdipFontFamilyCachedGenericSansSerif = (void*)
- new FontFamily(nativeFontFamily, Ok);
- }
- }
- return (FontFamily*) _GdipFontFamilyCachedGenericSansSerif;
- }
- __inline__ const FontFamily* FontFamily::GenericSerif()
- {
- if (!_GdipFontFamilyCachedGenericSerif) {
- GpFontFamily *nativeFontFamily = 0;
- Status status = DllExports::GdipGetGenericFontFamilySerif(
- &nativeFontFamily);
- if (status == Ok && nativeFontFamily) {
- _GdipFontFamilyCachedGenericSerif = (void*)
- new FontFamily(nativeFontFamily, Ok);
- }
- }
- return (FontFamily*) _GdipFontFamilyCachedGenericSerif;
- }
- __inline__ FontFamily::FontFamily():
- nativeFontFamily(NULL), lastStatus(Ok)
- {
- }
- __inline__ FontFamily::FontFamily(const WCHAR *name,
- const FontCollection *fontCollection):
- nativeFontFamily(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateFontFamilyFromName(name,
- fontCollection ? fontCollection->nativeFontCollection : NULL,
- &nativeFontFamily);
- }
- __inline__ FontFamily::~FontFamily()
- {
- DllExports::GdipDeleteFontFamily(nativeFontFamily);
- }
- __inline__ FontFamily* FontFamily::Clone() const
- {
- GpFontFamily *cloneFontFamily = NULL;
- Status status = updateStatus(DllExports::GdipCloneFontFamily(
- nativeFontFamily, &cloneFontFamily));
- if (status == Ok) {
- FontFamily *result = new FontFamily(cloneFontFamily, lastStatus);
- if (!result) {
- DllExports::GdipDeleteFontFamily(cloneFontFamily);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- __inline__ UINT16 FontFamily::GetCellAscent(INT style) const
- {
- UINT16 result = 0;
- updateStatus(DllExports::GdipGetCellAscent(
- nativeFontFamily, style, &result));
- return result;
- }
- __inline__ UINT16 FontFamily::GetCellDescent(INT style) const
- {
- UINT16 result = 0;
- updateStatus(DllExports::GdipGetCellDescent(
- nativeFontFamily, style, &result));
- return result;
- }
- __inline__ UINT16 FontFamily::GetEmHeight(INT style) const
- {
- UINT16 result = 0;
- updateStatus(DllExports::GdipGetEmHeight(
- nativeFontFamily, style, &result));
- return result;
- }
- __inline__ Status FontFamily::GetFamilyName(WCHAR name[LF_FACESIZE],
- LANGID language) const
- {
- return updateStatus(DllExports::GdipGetFamilyName(
- nativeFontFamily, name, language));
- }
- __inline__ UINT16 FontFamily::GetLineSpacing(INT style) const
- {
- UINT16 result = 0;
- updateStatus(DllExports::GdipGetLineSpacing(
- nativeFontFamily, style, &result));
- return result;
- }
- __inline__ BOOL FontFamily::IsStyleAvailable(INT style) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsStyleAvailable(
- nativeFontFamily, style, &result));
- return result;
- }
- // InstalledFontCollection
- __inline__ InstalledFontCollection::InstalledFontCollection()
- {
- lastStatus = DllExports::GdipNewInstalledFontCollection(
- &nativeFontCollection);
- }
- // PrivateFontCollection
- __inline__ PrivateFontCollection::PrivateFontCollection()
- {
- lastStatus = DllExports::GdipNewPrivateFontCollection(
- &nativeFontCollection);
- }
- __inline__ Status PrivateFontCollection::AddFontFile(const WCHAR *filename)
- {
- return updateStatus(DllExports::GdipPrivateAddFontFile(
- nativeFontCollection, filename));
- }
- __inline__ Status PrivateFontCollection::AddMemoryFont(
- const VOID *memory, INT length)
- {
- return updateStatus(DllExports::GdipPrivateAddMemoryFont(
- nativeFontCollection, memory, length));
- }
- // Region
- __inline__ Region* Region::FromHRGN(HRGN hrgn)
- {
- return new Region(hrgn);
- }
- __inline__ Region::Region(): nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegion(&nativeRegion);
- }
- __inline__ Region::Region(const RectF& rect): nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegionRect(&rect, &nativeRegion);
- }
- __inline__ Region::Region(const Rect& rect): nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegionRectI(&rect, &nativeRegion);
- }
- __inline__ Region::Region(const GraphicsPath *path):
- nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegionPath(
- path ? path->nativePath : NULL, &nativeRegion);
- }
- __inline__ Region::Region(const BYTE *regionData, INT size):
- nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegionRgnData(
- regionData, size, &nativeRegion);
- }
- __inline__ Region::Region(HRGN hrgn): nativeRegion(NULL), lastStatus(Ok)
- {
- lastStatus = DllExports::GdipCreateRegionHrgn(hrgn, &nativeRegion);
- }
- __inline__ Region::~Region()
- {
- DllExports::GdipDeleteRegion(nativeRegion);
- }
- __inline__ Region* Region::Clone() const
- {
- GpRegion *cloneRegion = NULL;
- Status status = updateStatus(DllExports::GdipCloneRegion(
- nativeRegion, &cloneRegion));
- if (status == Ok) {
- Region *result = new Region(cloneRegion, lastStatus);
- if (!result) {
- DllExports::GdipDeleteRegion(cloneRegion);
- lastStatus = OutOfMemory;
- }
- return result;
- } else {
- return NULL;
- }
- }
- __inline__ Status Region::Complement(const RectF& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRect(
- nativeRegion, &rect, CombineModeComplement));
- }
- __inline__ Status Region::Complement(const Rect& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRectI(
- nativeRegion, &rect, CombineModeComplement));
- }
- __inline__ Status Region::Complement(const Region *region)
- {
- return updateStatus(DllExports::GdipCombineRegionRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- CombineModeComplement));
- }
- __inline__ Status Region::Complement(const GraphicsPath *path)
- {
- return updateStatus(DllExports::GdipCombineRegionPath(
- nativeRegion, path ? path->nativePath : NULL,
- CombineModeComplement));
- }
- __inline__ BOOL Region::Equals(const Region *region, const Graphics *graphics)
- const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsEqualRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ Status Region::Exclude(const RectF& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRect(
- nativeRegion, &rect, CombineModeExclude));
- }
- __inline__ Status Region::Exclude(const Rect& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRectI(
- nativeRegion, &rect, CombineModeExclude));
- }
- __inline__ Status Region::Exclude(const Region *region)
- {
- return updateStatus(DllExports::GdipCombineRegionRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- CombineModeExclude));
- }
- __inline__ Status Region::Exclude(const GraphicsPath *path)
- {
- return updateStatus(DllExports::GdipCombineRegionPath(
- nativeRegion, path ? path->nativePath : NULL,
- CombineModeExclude));
- }
- __inline__ Status Region::GetBounds(RectF *rect, const Graphics *graphics) const
- {
- return updateStatus(DllExports::GdipGetRegionBounds(nativeRegion,
- graphics ? graphics->nativeGraphics : NULL, rect));
- }
- __inline__ Status Region::GetBounds(Rect *rect, const Graphics *graphics) const
- {
- return updateStatus(DllExports::GdipGetRegionBoundsI(nativeRegion,
- graphics ? graphics->nativeGraphics : NULL, rect));
- }
- __inline__ Status Region::GetData(BYTE *buffer, UINT bufferSize,
- UINT *sizeFilled) const
- {
- return updateStatus(DllExports::GdipGetRegionData(
- nativeRegion, buffer, bufferSize, sizeFilled));
- }
- __inline__ UINT Region::GetDataSize() const
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetRegionDataSize(nativeRegion, &result));
- return result;
- }
- __inline__ HRGN Region::GetHRGN(const Graphics *graphics) const
- {
- HRGN result = NULL;
- updateStatus(DllExports::GdipGetRegionHRgn(nativeRegion,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ Status Region::GetRegionScans(const Matrix *matrix,
- RectF *rects, INT *count) const
- {
- return updateStatus(DllExports::GdipGetRegionScans(
- nativeRegion, rects, count,
- matrix ? matrix->nativeMatrix : NULL));
- }
- __inline__ Status Region::GetRegionScans(const Matrix *matrix,
- Rect *rects, INT *count) const
- {
- return updateStatus(DllExports::GdipGetRegionScansI(
- nativeRegion, rects, count,
- matrix ? matrix->nativeMatrix : NULL));
- }
- __inline__ UINT Region::GetRegionScansCount(const Matrix *matrix) const
- {
- UINT result = 0;
- updateStatus(DllExports::GdipGetRegionScansCount(
- nativeRegion, &result,
- matrix ? matrix->nativeMatrix : NULL));
- return result;
- }
- __inline__ Status Region::Intersect(const RectF& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRect(
- nativeRegion, &rect, CombineModeIntersect));
- }
- __inline__ Status Region::Intersect(const Rect& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRectI(
- nativeRegion, &rect, CombineModeIntersect));
- }
- __inline__ Status Region::Intersect(const Region *region)
- {
- return updateStatus(DllExports::GdipCombineRegionRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- CombineModeIntersect));
- }
- __inline__ Status Region::Intersect(const GraphicsPath *path)
- {
- return updateStatus(DllExports::GdipCombineRegionPath(
- nativeRegion, path ? path->nativePath : NULL,
- CombineModeIntersect));
- }
- __inline__ BOOL Region::IsEmpty(const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsEmptyRegion(nativeRegion,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsInfinite(const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsInfiniteRegion(nativeRegion,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(REAL x, REAL y,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionPoint(
- nativeRegion, x, y,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(INT x, INT y,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionPointI(
- nativeRegion, x, y,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(const PointF& point,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionPoint(
- nativeRegion, point.X, point.Y,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(const Point& point,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionPointI(
- nativeRegion, point.X, point.Y,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(REAL x, REAL y, REAL width, REAL height,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionRect(
- nativeRegion, x, y, width, height,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(INT x, INT y, INT width, INT height,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionRectI(
- nativeRegion, x, y, width, height,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(const RectF& rect,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionRect(
- nativeRegion, rect.X, rect.Y, rect.Width, rect.Height,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL Region::IsVisible(const Rect& rect,
- const Graphics *graphics) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisibleRegionRectI(
- nativeRegion, rect.X, rect.Y, rect.Width, rect.Height,
- graphics ? graphics->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ Status Region::MakeEmpty()
- {
- return updateStatus(DllExports::GdipSetEmpty(nativeRegion));
- }
- __inline__ Status Region::MakeInfinite()
- {
- return updateStatus(DllExports::GdipSetInfinite(nativeRegion));
- }
- __inline__ Status Region::Transform(const Matrix *matrix)
- {
- return updateStatus(DllExports::GdipTransformRegion(
- nativeRegion, matrix ? matrix->nativeMatrix : NULL));
- }
- __inline__ Status Region::Translate(REAL dx, REAL dy)
- {
- return updateStatus(DllExports::GdipTranslateRegion(
- nativeRegion, dx, dy));
- }
- __inline__ Status Region::Translate(INT dx, INT dy)
- {
- return updateStatus(DllExports::GdipTranslateRegionI(
- nativeRegion, dx, dy));
- }
- __inline__ Status Region::Union(const RectF& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRect(
- nativeRegion, &rect, CombineModeUnion));
- }
- __inline__ Status Region::Union(const Rect& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRectI(
- nativeRegion, &rect, CombineModeUnion));
- }
- __inline__ Status Region::Union(const Region *region)
- {
- return updateStatus(DllExports::GdipCombineRegionRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- CombineModeUnion));
- }
- __inline__ Status Region::Union(const GraphicsPath *path)
- {
- return updateStatus(DllExports::GdipCombineRegionPath(
- nativeRegion, path ? path->nativePath : NULL,
- CombineModeUnion));
- }
- __inline__ Status Region::Xor(const RectF& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRect(
- nativeRegion, &rect, CombineModeXor));
- }
- __inline__ Status Region::Xor(const Rect& rect)
- {
- return updateStatus(DllExports::GdipCombineRegionRectI(
- nativeRegion, &rect, CombineModeXor));
- }
- __inline__ Status Region::Xor(const Region *region)
- {
- return updateStatus(DllExports::GdipCombineRegionRegion(
- nativeRegion, region ? region->nativeRegion : NULL,
- CombineModeXor));
- }
- __inline__ Status Region::Xor(const GraphicsPath *path)
- {
- return updateStatus(DllExports::GdipCombineRegionPath(
- nativeRegion, path ? path->nativePath : NULL,
- CombineModeXor));
- }
- // GraphicsPath
- __inline__ BOOL GraphicsPath::IsOutlineVisible(REAL x, REAL y, const Pen *pen,
- const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsOutlineVisiblePathPoint(
- nativePath, x, y, pen ? pen->nativePen : NULL,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsOutlineVisible(INT x, INT y, const Pen *pen,
- const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsOutlineVisiblePathPointI(
- nativePath, x, y, pen ? pen->nativePen : NULL,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsOutlineVisible(const PointF& point, const Pen *pen,
- const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsOutlineVisiblePathPoint(
- nativePath, point.X, point.Y,
- pen ? pen->nativePen : NULL,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsOutlineVisible(const Point& point, const Pen *pen,
- const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsOutlineVisiblePathPointI(
- nativePath, point.X, point.Y,
- pen ? pen->nativePen : NULL,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsVisible(REAL x, REAL y, const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisiblePathPoint(
- nativePath, x, y,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsVisible(INT x, INT y, const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisiblePathPointI(
- nativePath, x, y,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsVisible(const PointF& point,
- const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisiblePathPoint(
- nativePath, point.X, point.Y,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- __inline__ BOOL GraphicsPath::IsVisible(const Point& point, const Graphics *g) const
- {
- BOOL result = FALSE;
- updateStatus(DllExports::GdipIsVisiblePathPointI(
- nativePath, point.X, point.Y,
- g ? g->nativeGraphics : NULL, &result));
- return result;
- }
- // PathData
- __inline__ Status PathData::AllocateArrays(INT capacity)
- {
- if (capacity < 0) {
- return InvalidParameter;
- } else if (Count < capacity) {
- FreeArrays();
- PointF *pointArray = (PointF*)
- DllExports::GdipAlloc(capacity * sizeof(PointF));
- if (!pointArray)
- return OutOfMemory;
- BYTE *typeArray = (BYTE*)
- DllExports::GdipAlloc(capacity * sizeof(BYTE));
- if (!typeArray) {
- DllExports::GdipFree(pointArray);
- return OutOfMemory;
- }
- Count = capacity;
- Points = pointArray;
- Types = typeArray;
- }
- return Ok;
- }
- __inline__ VOID PathData::FreeArrays()
- {
- if (Points) DllExports::GdipFree(Points);
- if (Types) DllExports::GdipFree(Types);
- Count = 0;
- Points = NULL;
- Types = NULL;
- }
- #endif /* __GDIPLUS_IMPL_H */
|