|
Re: Bitmap loading from array - representation: msg#00015lang.smalltalk.squeak.beginners
> On Dec 6, 2007, at 14:24 , johnps11@xxxxxxxxxxx wrote: > >>> On Dec 1, 2007, at 20:34 , Pete wrote: >>> >>>> It's also not clear to me why this array is >>>> size of 120, when we have an rectangular region of >>>> 40x40, and what is the difference of depth 1,2,4 ... >>> >>> >>> Depth is the number of bits per pixel. Depth 2 means 2 bits per >>> pixel, hence 4 colors. >>> >>> The array stores 32 bits per element. So at depth 2 you get 16 pixels >>> per element. You need 3 elements per row for 40 pixels. 40 rows times >>> 3 words per row is 120. Mystery solved. >>> >>> FYI, pixels are stored big-endian by default. >>> >>> And I'm pretty sure Form even has a class comment, as should Bitmap. >>> >>> - Bert - >> >> I have to admit that Bert's explanation has me none the wiser - the >> leap >> from 2 16 bit words per element (16 pixels) meaning that 3 elements >> (96 >> bits, 48 pixels) equals 40 pixels, which is 3 words per row seems a >> little >> unclear (as 48 != 40 in most sane algebras). > > I wrote "32 bits per element". The array stores 32 bit numbers > (a.k.a. words). For 40 pixels at 2 bits each you need a row of at > least 80 bits. That means you need three 32 bit numbers giving you 96 > bits per row of which 16 are unused. This wastes up to 31 bits per > row, but letting each row start on a word boundary is much more > efficient. You can think of a row as being "padded" up to the next > multiple of 32 bits. > > - Bert - Thanks Bert - I think I finally understand. Looking at what I wrote, I didn't proof read well, I came across as a pompous ass. I shouldn't have been so quick to click on 'send' - my apologies. Transpose the words 'not' and ' designed' to get closer to what I meant, as against what I said! John
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | News Team update for Nov 2007, Ron Teitelbaum |
|---|---|
| Next by Date: | comint from VAST and being HU, RK |
| Previous by Thread: | Re: Bitmap loading from array - representation, Bert Freudenberg |
| Next by Thread: | Bitmap loading from array - representation, Jerome Peace |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |