plugin_render.h

Go to the documentation of this file.
00001 /*
00002  * File Name: plugin_render.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-common.
00007  *
00008  * uds-plugin-common is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-common is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 #ifndef PLUGIN_RENDER_H_
00028 #define PLUGIN_RENDER_H_
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "plugin_type.h"
00035 #include "plugin_unknown.h"
00036 
00037 /**
00038  * @brief Render area type definition.
00039  */
00040 typedef struct
00041 {
00042     float x_offset;     /**< Offset in X axis, represented by the ratio 
00043                         relatingto the width of the whole page */
00044     float y_offset;     /**< Offset in Y axis, represented by the ratio 
00045                         relating to the height of the whole page */
00046     float width;        /**< width of the render area, represented by the ratio
00047                         relating to the width of the whole page */
00048     float height;       /**< height of the render area, represented by the 
00049                         ratio relating to the height of the whole page */
00050 } RenderArea;
00051 
00052 /**
00053  * @brief Universal Document Shell Plugin Renderer interface.
00054  * Through IPluginRender, caller can:
00055  * - Render content according to anchor and renderer settings
00056  * - Create rendering settings
00057  * - Set memory limit
00058  */
00059 typedef struct
00060 {
00061     /**
00062      * @brief Render content. 
00063      * The plugin would check whether the content has been rendered when caller
00064      * call this function. The plugin can abort other job if necessary. Once 
00065      * the content has been successfully rendered, the plugin would notify the
00066      * caller through the listeners.
00067      * @param thiz     IPluginUnknown pointer of the current view object.
00068      * @param anchor   The content location where rendering starts.
00069      * @param offset   Number of pages to navigate away from the specified anchor
00070      * @param          before rendering can start.
00071      * @param settings The rendering settings associated with this render 
00072      * @param          behavior.
00073      * @param area     For fixed-page oriented document, this variable 
00074      * @param          specifies which part of page need to be rendered.
00075      * @param refId    A ID used to refer the rendering result, including
00076      * @param          rendered image, paragraph text and something else. It is
00077      * @param          generated by caller
00078      * @return PLUGIN_OK            : render request accepted
00079      * @return PLUGIN_OUT_OF_MEMORY : insufficient memory
00080      * @return PLUGIN_NOT_SUPPORTED : invalid request for this plugin,
00081      * @return                        e.g. plugin cannot handle page_offset != 0
00082      * @return PLUGIN_FAIL          : other problem
00083      */
00084     PluginStatus (* render)( IPluginUnknown             *thiz,
00085                              const UDSString            *start_of_page_anchor,
00086                              const int                  page_offset,
00087                              IPluginUnknown             *settings,
00088                              const RenderArea           *area, 
00089                              const unsigned int         render_id );
00090 
00091     /**
00092      * @brief Create rendering settings.
00093      * @param thiz IPluginUnknown pointer of the current view object.
00094      * @return Returns IPluginUnknown pointer of the created render settings 
00095      * object, returns NULL if it fails.
00096      */
00097     IPluginUnknown * (* create_render_settings)( IPluginUnknown  *thiz );
00098 
00099     /**
00100      * @brief Set memory limit for plugin renderer
00101      * @param thiz IPluginUnknown pointer of the current view object.
00102      * @param bytes The memory budget in bytes.
00103      * @return TODO. Add return code here.
00104      */
00105     PluginStatus (* set_memory_limit)( IPluginUnknown       *thiz,   
00106                                        const unsigned int   bytes );
00107 
00108     /**
00109      * @brief Get the original size in pixel of the page (zoom = 100%)
00110      * @param thiz IPluginUnknown pointer of the current view object.
00111      * @param start_of_page_anchor Anchor of the requested page.
00112      * @param width The returned width.
00113      * @param height The returned height.
00114      * @return TODO. Add return code here
00115      */
00116     PluginStatus (* get_original_size)( IPluginUnknown       *thiz,
00117                                         const UDSString      *start_of_page_anchor,
00118                                         unsigned int         *width,
00119                                         unsigned int         *height);
00120 
00121     /**
00122      * @brief Get the content area of a page.
00123      * @param thiz IPluginUnknown pointer of the current view object.
00124      * @param start_of_page_anchor Start anchor of the page.
00125      * @param area The content area of a page
00126      * @return Returns PLUGIN_OK if this function succeeds, otherwise returns PLUGIN_FAIL.
00127      */
00128     PluginStatus (* get_page_content_area)( IPluginUnknown       *thiz,
00129                                             const UDSString      *start_of_page_anchor,
00130                                             RenderArea           *area);
00131 
00132     /**
00133      * @brief Get the original orientation of the page.
00134      * @param thiz IPluginUnknown pointer of the current view object.
00135      * @param start_of_page_anchor Start anchor of the page.
00136      * @param rotation How the page was rotated before it was stored in the file,
00137      *                 e.g. Clockwise_Degrees_90 means the page was rotated 90 degrees
00138      *                 before it was stored in the file, so for properly displaying it
00139      *                 the page must be rotated (360 - 90) degrees clockwise
00140      * @return This function returns PLUGIN_OK if plugin can retrieve 
00141      *         the original rotation. Otherwise, it returns the PLUGIN_FAIL.
00142      */
00143     PluginStatus (* get_original_rotation)( IPluginUnknown       *thiz,
00144                                             const UDSString      *start_of_page_anchor,
00145                                             PluginRotationDegree *rotation );
00146 
00147 } IPluginRender;
00148 
00149 #ifdef __cplusplus
00150 }
00151 #endif 
00152 
00153 #endif
Generated by  doxygen 1.6.2-20100208