📄 images.txt
字号:
February 2001, --Jcid ------ IMAGES ------* When a image tag is found within a HTML page, Html_tag_open_imghandles it by: - Parsing & getting attribute values. - Creating a new image structure (DilloImage) and its associated widget (DwImage). i.e. If 'Image' is the var for the structure, then 'Image->dw' is the widget. - Requesting the image to be feeded by the cache. - Sending some info to the browser interface.* The cache can either request the image data from the net, orfeed it directly from the dicache (decompressed image cache).* Both processes are somewhat different because the first onerequires to decode the image data into RGB format, and the secondone has the whole data already decoded.* Regardless of the RGB-data feeding method, the decoded data ispassed to the widget (DwImage) and drawn by GdkRGB in a streamedway. Note that INDEXED images are also decoded into RGB formatbefore sending them to GdkRGB.---------------------Fetching from the net---------------------* a_Cache_open_url initiates the resource request, and whenfinally the answer arrives, the HTTP header is examined for MIMEtype and either the GIF or PNG or JPEG decoder is set to handlethe incoming data stream. Decoding functions: a_Gif_image, a_Jpeg_image and a_Png_image.* The decoding function calls the following dicache methods asthe data is processed (listed in order): a_Dicache_set_parms a_Dicache_set_cmap (only for indexed-GIF images) a_Dicache_write a_Dicache_close* The dicache methods call the necessary functions to connectwith the widget code. This is done by calling image.c functions: a_Image_set_parms a_Image_set_cmap a_Image_write a_Image_close * The functions in image.c make the required a_Dw_image_...calls. -------------------------Fetching from the dicache-------------------------* a_Cache_open_url tests the dicache for the image, and directlyenqueues a cache client for it, without asking the network forthe data. When the client queue is processed (a bit later), thedecoder is selected based on the cache entry type.* When the decoder is called, it tests the dicache for the image;if the image is found, then it sets a_Dicache_callback as thehandling function and gets out of the way (no image decoding isneeded).* Later on, the DwImage buffer is set to reference thedicache-entry's buffer and the rest of the functions calls isdriven by a_Dicache_callback.-----------Misc. notes-----------* Repeated images generate new cache clients, but only one ofthem (the first) is handled with a_Dicache_* functions, the restis done with a_Dicache_callback..* The cache-client callback is set when the Content-type of theimage is got. It can be: a_Png_image, a_Gif_image or a_Jpeg_imageThose are called 'decoders' because their main function is totranslate the original data into RGB format.* Later on, the decoder can substitute itself, if it finds theimage has been already decoded, with a_Dicache_callback function.This avoids decoding it twice.* The dicache-entry and the Image structure hold bit arrays thatrepresent which rows had been decoded.* The image processing can be found in the following sources: - image.[ch] - dicache.[ch] - gif.[ch], png.[ch], jpeg.[ch] - dw_image.[ch]* Bear in mind that there are three data structures for imagecode: - DilloImage (image.h) - DwImage (dw_image.h) - DICacheEntry (dicache.h)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -