{"id":50,"date":"2007-05-08T15:40:30","date_gmt":"2007-05-08T13:40:30","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/graphic-rle-bitmaps\/"},"modified":"2007-05-11T19:39:49","modified_gmt":"2007-05-11T17:39:49","slug":"graphic-rle-bitmaps","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/graphic-rle-bitmaps\/","title":{"rendered":"Graphic: RLE Bitmaps"},"content":{"rendered":"<p>An FYI, and also wondering who has run into the same problems with  possibly<br \/>\na better resolution\/fix:<\/p>\n<p>Some changes were made in the Delphi 5 graphics.pas files relating to RLE<br \/>\nbitmaps that now cause Delphi 5 (and our app) to choke on RLEs. The two<br \/>\nsources of contention that we&#8217;ve found are in the TBitmap.ReadDIB and<br \/>\nTBitmap.WriteStream Procedures. The ReadDIB has a simple bug that reads<br \/>\nforward on a seek instead of backward, causing a stream read error (this<br \/>\nerror is reproducable simply by dropping a TImage object onto a form and<br \/>\nloading an RLE bitmap into it). The following code change is the fix:<\/p>\n<p>old code &#8211;<br \/>\nRLEStream.Seek( ImageSize, soFromEnd);<br \/>\nnew code &#8211;<br \/>\nRLEStream.Seek(-1 * ImageSize, soFromEnd);<\/p>\n<p>The second problem is that the TBitmapInfoHeader is being stripped off of<br \/>\nthe stream somewhere in the code, and so when you try to reference the<br \/>\nheader information of your bitmap, you get all kinds of fun runtime errors.<br \/>\nCommenting out the following code in the TBitmap.WriteStream procedure takes<br \/>\ncare of the problem:<br \/>\n[code lang=&#8221;delphi&#8221;]<br \/>\n(*<br \/>\n  if FImage.FSaveStream <> nil then<br \/>\n  begin<\/p>\n<p>>> insert BMF code here<\/p>\n<p>    Size := FImage.FSaveStream.Size;<br \/>\n    if WriteSize then<br \/>\n      Stream.WriteBuffer(Size, sizeof(Size));<br \/>\n    Stream.Write(FImage.FSaveStream.Memory^, Size);<br \/>\n    Exit;<br \/>\n  end;<br \/>\n*)<br \/>\n[\/code]<\/p>\n<p>Any help with this &#8211; more info? Very much appreciated!!<br \/>\nGretchen<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An FYI, and also wondering who has run into the same problems with possibly a better resolution\/fix: Some changes were made in the&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,80],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-O","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/50"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}