From koffice Sun Jul 09 15:00:45 2000 From: Thomas Zander Date: Sun, 09 Jul 2000 15:00:45 +0000 To: koffice Subject: imageContainer proposal X-MARC-Message: https://marc.info/?l=koffice&m=96317479808242 ----------------------------------------- Included files (pictures/parts/formula's) ----------------------------------------- - Pictures should never be rescaled if that means that there is image loss at printing time - It should be possible to keep files external. Kword(/*) should also notice a changed file (preferably also at runtime) and reload it. - In kword we have an image object. - we also have a imageCollection object. Proposal -------- On placing the picture in the document we should create a thumbnail on screen at the screensize. This counts for both internal and external pictures. With todays computers I am not really concerned with filesizes anymore, besides; it would probably be about 30k max. The thumbs will be saved as: tar:pictures/ The internal pictures should be read into memory and saved to the tar in a dir like tar:raw-pictures/ and/or tar:raw-parts/ When another instance of the same picture/part is placed we should just use the same object we allready use. We could consider creating a newly scaled thumb if the sizes differ a lot. The raw file will stay untouched. kofficecore/ImageContainer.cc manages a picture. You can ask it for thumbs, location, the raw file and it has a save function. - ImageContainer(QString filename, bool external); constructor. if filename starts with tar or external is set: store filename. otherwise read raw file in mem. - int getRefCount() keep internal usage count - koImage* getThumb(QSize); look in tar if there was a thumb. Otherwise create one of selected size. note that koImage also does referece checking. - void incCount(); for usage count - void decCount(); for usage count - koRawImage* getImage(); Return the rawimage (in a stream??) either from mem or from disk. - save(); well, it saves. kofficecore/PartContainer.cc manages a part. You can as it for location (key), the part and it has a save function - PartContainer constructor - getRefCount - void incCount() - void decCount(); - koSomething* getPart(); - save(); kofficeCore/ImageCollection.cc - ImageCollection(); - ImageConatainer* getImage(filename); return imageContainer, if one doesnt exist create it first. - int getCount(); return number of images in the collection - void removeImage(filename); remove image from collection - void load(); load all imageContainers - void save(); save all imageContainers Note that you can not resize an image, just the thumbs. Note also that the 'key' is its filename. With full path that makes it http:// or file:// or tar:// for remote, local, internal storage respectively. Last note: this proposal does not propose any gui/printing issues at all. -- Thomas Zander zander@earthling.net The only thing worse than failure is the fear of trying something new