sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description: Internal binding API for OpenVG, used for managing OpenVG rendering contexts.
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
#ifndef _OPENVG_CONTEXT_SYMBIAN_H
|
sl@0
|
18 |
#define _OPENVG_CONTEXT_SYMBIAN_H
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "vg/vgcontext.h"
|
sl@0
|
21 |
#include <fbs.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
/**
|
sl@0
|
24 |
* OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
|
sl@0
|
25 |
* made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
|
sl@0
|
26 |
* by OpenVG and made active for Read and Write.
|
sl@0
|
27 |
* @param aSize Size of the rendering surface (back buffer) size in pixels.
|
sl@0
|
28 |
* @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
|
sl@0
|
29 |
* @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
|
sl@0
|
30 |
* if width or height are negative. Returns error code KErrNoMemory if there is insufficient
|
sl@0
|
31 |
* free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
|
sl@0
|
32 |
* work). Returns error code KErrAlreadyExists if the surface and context already exists in this
|
sl@0
|
33 |
* process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
|
sl@0
|
34 |
* if the given colorspace is not supported by the implementation.
|
sl@0
|
35 |
*/
|
sl@0
|
36 |
IMPORT_C TInt VGISymbianInitialize( TSize aSize, VGIColorSpace aColorSpace );
|
sl@0
|
37 |
|
sl@0
|
38 |
/**
|
sl@0
|
39 |
* OpenVG is initialized with the selected size and colorspace. A single rendering context is created and
|
sl@0
|
40 |
* made active (there is no support for multiple contexts). Single rendering (back buffer) surface is created
|
sl@0
|
41 |
* by OpenVG and made active for Read and Write.
|
sl@0
|
42 |
* @param aSize Size of the rendering surface (back buffer) size in pixels.
|
sl@0
|
43 |
* @param aColorSpace Color space to be used. Must be either VGI_COLORSPACE_LINEAR or VGI_COLORSPACE_SRGB.
|
sl@0
|
44 |
* @return Returns KErrNone if initialization was successful. Returns error code KErrArgument
|
sl@0
|
45 |
* if width or height are negative. Returns error code KErrNoMemory if there is insufficient
|
sl@0
|
46 |
* free memory to complete the initialization (smaller size for back buffer or smaller antialiasing setting may
|
sl@0
|
47 |
* work). Returns error code KErrAlreadyExists if the surface and context already exists in this
|
sl@0
|
48 |
* process & thread (call VGITerminate to reset). Returns error code KErrNotSupported
|
sl@0
|
49 |
* if the given colorspace is not supported by the implementation.
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
IMPORT_C TInt VGISymbianInitializeEx( TSize aSize, VGIColorSpace aColorSpace, TBool aPremultiplied, TBool aConformant );
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
* Copies the current contents of the internal back buffer to the given target buffer using the given stride
|
sl@0
|
55 |
* and format. Back buffer contents may be undefined after this function as it marks the start of new frame.
|
sl@0
|
56 |
* All target formats are supported by all implementations and the format bit pattern definitions match the
|
sl@0
|
57 |
* Symbian formats (EColo64K, EColor16M, EColor16MU, EColor16MA). Target buffer memory is assumed to be generic
|
sl@0
|
58 |
* system memory (MMU mapped).
|
sl@0
|
59 |
* @param aBitmap Target buffer where the current back buffer is copied to.
|
sl@0
|
60 |
* The implementation uses internal back buffer and this target buffer is used only
|
sl@0
|
61 |
* during the execution of this method.
|
sl@0
|
62 |
* @param aMaskBitmap Target buffer for the 8-bits per pixel destination alpha output
|
sl@0
|
63 |
* (only written to by the method if parameter is not NULL and format is other than EColor16MA)
|
sl@0
|
64 |
* @param aHint Specify how to process transparent pixels.
|
sl@0
|
65 |
* Value VGI_SKIP_TRANSPARENT_PIXELS means transparent pixels are not copied to the target buffer.
|
sl@0
|
66 |
* Value VGI_COPY_TRANSPARENT_PIXELS means every pixel transparent or not is copied to the target buffer.
|
sl@0
|
67 |
* @return Returns KErrNone if copying completed successfully. Returns error code KErrArgument
|
sl@0
|
68 |
* if aBitmap is NULL or if aHint is neither VGI_SKIP_TRANSPARENT_PIXELS nor VGI_COPY_TRANSPARENT_PIXELS.
|
sl@0
|
69 |
* Returns error code KErrNoMemory if there is insufficient
|
sl@0
|
70 |
* free memory to complete the copying (before returning this error code the implementation internally
|
sl@0
|
71 |
* calls VGISymbianTerminate() and current context and surface are lost.
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
IMPORT_C TInt VGISymbianCopyToBitmap( CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap = NULL, VGICopyToTargetHint aHint = VGI_COPY_TRANSPARENT_PIXELS );
|
sl@0
|
74 |
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
* Rendering surface and context are freed and may not be used after call to this method. OpenVG is terminated (all
|
sl@0
|
77 |
* other related resources are freed). If this method is called before VGISymbianInitialize, or VGISymbianTerminate is called after
|
sl@0
|
78 |
* already being called, this method does nothing. In other words it is safe to call VGISymbianTerminate() multiple times
|
sl@0
|
79 |
* sequentially.
|
sl@0
|
80 |
*/
|
sl@0
|
81 |
IMPORT_C void VGISymbianTerminate();
|
sl@0
|
82 |
|
sl@0
|
83 |
/**
|
sl@0
|
84 |
* Resizes the back buffer to have the given width and height . This method should always be used to resize the back buffer as in
|
sl@0
|
85 |
* many implementations the resize operation can be handled more efficiently than a plain delete old, create new method.
|
sl@0
|
86 |
* Old context is preserved and can be used after the resize operation. Contents of the new frame buffer are UNDEFINED.
|
sl@0
|
87 |
* @param aSize Size of the rendering surface (back buffer) after resize operation, size in pixels.
|
sl@0
|
88 |
* @return Returns KErrNone if resize operation was successful.
|
sl@0
|
89 |
* Returns error code KErrPermissionDenied if an image is currently set as the render target.
|
sl@0
|
90 |
* Returns error code KErrArgument if width or height are negative or error code KErrNoMemory if there is insufficient free memory
|
sl@0
|
91 |
* to allocate the back buffer of given size (smaller size may work).
|
sl@0
|
92 |
* @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
IMPORT_C TInt VGISymbianResize( TSize aSize );
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
* Redirects rendering to an image.
|
sl@0
|
98 |
* @param aImage Image to be set as the render target.
|
sl@0
|
99 |
* @return Returns KErrNone if successful.
|
sl@0
|
100 |
* Returns error code KErrBadHandle if aImage is not a valid image handle, or is not shared with the current context.
|
sl@0
|
101 |
* Returns error code KErrNotSupported if aImage is not of the same format as the "master surface".
|
sl@0
|
102 |
* Returns error code KErrInUse if aImage shares storage with any other image (via use of the vgChildImage function),
|
sl@0
|
103 |
* or is set as a paint pattern image on a paint object.
|
sl@0
|
104 |
* Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
|
sl@0
|
105 |
* @note: if KErrNoMemory is returned, the original surface is lost and VGISymbianTerminate is called internally (context & surface is lost)
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
IMPORT_C TInt VGISymbianBindToImage( VGImage aImage );
|
sl@0
|
108 |
|
sl@0
|
109 |
/**
|
sl@0
|
110 |
* Reset the "master surface" as current render target .
|
sl@0
|
111 |
* @return Returns KErrNone if successful.
|
sl@0
|
112 |
* Returns error code KErrNoMemory if there is insufficient free memory to perform the operation.
|
sl@0
|
113 |
* @note: if KErrNoMemory is returned, the original surface is lost and VGITerminate is called internally (context & surface is lost)
|
sl@0
|
114 |
*/
|
sl@0
|
115 |
IMPORT_C TInt VGISymbianUnBindImage();
|
sl@0
|
116 |
|
sl@0
|
117 |
#endif /* _OPENVG_CONTEXT_SYMBIAN_H */
|