NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
IGL2DCanvas Class Referenceabstract

GL2D Canvas to use to drawing NOTE! Create/Draw functionality was moved to appropriate GL2D Canvas Func interface. More...

#include <gl2d_canvas_interface.h>

Inherits ISDKProperties, IGL2DCanvasUtils, IGL2DCanvasProjectionFunc, IGL2DCanvasPaletteFunc, IGL2DCanvasRadarImageFunc, IGL2DCanvasFilledCirclesFunc, IGL2DCanvasPatternFunc, IGL2DCanvasTextBoxFunc, IGL2DCanvasBorderedLatin1TextFunc, IGL2DCanvasLatin1TextFunc, IGL2DCanvasTextFunc, IGL2DCanvasLineMarkFunc, IGL2DCanvasSpritesFunc, IGL2DCanvasTexturedLineFunc, IGL2DCanvasTextureFunc, IGL2DCanvasLightSourceFunc, IGL2DCanvasMeshFunc, and IGL2DCanvasLineFunc.

Public Member Functions

virtual void SDK_CALLTYPE Dump () const =0 throw ()
 Dumps given object.
 
virtual IGL2DFactorySP SDK_CALLTYPE GetParent () const =0 throw ()
 Returns parent factory object.
 
virtual IGL2DFontsStorageSP SDK_CALLTYPE GetFontsStorage () const =0 throw ()
 Returns Fonts Storage.
 
virtual IGL2DCanvasDrawLockSP SDK_CALLTYPE GetDrawLock () const =0 throw ()
 Returns Canvas Draw Lock instance.
 
virtual GL2DPlatformType SDK_CALLTYPE GetPlatformType () const =0 throw ()
 Returns GL platform type (WGL/EGL/MESA/GLX/etc)
 
virtual GL2DCanvasType SDK_CALLTYPE GetCanvasType () const =0 throw ()
 Returns GL canvas type (OpenGL/OpenGL ES2/etc)
 
virtual GL2DDeviceType SDK_CALLTYPE GetDeviceType () const =0 throw ()
 Returns device type (Generic/iPhone/whatever)
 
virtual IGL2DCapsSP SDK_CALLTYPE GetCaps () const =0 throw ()
 Returns OpenGL caps (OpenGL capabilities info)
 
virtual IGL2DStatsSP SDK_CALLTYPE GetStats () const =0 throw ()
 Returns OpenGL stats (OpenGL usage statistics)
 
bool IsCanvasOperationSupported (const GL2DCanvasOperationType &type) const
 Checks, if given operation supported by canvas Same as IGL2DCaps::IsCanvasOperationSupported.
 
virtual SDKResult SDK_CALLTYPE LockCanvas (const bool &release_internal_contexts)=0 throw ()
 Locks given GL2D canvas and suspends some or all of OpenGL operations Each lock operation should be followed by appropriate unlock Due of OpenGL operations are suspended, any thread which calls any method, other than IGL2DCanvas::UnLockCanvas/IsCanvasLocked or IGL2DCanvas::GetResourceGlContext/GetDrawingGlContext will hang with 99% probability depending of OpenGL functionality usage, means at least one thread should not call any GL2D methods except unlocking one. More...
 
virtual SDKResult SDK_CALLTYPE UnLockCanvas ()=0 throw ()
 Unlocks previously locked canvas.
 
virtual bool SDK_CALLTYPE IsCanvasLocked () const =0 throw ()
 Checks, if canvas is locked.
 
virtual SDKResult SDK_CALLTYPE ForceUnlockAndResume ()=0 throw ()
 NL-1671: retained as a no-op vtable slot for ABI compatibility (was a Fix-4 recovery entry point; recovery is now handled at the scene-manager L2 layer via IsCanvasStuck/RenderingFailed). Kept here solely to preserve the IGL2DCanvas vtable layout deployed on field units so other SDK libs compiled against it stay binary-compatible. Always returns Ok; never throws.
 
virtual SDKResult SDK_CALLTYPE GetResourceGlContext (GlCtx &resource_ctx) const =0 throw ()
 Returns internal Resource GL context data (Canvas should be locked with release_internal_contexts = true) Not supported for kGL2DPlatformType_ExternallyCreated Not supported for kGL2DPlatformType_ExternallyManaged.
 
virtual SDKResult SDK_CALLTYPE GetDrawingGlContext (GlCtx &drawing_ctx) const =0 throw ()
 Returns internal Drawing GL context data (Canvas should be locked with release_internal_contexts = true) Not supported for kGL2DPlatformType_ExternallyCreated Not supported for kGL2DPlatformType_ExternallyManaged.
 
