<?xml version="1.0"?>
<abiword version="unnumbered"  fileformat="1.0">
<!-- =====================================================================  -->
<!-- This file is an AbiWord document.                                      -->
<!-- AbiWord is a free, Open Source word processor.                         -->
<!-- You may obtain more information about AbiWord at www.abisource.com     -->
<!-- You should not edit this file by hand.                                 -->
<!-- =====================================================================  -->

<!--         Build_ID          = (none) -->
<!--         Build_Version     = unnumbered -->
<!--         Build_Options     = LicensedTrademarks:Off Debug:On BiDi:Off Bonobo:Off DirectPrint:On Gnome:On LibXML:Off Pspell:On Scripting:Off -->
<!--         Build_Target      = /home/dom/abiword/abi/src/../src/Linux_2.2.16-22_i386_GNOME/obj -->
<!--         Build_CompileTime = 15:08:17 -->
<!--         Build_CompileDate = May  1 2001 -->

<lists>
<l id="1007575892" parentid="0" type="5" start-value="0" list-delim="%L" list-decimal="NULL"/>
<l id="1333603524" parentid="0" type="5" start-value="0" list-delim="%L" list-decimal="NULL"/>
<l id="1074462486" parentid="0" type="5" start-value="0" list-delim="%L" list-decimal="NULL"/>
<l id="264742343" parentid="0" type="5" start-value="0" list-delim="%L" list-decimal="NULL"/>
<l id="861642310" parentid="0" type="5" start-value="0" list-delim="%L" list-decimal="NULL"/>
</lists>
<pagesize pagetype="Letter" orientation="portrait" width="8.500000" height="11.000000" units="inch" page-scale="1.000000"/>
<section>
<p><c props="lang:en-US">Image Draft Proposal</c></p>
<p><c props="lang:en-US">Dom Lachowicz &lt;cinamod@hotmail.com&gt;</c></p>
<p><c props="lang:en-US"></c></p>
<p><c props="lang:en-US">Ok, so this is a starter for a new image infastructure. Comments are very much appreciated because this is </c><c props="font-weight:bold; lang:en-US; text-decoration:underline">very</c><c props="lang:en-US"> larval.</c></p>
<p><c props="lang:en-US"></c></p>
<p><c props="lang:en-US">Image creation/handling already is done by platform-specific code (GR_UnixImage, GR_Win32Image, etc...) The problem is that while 90% of the code is shared, all of the interesting stuff is platform-specific, because RGBA buffers are very platform-specific.  So what I want to do is provide a nice XP API which will wrap some (barely) p-specific problems.</c></p>
<p><c props="lang:en-US"></c></p>
<p><c props="lang:en-US"></c><c props="lang:en-US">What I suggest that will deal with is an ImageFactory class which is responsible with all of the nit-picky details related with assembling useful images. What I’m currently considering is an architecture kind-of like the following:</c></p>
<p style="Heading 1">ImageFactory:</p>
<p level="1" listid="1007575892" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; margin-left:1.0000in; start-value:0; text-decoration:none; text-indent:-0.5000in; text-position:normal"><c></c><field type="list_label"></field><c type="list_label">	</c><c props="lang:en-US">Is responsible for creating ImageSources. It will match the proper ImageLoader and ImageSerializer together for any given input type via an ImageSniffer</c></p>
<p level="1" listid="0" parentid="0" style="Heading 1">ImageSniffer:</p>
<p level="1" listid="861642310" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; margin-left:1.0000in; start-value:0; text-decoration:none; text-indent:-0.5000in; text-position:normal"><field type="list_label"></field><c type="list_label">	For all intensive purposes, this is a recognizeContents and static_constructor replacement, so that images can be loaded via a plugin architecture. This is just an interface for specific subclasses to implement. Code for such sniffers can be taken right out of GdkPixbuf sources, for example. The sniffer can be asked to return an ImageLoader if it supports the content-type. May rely upon say IM or GdkPixbuf even... This interface and its subclasses will be XP, except if we choose to implement some platform-specific fancy library like GdkPixbuf or IM.</c></p>
<p style="Heading 1">ImageLoader:</p>
<p level="1" listid="1333603524" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; margin-left:1.0000in; start-value:0; text-decoration:none; text-indent:-0.5000in; text-position:normal"><field type="list_label"></field><c type="list_label">	Reads PNG, JPG, whatever from disk and turns it into a platform-specific RGBA buffer. There will need to be platform-specific code here to handle proper creation of a platform-specific RGBA buffer (exactly how much remains to be seen).</c></p>
<p level="1" listid="0" parentid="0" style="Heading 1"><c type="list_label">ImageSerializer:</c></p>
<p level="1" listid="1074462486" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; margin-left:1.0000in; start-value:0; text-decoration:none; text-indent:-0.5000in; text-position:normal"><c type="list_label"></c><field type="list_label"></field><c type="list_label">	Takes a platform-specific RGBA buffer and turns it back into a specific format. Possible suggestions for this format include PNG and JPG, though there will be a “pluggable” list of such possible backends in an ideal world with one of them being the default (PNG). This class will require some platform-specific code.</c></p>
<p level="1" listid="0" parentid="0" style="Heading 1">ImageSource: </p>
<p level="1" listid="1074462486" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; line-height:1.000000; list-decimal:NULL; list-delim:%L; margin-bottom:0.0000in; margin-left:1.0000in; margin-right:0.0000in; margin-top:0.0000in; start-value:0 ; text-align:left; text-decoration:none; text-indent:-0.5000in; text-position:normal"><field type="list_label"></field><c props="color:000000; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; text-decoration:none; text-position:normal">	This class is a composite of an ImageLoader and an ImageSerializer. This is what we keep track of internally, reference count, live in the piece-table, etc..., and what will create our FG_Graphic images that we will later display. This class will be entirely XP.</c></p>
<p level="1" listid="0" parentid="0" style="Heading 1"><c type="list_label">FG_Graphic:</c></p>
<p level="1" listid="264742343" parentid="0" style="Bullet List" props="bgcolor:transparent; color:000000; field-font:Symbol; font-family:Times New Roman; font-size:12pt; font-style:normal; font-weight:normal; lang:en-US; margin-left:1.0000in; start-value:0; text-decoration:none; text-indent:-0.5000in; text-position:normal"><c type="list_label"></c><field type="list_label"></field><c type="list_label">	Somewhat similar to the present class. This will be produced from a specific ImageSource and will able to render to a specific GR_Graphics subclass through a generic API. This class will be entirely XP. It’ll keep track or rotation, scaled dimensions, etc... The most important method that it’ll expose is: render(GR_Graphics*) </c></p>
</section>
</abiword>

