On Wed, Nov 25, 2009 at 09:25:33AM +0100, Stephan Assmus wrote: > > On 2009-11-25 at 08:22:01 [+0100], pete.goodeve@xxxxxxxxxxxx wrote: > > On Tue, Nov 24, 2009 at 04:40:30PM -0800, I wrote: > > > OK, I'm lost again... (:-/) > > > [.....] > > > > And now I'm even more baffled... I just looked at Philippe's new mods to > > midi_server, and he does almost *exactly* what I tried, except that he is > > using GetVectorIcon locally (on the same rdef data), and apparently it > > works just as I thought it would! > > > > I suppose I did something stupid, but I checked that what I was receiving > > in the message appeared to be correct. I'll reinvestigate tomorrow. Well, as far as I can tell, I'm not being stupid... [just going slowly crazy... (:-/] I grabbed Philippe's vector-icon_modified midi_server changeset and installed it. It fails in (apparently) exactly the same way! It is unable to handle its own rdef data. (I haven't yet added any debug printout, but it doesn't supply *any* icon to PatchBay, presumably because it can't convert the vector data to CMAP8 form.) [The OS is alpha-1, and the source code I have installed should be about equivalent. (I can't be more specific, because I downloaded the complete archive version, and no-one can tell me where to find the revision number in the hierarchy! (:-) I searched for any possibly relevant changeset, but didn't see one.] > > Hm. There is a Icon-O-Matic "native" document format, which is stored as > flattened BMessage. However, this is not what the BIconUtils want. They > want the "flat" HVIF icon data. Icon-O-Matic supports exporting that in > various forms, but it's always the same data. I.e. "Source Code" writes the > same data as "RDef" does, just with different syntax. So I am not sure what > you did exactly, but if you exported RDef, I presume you put this in the > application resources and load it like Philippe did in his recent commit. > If you used the export Source Code method, then you just pass the C array > to BIconUtils. If in doubt, just post your code snippet here. :-) So I gather from what you're saying that the rdef data from I-O-M *is* a flattened icon. And I am doing what I should. Here's something of what I'm seeing: // These are the PatchBay constants (with additions) const char* LARGE_ICON_NAME = "be:large_icon"; const char* MINI_ICON_NAME = "be:mini_icon"; const char* VECTOR_ICON_NAME = "be:vector_icon"; // for now... const uint32 LARGE_ICON_TYPE = 'ICON'; const uint32 MINI_ICON_TYPE = 'MICN'; const uint32 VECTOR_ICON_TYPE = 'VICN'; extern const uint8 LARGE_ICON_SIZE = 32; extern const uint8 MINI_ICON_SIZE = 16; extern const icon_size DISPLAY_ICON_SIZE = B_LARGE_ICON; extern const color_space ICON_COLOR_SPACE = B_CMAP8; const color_space VECTOR_ICON_COLOR_SPACE = B_RGBA32; .......... // Here's the code that's failing -- gets the msg from the endpoint. static BBitmap* CreateIcon(const BMessage* msg, icon_size which) { float iconSize; uint32 iconType; const char* iconName; const void* data; ssize_t size; BBitmap* bitmap = NULL; printf("CreateIcon entered\n"); msg->PrintToStream(); #ifdef __HAIKU__ iconSize = LARGE_ICON_SIZE; if (msg->FindData(VECTOR_ICON_NAME, VECTOR_ICON_TYPE, &data, &size) == B_OK) { printf("Got vector data size %ld\n", size); for (int ix=0; ix < 10; ix++) printf("%x ", ((const uint8*)data)[ix]); printf("\n"); BRect r(0, 0, iconSize-1, iconSize-1); bitmap = new BBitmap(r, VECTOR_ICON_COLOR_SPACE); if (BIconUtils::GetVectorIcon((const uint8*)data, size, bitmap) == B_OK) { printf("Created bitmap\n"); return bitmap; } else delete bitmap; } #endif ..... } ==================================== Output from PatchBay in Terminal: CreateIcon entered BMessage(0x0) { be:large_icon = (type = 'ICON')(size = 1024) be:mini_icon = (type = 'MICN')(size = 256) be:vector_icon = (type = 'VICN')(size = 663) } Got vector data size 663 6e 63 69 66 9 5 1 2 0 16 FlatIconImporter::_ParseSections() - error parsing styles: Out of memory MessageImporter::Import() - error unflattening icon archive: Data is not a message In that printout, the values printed out for the rdef data are correct, as is the size. The "Out of memory" error doesn't appear if I use a slightly different original icon, but "...not a message" always does. (I assume the Oom is bogus -- I looked at _ParseStyles, and it seems to return that code when anything fails...) Any ideas? -- Pete --