Hi,
Dr. H. Nikolaus Schaller wrote:
Finally, you can alloc+init an NSImage and use addRepresentation to add exactly
this rep. And then you can draw. Even if it then magically converts it into a
NSCachedImageRep, you still have access to the original.
Maybe this caching is triggered by the first draw operation, so if you get the
representations before doing any draw operation on the NSImage, you could also
get the uncached version first and retain it…
I came to similar conclusions and initially I had the same ideas, thus
they look god and you confirmed the path to follow. I implemented it in
a NSImage subclass.
In initWithData I set a pointer to the representation (only on at this
point) and also retain it. This way if later the drawin code replaces it
I can still access it.
I thought that in the representations array I would have several
device-dependent versions, but that the first rep would be my original.
Since it is not the case, this way I can always access it.
Of course, I added an accessor to this representation which just returns
the pointer.
At release, I send an additional release to it.
I had to modify PRICE to use my accessor instead of the representation
array when I need direct access to the data
Furthermore, when doing a copy of the image, instead of instantiating
every time a new image and copying the representation, I implemented the
copyWithZone method, so that my original representation can be copied.
It works uite fine on the Mac, on GNUstep however I get horrible
crashes, I'll clean up the code first then try to be more precise about
the conditions that trigger it on GNUstep. But I fear it is GS problem now.
Riccardo
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep