GdiPlusBitmap.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  1. //Download by http://www.NewXing.com
  2. /**************************************************************************\
  3. *
  4. * Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
  5. *
  6. * Module Name:
  7. *
  8. * GdiplusBitmap.h
  9. *
  10. * Abstract:
  11. *
  12. * GDI+ Bitmap class
  13. *
  14. \**************************************************************************/
  15. #ifndef _GDIPLUSBITMAP_H
  16. #define _GDIPLUSBITMAP_H
  17. inline
  18. Image::Image(
  19. IN const WCHAR* filename,
  20. IN BOOL useEmbeddedColorManagement
  21. )
  22. {
  23. nativeImage = NULL;
  24. if(useEmbeddedColorManagement)
  25. {
  26. lastResult = DllExports::GdipLoadImageFromFileICM(
  27. filename,
  28. &nativeImage
  29. );
  30. }
  31. else
  32. {
  33. lastResult = DllExports::GdipLoadImageFromFile(
  34. filename,
  35. &nativeImage
  36. );
  37. }
  38. }
  39. inline
  40. Image::Image(
  41. IN IStream* stream,
  42. IN BOOL useEmbeddedColorManagement
  43. )
  44. {
  45. nativeImage = NULL;
  46. if(useEmbeddedColorManagement)
  47. {
  48. lastResult = DllExports::GdipLoadImageFromStreamICM(
  49. stream,
  50. &nativeImage
  51. );
  52. }
  53. else
  54. {
  55. lastResult = DllExports::GdipLoadImageFromStream(
  56. stream,
  57. &nativeImage
  58. );
  59. }
  60. }
  61. inline Image*
  62. Image::FromFile(
  63. IN const WCHAR* filename,
  64. IN BOOL useEmbeddedColorManagement
  65. )
  66. {
  67. return new Image(
  68. filename,
  69. useEmbeddedColorManagement
  70. );
  71. }
  72. inline Image*
  73. Image::FromStream(
  74. IN IStream* stream,
  75. IN BOOL useEmbeddedColorManagement
  76. )
  77. {
  78. return new Image(
  79. stream,
  80. useEmbeddedColorManagement
  81. );
  82. }
  83. inline
  84. Image::~Image()
  85. {
  86. DllExports::GdipDisposeImage(nativeImage);
  87. }
  88. inline Image*
  89. Image::Clone()
  90. {
  91. GpImage *cloneimage = NULL;
  92. SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage));
  93. return new Image(cloneimage, lastResult);
  94. }
  95. inline UINT
  96. Image::GetEncoderParameterListSize(
  97. IN const CLSID* clsidEncoder
  98. )
  99. {
  100. UINT size = 0;
  101. SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage,
  102. clsidEncoder,
  103. &size));
  104. return size;
  105. }
  106. inline Status
  107. Image::GetEncoderParameterList(
  108. IN const CLSID* clsidEncoder,
  109. IN UINT size,
  110. OUT EncoderParameters* buffer
  111. )
  112. {
  113. return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage,
  114. clsidEncoder,
  115. size,
  116. buffer));
  117. }
  118. inline Status
  119. Image::Save(
  120. IN const WCHAR* filename,
  121. IN const CLSID* clsidEncoder,
  122. IN const EncoderParameters *encoderParams
  123. )
  124. {
  125. return SetStatus(DllExports::GdipSaveImageToFile(nativeImage,
  126. filename,
  127. clsidEncoder,
  128. encoderParams));
  129. }
  130. inline Status
  131. Image::Save(
  132. IN IStream* stream,
  133. IN const CLSID* clsidEncoder,
  134. IN const EncoderParameters *encoderParams
  135. )
  136. {
  137. return SetStatus(DllExports::GdipSaveImageToStream(nativeImage,
  138. stream,
  139. clsidEncoder,
  140. encoderParams));
  141. }
  142. inline Status
  143. Image::SaveAdd(
  144. IN const EncoderParameters *encoderParams
  145. )
  146. {
  147. return SetStatus(DllExports::GdipSaveAdd(nativeImage,
  148. encoderParams));
  149. }
  150. inline Status
  151. Image::SaveAdd(
  152. IN Image* newImage,
  153. IN const EncoderParameters *encoderParams
  154. )
  155. {
  156. if ( newImage == NULL )
  157. {
  158. return SetStatus(InvalidParameter);
  159. }
  160. return SetStatus(DllExports::GdipSaveAddImage(nativeImage,
  161. newImage->nativeImage,
  162. encoderParams));
  163. }
  164. inline ImageType
  165. Image::GetType() const
  166. {
  167. ImageType type = ImageTypeUnknown;
  168. SetStatus(DllExports::GdipGetImageType(nativeImage, &type));
  169. return type;
  170. }
  171. inline Status
  172. Image::GetPhysicalDimension(
  173. OUT SizeF* size
  174. )
  175. {
  176. if (size == NULL)
  177. {
  178. return SetStatus(InvalidParameter);
  179. }
  180. REAL width, height;
  181. Status status;
  182. status = SetStatus(DllExports::GdipGetImageDimension(nativeImage,
  183. &width, &height));
  184. size->Width = width;
  185. size->Height = height;
  186. return status;
  187. }
  188. inline Status
  189. Image::GetBounds(
  190. OUT RectF *srcRect,
  191. OUT Unit *srcUnit
  192. )
  193. {
  194. return SetStatus(DllExports::GdipGetImageBounds(nativeImage,
  195. srcRect, srcUnit));
  196. }
  197. inline UINT
  198. Image::GetWidth()
  199. {
  200. UINT width = 0;
  201. SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width));
  202. return width;
  203. }
  204. inline UINT
  205. Image::GetHeight()
  206. {
  207. UINT height = 0;
  208. SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height));
  209. return height;
  210. }
  211. inline REAL
  212. Image::GetHorizontalResolution()
  213. {
  214. REAL resolution = 0.0f;
  215. SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution));
  216. return resolution;
  217. }
  218. inline REAL
  219. Image::GetVerticalResolution()
  220. {
  221. REAL resolution = 0.0f;
  222. SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution));
  223. return resolution;
  224. }
  225. inline UINT
  226. Image::GetFlags()
  227. {
  228. UINT flags = 0;
  229. SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags));
  230. return flags;
  231. }
  232. inline Status
  233. Image::GetRawFormat(OUT GUID *format)
  234. {
  235. return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format));
  236. }
  237. inline PixelFormat
  238. Image::GetPixelFormat()
  239. {
  240. PixelFormat format;
  241. SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format));
  242. return format;
  243. }
  244. inline INT
  245. Image::GetPaletteSize()
  246. {
  247. INT size = 0;
  248. SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size));
  249. return size;
  250. }
  251. inline Status
  252. Image::GetPalette(
  253. OUT ColorPalette *palette,
  254. IN INT size
  255. )
  256. {
  257. return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size));
  258. }
  259. inline Status
  260. Image::SetPalette(
  261. IN const ColorPalette *palette
  262. )
  263. {
  264. return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette));
  265. }
  266. inline Image*
  267. Image::GetThumbnailImage(
  268. IN UINT thumbWidth,
  269. IN UINT thumbHeight,
  270. IN GetThumbnailImageAbort callback,
  271. IN VOID* callbackData
  272. )
  273. {
  274. GpImage *thumbimage = NULL;
  275. SetStatus(DllExports::GdipGetImageThumbnail(nativeImage,
  276. thumbWidth, thumbHeight,
  277. &thumbimage,
  278. callback, callbackData));
  279. Image *newImage = new Image(thumbimage, lastResult);
  280. if (newImage == NULL)
  281. {
  282. DllExports::GdipDisposeImage(thumbimage);
  283. }
  284. return newImage;
  285. }
  286. inline UINT
  287. Image::GetFrameDimensionsCount()
  288. {
  289. UINT count = 0;
  290. SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage,
  291. &count));
  292. return count;
  293. }
  294. inline Status
  295. Image::GetFrameDimensionsList(
  296. OUT GUID* dimensionIDs,
  297. IN UINT count
  298. )
  299. {
  300. return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage,
  301. dimensionIDs,
  302. count));
  303. }
  304. inline UINT
  305. Image::GetFrameCount(
  306. IN const GUID* dimensionID
  307. )
  308. {
  309. UINT count = 0;
  310. SetStatus(DllExports::GdipImageGetFrameCount(nativeImage,
  311. dimensionID,
  312. &count));
  313. return count;
  314. }
  315. inline Status
  316. Image::SelectActiveFrame(
  317. IN const GUID *dimensionID,
  318. IN UINT frameIndex
  319. )
  320. {
  321. return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage,
  322. dimensionID,
  323. frameIndex));
  324. }
  325. inline Status
  326. Image::RotateFlip(
  327. IN RotateFlipType rotateFlipType
  328. )
  329. {
  330. return SetStatus(DllExports::GdipImageRotateFlip(nativeImage,
  331. rotateFlipType));
  332. }
  333. inline UINT
  334. Image::GetPropertyCount()
  335. {
  336. UINT numProperty = 0;
  337. SetStatus(DllExports::GdipGetPropertyCount(nativeImage,
  338. &numProperty));
  339. return numProperty;
  340. }
  341. inline Status
  342. Image::GetPropertyIdList(
  343. IN UINT numOfProperty,
  344. OUT PROPID* list
  345. )
  346. {
  347. return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage,
  348. numOfProperty, list));
  349. }
  350. inline UINT
  351. Image::GetPropertyItemSize(
  352. IN PROPID propId
  353. )
  354. {
  355. UINT size = 0;
  356. SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage,
  357. propId,
  358. &size));
  359. return size;
  360. }
  361. inline Status
  362. Image::GetPropertyItem(
  363. IN PROPID propId,
  364. IN UINT propSize,
  365. OUT PropertyItem* buffer
  366. )
  367. {
  368. return SetStatus(DllExports::GdipGetPropertyItem(nativeImage,
  369. propId, propSize, buffer));
  370. }
  371. inline Status
  372. Image::GetPropertySize(
  373. OUT UINT* totalBufferSize,
  374. OUT UINT* numProperties
  375. )
  376. {
  377. return SetStatus(DllExports::GdipGetPropertySize(nativeImage,
  378. totalBufferSize,
  379. numProperties));
  380. }
  381. inline Status
  382. Image::GetAllPropertyItems(
  383. IN UINT totalBufferSize,
  384. IN UINT numProperties,
  385. OUT PropertyItem* allItems
  386. )
  387. {
  388. if (allItems == NULL)
  389. {
  390. return SetStatus(InvalidParameter);
  391. }
  392. return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage,
  393. totalBufferSize,
  394. numProperties,
  395. allItems));
  396. }
  397. inline Status
  398. Image::RemovePropertyItem(
  399. IN PROPID propId
  400. )
  401. {
  402. return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId));
  403. }
  404. inline Status
  405. Image::SetPropertyItem(
  406. IN const PropertyItem* item
  407. )
  408. {
  409. return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item));
  410. }
  411. inline Status
  412. Image::GetLastStatus() const
  413. {
  414. Status lastStatus = lastResult;
  415. lastResult = Ok;
  416. return lastStatus;
  417. }
  418. inline
  419. Image::Image(GpImage *nativeImage, Status status)
  420. {
  421. SetNativeImage(nativeImage);
  422. lastResult = status;
  423. }
  424. inline VOID
  425. Image::SetNativeImage(GpImage *nativeImage)
  426. {
  427. this->nativeImage = nativeImage;
  428. }
  429. inline
  430. Bitmap::Bitmap(
  431. IN const WCHAR *filename,
  432. IN BOOL useEmbeddedColorManagement
  433. )
  434. {
  435. GpBitmap *bitmap = NULL;
  436. if(useEmbeddedColorManagement)
  437. {
  438. lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap);
  439. }
  440. else
  441. {
  442. lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap);
  443. }
  444. SetNativeImage(bitmap);
  445. }
  446. inline
  447. Bitmap::Bitmap(
  448. IN IStream *stream,
  449. IN BOOL useEmbeddedColorManagement
  450. )
  451. {
  452. GpBitmap *bitmap = NULL;
  453. if(useEmbeddedColorManagement)
  454. {
  455. lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap);
  456. }
  457. else
  458. {
  459. lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap);
  460. }
  461. SetNativeImage(bitmap);
  462. }
  463. inline
  464. Bitmap::Bitmap(
  465. IN INT width,
  466. IN INT height,
  467. IN INT stride,
  468. IN PixelFormat format,
  469. IN BYTE *scan0
  470. )
  471. {
  472. GpBitmap *bitmap = NULL;
  473. lastResult = DllExports::GdipCreateBitmapFromScan0(width,
  474. height,
  475. stride,
  476. format,
  477. scan0,
  478. &bitmap);
  479. SetNativeImage(bitmap);
  480. }
  481. inline
  482. Bitmap::Bitmap(
  483. IN INT width,
  484. IN INT height,
  485. IN PixelFormat format
  486. )
  487. {
  488. GpBitmap *bitmap = NULL;
  489. lastResult = DllExports::GdipCreateBitmapFromScan0(width,
  490. height,
  491. 0,
  492. format,
  493. NULL,
  494. &bitmap);
  495. SetNativeImage(bitmap);
  496. }
  497. inline
  498. Bitmap::Bitmap(
  499. IN INT width,
  500. IN INT height,
  501. IN Graphics* target)
  502. {
  503. GpBitmap *bitmap = NULL;
  504. lastResult = DllExports::GdipCreateBitmapFromGraphics(width,
  505. height,
  506. target->nativeGraphics,
  507. &bitmap);
  508. SetNativeImage(bitmap);
  509. }
  510. inline
  511. Bitmap::Bitmap(
  512. IN IDirectDrawSurface7 * surface
  513. )
  514. {
  515. GpBitmap *bitmap = NULL;
  516. lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface,
  517. &bitmap);
  518. SetNativeImage(bitmap);
  519. }
  520. inline
  521. Bitmap::Bitmap(
  522. IN const BITMAPINFO* gdiBitmapInfo,
  523. IN VOID* gdiBitmapData
  524. )
  525. {
  526. GpBitmap *bitmap = NULL;
  527. lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo,
  528. gdiBitmapData,
  529. &bitmap);
  530. SetNativeImage(bitmap);
  531. }
  532. inline
  533. Bitmap::Bitmap(
  534. IN HBITMAP hbm,
  535. IN HPALETTE hpal
  536. )
  537. {
  538. GpBitmap *bitmap = NULL;
  539. lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap);
  540. SetNativeImage(bitmap);
  541. }
  542. inline
  543. Bitmap::Bitmap(
  544. IN HICON hicon
  545. )
  546. {
  547. GpBitmap *bitmap = NULL;
  548. lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap);
  549. SetNativeImage(bitmap);
  550. }
  551. inline
  552. Bitmap::Bitmap(
  553. IN HINSTANCE hInstance,
  554. IN const WCHAR *bitmapName
  555. )
  556. {
  557. GpBitmap *bitmap = NULL;
  558. lastResult = DllExports::GdipCreateBitmapFromResource(hInstance,
  559. bitmapName,
  560. &bitmap);
  561. SetNativeImage(bitmap);
  562. }
  563. inline Bitmap*
  564. Bitmap::FromFile(
  565. IN const WCHAR *filename,
  566. IN BOOL useEmbeddedColorManagement
  567. )
  568. {
  569. return new Bitmap(
  570. filename,
  571. useEmbeddedColorManagement
  572. );
  573. }
  574. inline Bitmap*
  575. Bitmap::FromStream(
  576. IN IStream *stream,
  577. IN BOOL useEmbeddedColorManagement
  578. )
  579. {
  580. return new Bitmap(
  581. stream,
  582. useEmbeddedColorManagement
  583. );
  584. }
  585. inline Bitmap*
  586. Bitmap::FromDirectDrawSurface7(
  587. IN IDirectDrawSurface7* surface
  588. )
  589. {
  590. return new Bitmap(surface);
  591. }
  592. inline Bitmap*
  593. Bitmap::FromBITMAPINFO(
  594. IN const BITMAPINFO* gdiBitmapInfo,
  595. IN VOID* gdiBitmapData)
  596. {
  597. return new Bitmap(gdiBitmapInfo, gdiBitmapData);
  598. }
  599. inline Bitmap*
  600. Bitmap::FromHBITMAP(
  601. IN HBITMAP hbm,
  602. IN HPALETTE hpal
  603. )
  604. {
  605. return new Bitmap(hbm, hpal);
  606. }
  607. inline Bitmap*
  608. Bitmap::FromHICON(
  609. IN HICON hicon
  610. )
  611. {
  612. return new Bitmap(hicon);
  613. }
  614. inline Bitmap*
  615. Bitmap::FromResource(
  616. IN HINSTANCE hInstance,
  617. IN const WCHAR *bitmapName)
  618. {
  619. return new Bitmap(hInstance, bitmapName);
  620. }
  621. inline Status
  622. Bitmap::GetHBITMAP(
  623. IN const GdiPlusColor& colorBackground,
  624. OUT HBITMAP* hbmReturn
  625. )
  626. {
  627. return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap(
  628. static_cast<GpBitmap*>(nativeImage),
  629. hbmReturn,
  630. colorBackground.GetValue()));
  631. }
  632. inline Status
  633. Bitmap::GetHICON(
  634. OUT HICON* hiconReturn
  635. )
  636. {
  637. return SetStatus(DllExports::GdipCreateHICONFromBitmap(
  638. static_cast<GpBitmap*>(nativeImage),
  639. hiconReturn));
  640. }
  641. inline Bitmap*
  642. Bitmap::Clone(
  643. IN const Rect& rect,
  644. IN PixelFormat format
  645. )
  646. {
  647. return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
  648. }
  649. inline Bitmap*
  650. Bitmap::Clone(
  651. IN INT x,
  652. IN INT y,
  653. IN INT width,
  654. IN INT height,
  655. IN PixelFormat format
  656. )
  657. {
  658. GpBitmap* gpdstBitmap = NULL;
  659. Bitmap* bitmap;
  660. lastResult = DllExports::GdipCloneBitmapAreaI(
  661. x,
  662. y,
  663. width,
  664. height,
  665. format,
  666. (GpBitmap *)nativeImage,
  667. &gpdstBitmap);
  668. if (lastResult == Ok)
  669. {
  670. bitmap = new Bitmap(gpdstBitmap);
  671. if (bitmap == NULL)
  672. {
  673. DllExports::GdipDisposeImage(gpdstBitmap);
  674. }
  675. return bitmap;
  676. }
  677. else
  678. return NULL;
  679. }
  680. inline Bitmap*
  681. Bitmap::Clone(
  682. IN const RectF& rect,
  683. IN PixelFormat format
  684. )
  685. {
  686. return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
  687. }
  688. inline Bitmap*
  689. Bitmap::Clone(
  690. IN REAL x,
  691. IN REAL y,
  692. IN REAL width,
  693. IN REAL height,
  694. IN PixelFormat format
  695. )
  696. {
  697. GpBitmap* gpdstBitmap = NULL;
  698. Bitmap* bitmap;
  699. SetStatus(DllExports::GdipCloneBitmapArea(
  700. x,
  701. y,
  702. width,
  703. height,
  704. format,
  705. (GpBitmap *)nativeImage,
  706. &gpdstBitmap));
  707. if (lastResult == Ok)
  708. {
  709. bitmap = new Bitmap(gpdstBitmap);
  710. if (bitmap == NULL)
  711. {
  712. DllExports::GdipDisposeImage(gpdstBitmap);
  713. }
  714. return bitmap;
  715. }
  716. else
  717. return NULL;
  718. }
  719. inline Bitmap::Bitmap(GpBitmap *nativeBitmap)
  720. {
  721. lastResult = Ok;
  722. SetNativeImage(nativeBitmap);
  723. }
  724. inline Status
  725. Bitmap::LockBits(
  726. IN const Rect* rect,
  727. IN UINT flags,
  728. IN PixelFormat format,
  729. OUT BitmapData* lockedBitmapData
  730. )
  731. {
  732. return SetStatus(DllExports::GdipBitmapLockBits(
  733. static_cast<GpBitmap*>(nativeImage),
  734. rect,
  735. flags,
  736. format,
  737. lockedBitmapData));
  738. }
  739. inline Status
  740. Bitmap::UnlockBits(
  741. IN BitmapData* lockedBitmapData
  742. )
  743. {
  744. return SetStatus(DllExports::GdipBitmapUnlockBits(
  745. static_cast<GpBitmap*>(nativeImage),
  746. lockedBitmapData));
  747. }
  748. inline Status
  749. Bitmap::GetPixel(
  750. IN INT x,
  751. IN INT y,
  752. OUT GdiPlusColor *color)
  753. {
  754. ARGB argb;
  755. Status status = SetStatus(DllExports::GdipBitmapGetPixel(
  756. static_cast<GpBitmap *>(nativeImage),
  757. x, y,
  758. &argb));
  759. if (status == Ok)
  760. {
  761. color->SetValue(argb);
  762. }
  763. return status;
  764. }
  765. inline Status
  766. Bitmap::SetPixel(
  767. IN INT x,
  768. IN INT y,
  769. IN const GdiPlusColor& color)
  770. {
  771. return SetStatus(DllExports::GdipBitmapSetPixel(
  772. static_cast<GpBitmap *>(nativeImage),
  773. x, y,
  774. color.GetValue()));
  775. }
  776. inline Status
  777. Bitmap::SetResolution(
  778. IN REAL xdpi,
  779. IN REAL ydpi)
  780. {
  781. return SetStatus(DllExports::GdipBitmapSetResolution(
  782. static_cast<GpBitmap *>(nativeImage),
  783. xdpi, ydpi));
  784. }
  785. #endif