Hi,

within the context of OOo extensions & improved usability of the
toolkit API, we thought about superseding the deprecated
css::awt::XGraphics rendering interface with something new.

The css::rendering::XCanvas interface was deemed a little bit too
complex for basic rendering, as it is e.g. necessary for rendering
parts of a control (like individual list box entries).

Therefore, here comes a proposal for a simplified canvas interface,
taking the essentials from css::awt::XGraphics (and dropping the
non-portable/legacy functionality), which can easily be implemented as
a facade around a real XCanvas:

--%<------------------------------------------------------------------

interface XSimpleCanvas: com::sun::star::uno::XInterface
{ 
    /** Select a font.<p>

        This method selects the specified font (or a close substitute)
        as the current font for text output.<p>

        @param sFontName
        The name of the font (like e.g. Arial)

        @param size
        The size of the font (note that this is not the usual points
        unit, but in the same coordinate system as the other rendering
        operations - usually, device pixel).

        @param bold
        When true, selected font is bold.

        @param italic
        When true, selected font is italic
     */
    void selectSimpleFont( [in] string sFontName, [in]double size,
        [in] bool bold, [in] bool italic );
 
    //------------------------------------------------------------------------- 
     
    /** Request the font metrics of the current font.<p>

        @return the font metrics of the currently selected font.
     */
    FontMetrics getFontMetrics(); 
 
    //------------------------------------------------------------------------- 

    /** Sets the color used by line and text operations.<p>

        To disable stroking, simply set this color to something with
        zero alpha (i.e. fully transparent).<p>

        @param nsRgbaColor
        RGBA color tuple, interpreted in the sRGB color space.
     */
    void setPenColor( [in] com::sun::star::util::Color nsRgbaColor ); 
 
    //------------------------------------------------------------------------- 
     
    /** Sets the fill color.<p>

        To disable filling, simply set this color to something with
        zero alpha (i.e. fully transparent).<p>

        @param nsRgbaColor
        RGBA color tuple, interpreted in the sRGB color space.
     */
    void setFillColor( [in] com::sun::star::util::Color nsRgbaColor ); 
 
    //------------------------------------------------------------------------- 
     
    /** Sets the clip to the specified poly-polygon.<p>
     */
    void setClip( [in] XPolyPolygon2D aClipPoly ); 
 
    //------------------------------------------------------------------------- 

    /** Sets the clip to the specified rectangle.<p>
     */
    void setRectClip( [in] ::com::sun::star::geometry::RealRectangle2D aRect ); 

    //------------------------------------------------------------------------- 
     
    /** Set the current transform matrix.<p>
     */
    void setTransformation( [in] ::com::sun::star::geometry::AffineMatrix2D 
aTransform );

    //------------------------------------------------------------------------- 
     
    /** Sets a single pixel on the canvas.<p>
     */
    void drawPixel( [in] ::com::sun::star::geometry::RealPoint2D aPoint ); 
 
    //------------------------------------------------------------------------- 
     
    /** Draws a line on the canvas.<p>
     */
    void drawLine( [in] ::com::sun::star::geometry::RealPoint2D aStartPoint, 
                   [in] ::com::sun::star::geometry::RealPoint2D aEndPoint ); 
 
    //------------------------------------------------------------------------- 

    /** Draws a bezier curve on the canvas.<p>
     */
    void drawBezier( [in] ::com::sun::star::geometry::RealBezierSegment2D 
aBezierSegment, 
                     [in] ::com::sun::star::geometry::RealPoint2D aEndPoint );

    //------------------------------------------------------------------------- 
     
    /** Draws a rectangle on the canvas.<p>
     */
    void drawRect( [in] ::com::sun::star::geometry::RealRectangle2D aRect ); 
 
    //------------------------------------------------------------------------- 
     
    /** Draws a poly-polygon on the canvas.<p>
     */
    void drawPolyPolygon( [in] XPolyPolygon2D xPolyPolygon ); 
 
    //------------------------------------------------------------------------- 
     
    /** Draws text on the canvas.<p>

        @param aText
        Text to render

        @param aOutPos
        Output position of the text. This is the left or right edge,
        depending on nTextDirection. Output position is always
        relative to the font baseline.

        @param nTextDirection
        A value from the <type>TextDirection</type> collection,
        denoting the main writing direction for this string. The main
        writing direction determines the origin of the text output,
        i.e. the left edge for left-to-right and the right edge for
        right-to-left text.
     */
    void drawText( [in] StringContext aText, 
                   [in] ::com::sun::star::geometry::RealPoint2D aOutPos,
                   [in] byte nTextDirection );
 
    //------------------------------------------------------------------------- 

    /** Draws the bitmap on the canvas.<p>

        @param xBitmap
        Bitmap to render

        @param aLeftTop
        Left, top position of the bitmap on the destination canvas.
     */
    void drawBitmap( [in] XBitmap xBitmap,
                     [in] ::com::sun::star::geometry::RealPoint2D aLeftTop );

    //-------------------------------------------------------------------------

    /** Request the associated graphic device for this canvas.<p>

        A graphic device provides methods specific to the underlying
        output device capabilities, which are common for all canvases
        rendering to such a device. This includes device resolution,
        color space, or bitmap formats.<p>

        @return the associated <type>XGraphicDevice</type>.
     */
    XGraphicDevice getDevice();
 
    //------------------------------------------------------------------------- 

    /** Query the underlying <type>XCanvas</type>.<p>

        @return the canvas interface this object is internally based
        on.
     */
    XCanvas getCanvas();

    //------------------------------------------------------------------------- 
     
}; 

--%<------------------------------------------------------------------

Feedback greatly appreciated!

Cheers,

-- Thorsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to