bitmapresource.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <fpdoc-descriptions>
  3. <package name="fcl-res">
  4. <!--
  5. ====================================================================
  6. bitmapresource
  7. ====================================================================
  8. -->
  9. <module name="bitmapresource">
  10. <short>Contains a bitmap resource type</short>
  11. <descr>
  12. <p>This unit contains <link id="TBitmapResource"/>, a <link id="resource.TAbstractResource">TAbstractResource</link> descendant specialized in handling resource of type <link id="resource.RT_BITMAP">RT_BITMAP</link>.</p>
  13. <p>Adding this unit to a program's <var>uses</var> clause registers class <link id="TBitmapResource"/> for type <link id="resource.RT_BITMAP">RT_BITMAP</link> with <link id="resfactory.TResourceFactory">TResourceFactory</link>.</p>
  14. </descr>
  15. <!-- unresolved type reference Visibility: default -->
  16. <element name="Classes">
  17. </element>
  18. <!-- unresolved type reference Visibility: default -->
  19. <element name="SysUtils">
  20. </element>
  21. <!-- unresolved type reference Visibility: default -->
  22. <element name="resource">
  23. </element>
  24. <!-- object Visibility: default -->
  25. <element name="TBitmapResource">
  26. <short>Bitmap resource type</short>
  27. <descr>
  28. <p>This class represents a resource of type <link id="resource.RT_BITMAP">RT_BITMAP</link>.</p>
  29. <p>A bitmap resource contents is very similar to a BMP file. However some differences exists, so <link id="resource.TAbstractResource.RawData">RawData</link> is not appropriate if you need to read and write BMP data. Instead, <link id="TBitmapResource.BitmapData">BitmapData</link> property gives access to a BMP file-like stream.</p>
  30. <remark>This class doesn't allow its type to be changed to anything else than <link id="resource.RT_BITMAP">RT_BITMAP</link>. Attempts to do so result in a <link id="resource.EResourceDescChangeNotAllowedException">EResourceDescChangeNotAllowedException</link>.</remark>
  31. </descr>
  32. <seealso>
  33. <link id="TBitmapResource.BitmapData">BitmapData</link>
  34. <link id="resource.TAbstractResource.RawData">TAbstractResource.RawData</link>
  35. </seealso>
  36. </element>
  37. <!-- constructor Visibility: public -->
  38. <element name="TBitmapResource.Create">
  39. <short>Creates a new bitmap resource</short>
  40. <descr>
  41. <p>Please note that <var>aType</var> parameter is not used, since this class always uses <link id="resource.RT_BITMAP">RT_BITMAP</link> as type.</p>
  42. </descr>
  43. </element>
  44. <!-- argument Visibility: default -->
  45. <element name="TBitmapResource.Create.aType">
  46. <short>Ignored. Can be <var>nil</var>.</short>
  47. </element>
  48. <!-- argument Visibility: default -->
  49. <element name="TBitmapResource.Create.aName">
  50. <short>The name of the resource</short>
  51. </element>
  52. <!-- procedure Visibility: public -->
  53. <element name="TBitmapResource.SetCustomBitmapDataStream">
  54. <short>Sets a custom stream as the underlying stream for BitmapData</short>
  55. <descr>
  56. <p>This method allows the user to use a custom stream as the underlying stream for <link id="TBitmapResource.BitmapData">BitmapData</link>. This is useful when you want a <link id="TBitmapResource"/> to be created from a bmp file for which you have a stream.</p>
  57. <p><b>Sample code</b></p>
  58. <p>This code creates a resource containing a bitmap</p>
  59. <code>
  60. var
  61. aName : TResourceDesc;
  62. aRes : TBitmapResource;
  63. aFile : TFileStream;
  64. Resources : TResources;
  65. begin
  66. Resources:=TResources.Create;
  67. aName:=TResourceDesc.Create('MYBITMAP');
  68. aRes:=TBitmapResource.Create(nil,aName); //type is always RT_BITMAP
  69. aName.Free; //not needed anymore
  70. aFile:=TFileStream.Create('mybitmap.bmp',fmOpenRead or fmShareDenyNone);
  71. aRes.SetCustomBitmapDataStream(aFile);
  72. Resources.Add(aRes);
  73. Resources.WriteToFile('myresource.res');
  74. Resources.Free; //it destroys aRes as well.
  75. aFile.Free;
  76. end;
  77. </code>
  78. </descr>
  79. <seealso>
  80. <link id="TBitmapResource.BitmapData"/>
  81. <link id="resource.TAbstractResource.UpdateRawData">TAbstractResource.UpdateRawData</link>
  82. </seealso>
  83. </element>
  84. <!-- argument Visibility: default -->
  85. <element name="TBitmapResource.SetCustomBitmapDataStream.aStream">
  86. <short>The custom stream to use as the underlying <link id="TBitmapResource.BitmapData">BitmapData</link> stream</short>
  87. </element>
  88. <!-- property Visibility: public -->
  89. <element name="TBitmapResource.BitmapData">
  90. <short>Resource data as a BMP stream</short>
  91. <descr>
  92. <p><link id="TBitmapResource.BitmapData">BitmapData</link> property gives access to resource data in a BMP file-like stream, unlike <link id="resource.TAbstractResource.RawData">RawData</link>.</p>
  93. <p><link id="TBitmapResource.BitmapData">BitmapData</link> does not create a copy of <link id="resource.TAbstractResource.RawData">RawData</link> so memory usage is generally kept limited.</p>
  94. <p>You can also set a custom stream as the underlying stream for <link id="TBitmapResource.BitmapData">BitmapData</link> via <link id="TBitmapResource.SetCustomBitmapDataStream">SetCustomBitmapDataStream</link>, much like <link id="resource.TAbstractResource.SetCustomRawDataStream">SetCustomRawDataStream</link> does for <link id="resource.TAbstractResource.RawData">RawData</link>. This is useful when you want a <link id="TBitmapResource"/> to be created from a bmp file for which you have a stream.</p>
  95. <remark>If you need to access <link id="resource.TAbstractResource.RawData">RawData</link> after you modified <link id="TBitmapResource.BitmapData">BitmapData</link>, be sure to call <link id="resource.TAbstractResource.UpdateRawData">UpdateRawData</link> first. This isn't needed however when resource is written to a stream, since <link id="resource.TResources">TResources</link> takes care of it.</remark>
  96. </descr>
  97. <seealso>
  98. <link id="TBitmapResource.SetCustomBitmapDataStream"/>
  99. <link id="resource.TAbstractResource.RawData">TAbstractResource.RawData</link>
  100. <link id="resource.TAbstractResource.UpdateRawData">TAbstractResource.UpdateRawData</link>
  101. </seealso>
  102. </element>
  103. </module> <!-- bitmapresource -->
  104. </package>
  105. </fpdoc-descriptions>