virtual bool SDK_CALLTYPE IsSameContextForDrawingAndResources () const =0 throw ()
 Returns true in case internal Resource GL context is same as internal GL Drawing context (Only one OpenGL context in use for resource generation and for rendering of given resources)
 
bool SDK_CALLTYPE IsSeparateContextsForDrawingAndResources () const
 Returns true in case internal Resource GL context is not same as internal Drawing GL context.
 
virtual SDKResult SDK_CALLTYPE EnsureGLDataLoaded () const =0 throw ()
 Some devices have issues while working with separate Resource/Drawing contexts, in case GL object is created in Resource context and immediately used in Drawing context not all of data can be loaded into GL engine yet, this method calls for glFinish for resource context to be sure that data is really loaded and can be used for drawing by Drawing context Calling thread will hang till glFinish will not be performed No sense to use given method in case IsSameContextForDrawingAndResources() == true but it's not forbidden, it's legal way to call for glFinish if you need this.
 
virtual SDKResult SDK_CALLTYPE ClearUpCache (const SDKUInt32 &cache_id) const =0 throw ()
 Tries to remove unused entries from appropriate canvas cache(s) cache_id - Combination of GL2DCacheType entries.
 
virtual SDKResult SDK_CALLTYPE ReduceCacheSize (const SDKUInt32 &cache_id, const SDKUInt64 &size_to_reduce) const =0 throw ()
 Tries to reduce appropriate cache size by removing unused items Only kGL2DGL2DCacheType_GLBuffers can be reduced for now cache_id - Should be set to kGL2DGL2DCacheType_GLBuffers size_to_reduce - Requested cache reduce size in bytes.
 
virtual SDKResult SDK_CALLTYPE CreateTexturesStorage (IGL2DTexturesStorageSP &textures_storage) const =0 throw ()
 Creates new textures storage.
 
virtual SDKResult SDK_CALLTYPE DrawTexturesToTexture (const IGL2DTextureSP &output_texture, const SDKMatrix3X2 &canvas_transformation, const SDKColorF &output_tex_clear_color, const IGL2DTexturesStorageSP &textures_to_render) const =0 throw ()
 Draws several textures to output texture. No need to call for StartDraw/FinishDraw for given operation, it can be performed even in case draw in progress now output_texture - Texture to render into canvas_transformation - Canvas transformation matrix, original GL2D canvas transformation matrix will be ignored output_tex_clear_color - Color to use for initial output texture clean up textures_to_render - Set of textures to render.
 
virtual SDKResult SDK_CALLTYPE StartDraw (const IGL2DTextureSP &texture)=0 throw ()
 Initiates new drawing process on texture. Texture can't be used during draw in progress In case context is managed externally, it's allowed to use empty texture - in this case drawing will be performed on currently active FBO.
 
virtual SDKResult SDK_CALLTYPE FinishDraw (const bool &with_glfinish)=0 throw ()
 Finishes currently running drawing process. Texture can be be used after draw is finished In case drawing was performed to currently active FBO (externally managed context), caller should call for appropriate xxxSwapBuffers method with_glfinish flag set to true forces call to glFinish method, if flag set to false - no glFinish will be called, but texture rendering can be not completed.
 
virtual bool SDK_CALLTYPE IsDrawStarted () const =0 throw ()
 Checks, if draw in progress.
 
virtual IGL2DDrawStatsSP SDK_CALLTYPE GetDrawStats () const =0 throw ()
 Returns last draw operation statistics.
 
virtual IGL2DTextureSP SDK_CALLTYPE CloneActiveFboBackBuffer () const =0 throw ()
 Copies currently active FBO back-buffer to appropriate texture Allows to make screenshots of active FBO back-buffer Reduces performance due of calling to glFinish before clone operation. This method should be called only during draw operation, i.e. before calling to FinishDraw NOTE: Not all of FBO can be cloned due of it's format. Mostly it's about OpenGL ES2 and formats like BGRA/RGB/RGB16. At least for RGBA based FBO cloning operation is always supported.
 
virtual SDKSize SDK_CALLTYPE GetSize () const =0 throw ()
 Returns current canvas size Draw should be in progress, otherwise canvas size is zero Returns either size of attached texture or size of currently active FBO viewport.
 
virtual SDKResult SDK_CALLTYPE ToggleAntiAliasing (const bool &is_enabled)=0 throw ()
 Toggles anti-aliasing on/off.
 
virtual bool SDK_CALLTYPE IsAntiAliasingEnabled () const =0 throw ()
 Returns current state of anti-aliasing flag (enabled/disabled)
 
virtual SDKResult SDK_CALLTYPE Clear (const SDKColorF &clr) const =0 throw ()
 Clears whole canvas by specified color.
 
virtual SDKResult SDK_CALLTYPE PushObjectsTransformationMatrix (const SDKMatrix3X2 &matrix)=0 throw ()
 Adds new objects transformation matrix to transformation matrices stack.
 
virtual SDKResult SDK_CALLTYPE PopObjectsTransformationMatrix ()=0 throw ()
 Removes latest objects transformation matrix from matrices stack.
 
virtual SDKResult SDK_CALLTYPE RemoveObjectsTransformationMatrixes ()=0 throw ()
 Removes all of applied objects transformation matrices.
 
virtual SDKResult SDK_CALLTYPE GetObjectsTransformationMatrix (SDKMatrix3X2 &matrix) const =0 throw ()
 Returns current resulting object transformation matrix.
 
virtual SDKResult SDK_CALLTYPE SetCanvasTransformationMatrix (const SDKMatrix3X2 &matrix)=0 throw ()
 Sets new canvas transformation matrix, removes previous one.
 
virtual SDKResult SDK_CALLTYPE ApplyCanvasTransformationMatrix (const SDKMatrix3X2 &matrix)=0 throw ()
 Applies new canvas transformation matrix to current canvas transformation.
 
virtual SDKResult SDK_CALLTYPE GetCanvasTransformationMatrix (SDKMatrix3X2 &matrix) const =0 throw ()
 Returns current canvas transformation matrix.
 
virtual SDKResult SDK_CALLTYPE RemoveTransformationMatrixes ()=0 throw ()
 Removes all of canvas/objects transformation matrixes.
 
virtual SDKResult SDK_CALLTYPE GetTotalTransformationMatrix (SDKMatrix3X2 &matrix) const =0 throw ()
 Returns total (objects + canvas) transformation matrix, applied to canvas.
 
virtual IGL2DClipRuleSP SDK_CALLTYPE CreateClipRule (const GL2DClipRuleType &type) const =0 throw ()
 Creates new clip rule of appropriate type.
 
virtual SDKResult SDK_CALLTYPE SetClipRule (const IGL2DClipRuleSP &rule)=0 throw ()
 Sets new clip rule.
 
virtual IGL2DClipRuleSP SDK_CALLTYPE GetClipRule () const =0 throw ()
 Returns current clip rule.
 
SDKResult SDK_CALLTYPE ResetClipRule ()
 Resets current clip rule.
 
virtual SDKAtomicRefCount SDK_CALLTYPE AddRef () const =0 throw ()
 ISDKComponent own declaration.
 

Detailed Description

GL2D Canvas to use to drawing NOTE! Create/Draw functionality was moved to appropriate GL2D Canvas Func interface.

Member Function Documentation

◆ LockCanvas()

virtual SDKResult SDK_CALLTYPE LockCanvas ( const bool &  release_internal_contexts)
throw (
)
pure virtual

Locks given GL2D canvas and suspends some or all of OpenGL operations Each lock operation should be followed by appropriate unlock Due of OpenGL operations are suspended, any thread which calls any method, other than IGL2DCanvas::UnLockCanvas/IsCanvasLocked or IGL2DCanvas::GetResourceGlContext/GetDrawingGlContext will hang with 99% probability depending of OpenGL functionality usage, means at least one thread should not call any GL2D methods except unlocking one.

This scenario causes deadlock: Thread 1: LockCanvas CreateTextureNonPremultipliedColors <– Thread will hang here UnLockCanvas <– Unlock will never be called

This scenario is OK: Thread 1: Thread 2: Do some stuff CreateTextureNonPremultipliedColors LockCanvas Do some stuff CreateTextureNonPremultipliedColors Do some stuff Hangs, waits for Unlock UnLockCanvas

In case release_internal_contexts == false: it's guaranteed that GL2D OpenGL subsystem will not be able to create any of GL resource till unlock will not be called. But GL threads will be still active and in case rendering task does not require any GL resources generation, external calling thread will be able to continue rendering

In case release_internal_contexts == true: each of internal GL contexts will be detached from appropriate thread and can be used externally via GetResourceGlContext/GetDrawingGlContext methods. Means it's guaranteed that no calls to OpenGL will be performed by GL2D till unlock, therefore it's allowed to perform any actions with any of shared OpenGL contexts.


The documentation for this class was generated from the following file: