 |
NAVTOR SDK
v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
|
|
Go to the documentation of this file. 1 #ifndef SDK_2D_RENDER_TARGET_INTERFACE_H_
11 #define SDK_2D_RENDER_TARGET_INTERFACE_H_
20 #include "2d_graphics_objects.h"
72 sdk::gfx::RenderTargetFactorySP& parent)
const throw() = 0;
108 const sdk::vis::scene::ITextureSP& texture,
109 sdk::gfx::RenderTargetBitmapSP& bitmap)
const throw() = 0;
114 const SDKSize& bitmap_size,
const SDKUInt32& source_data_stride_size,
116 sdk::gfx::RenderTargetBitmapSP& bitmap)
const throw() = 0;
121 const SDKSize& bitmap_size,
const SDKUInt32& source_data_stride_size,
123 const SDKUInt8* source_palette_data, SDKUInt32 source_palette_data_size,
124 sdk::gfx::RenderTargetBitmapSP& bitmap)
const throw() = 0;
128 sdk::gfx::RenderTargetBrushSP& brush)
const throw() = 0;
131 const sdk::gfx::RenderTargetBitmapSP& bitmap,
134 sdk::gfx::RenderTargetBrushSP& brush)
const throw() = 0;
140 const float* line_dash_pattern,
const SDKUInt32& line_dash_pattern_size,
141 sdk::gfx::RenderTargetStrokeStyleSP& stroke_style)
const throw() = 0;
147 sdk::gfx::RenderTargetTextSP& text)
const throw() = 0;
153 const sdk::gfx::GraphicsPathSP& path,
154 const SDKMatrix3X2& transformation_matrix,
const float& line_width,
155 const sdk::gfx::RenderTargetStrokeStyleSP& stroke_style,
162 const sdk::gfx::RenderTargetTextSP& text,
163 sdk::gfx::GraphicsPathSP& text_path)
const throw() = 0;
167 const sdk::gfx::RenderTargetTextSP& text,
SDKRectF2D& bounds)
const throw() = 0;
171 const sdk::gfx::RenderTargetTextSP& text,
172 sdk::gfx::FontMetrics& text_font_metrics)
const throw() = 0;
183 bool& is_draw_in_progress)
const throw() = 0;
193 const sdk::gfx::RenderTargetBrushSP& brush)
const throw() = 0;
201 const sdk::gfx::RenderTargetBrushSP& brush,
const float& line_width,
202 const sdk::gfx::RenderTargetStrokeStyleSP& stroke_style)
const throw() = 0;
207 const sdk::gfx::RenderTargetTextSP& text,
208 const sdk::gfx::RenderTargetBrushSP& brush)
const throw() = 0;
216 const SDKMatrix3X2& transformation_matrix)
throw() = 0;
221 SDKMatrix3X2& transformation_matrix)
const throw() = 0;
227 const sdk::gfx::GraphicsPathSP& clip_path)
throw() = 0;
249 class RTAutoStartFinishDraw
254 RTAutoStartFinishDraw(
const RenderTargetSP& rt)
258 bool is_draw_in_progress =
false;
259 if (
SDK_OK(m_rt->IsDrawInProgress(is_draw_in_progress))) {
260 if (!is_draw_in_progress) {
261 m_start_draw_res = m_rt->StartDraw();
267 ~RTAutoStartFinishDraw()
272 inline bool IsDrawStarted()
const throw() {
273 bool is_draw_in_progress =
false;
274 if (!m_rt ||
SDK_FAILED(m_rt->IsDrawInProgress(is_draw_in_progress)))
276 return is_draw_in_progress;
281 if (m_rt &&
SDK_OK(m_start_draw_res)) {
288 const RenderTargetSP m_rt;
295 class RTAutoRestoreAntiAliasingState
298 RTAutoRestoreAntiAliasingState(
const RenderTargetSP& rt,
311 m_new_mode_applied =
true;
316 ~RTAutoRestoreAntiAliasingState()
318 if (m_rt && m_new_mode_applied)
319 m_rt->SetAntiAliasingMode(m_prev_mode);
322 inline bool IsNewModeApplied()
const throw() {
return m_new_mode_applied; }
325 const RenderTargetSP m_rt;
326 bool m_new_mode_applied;
334 #endif // SDK_2D_RENDER_TARGET_INTERFACE_H_
@ RenderTarget2D_SKIA_OpenGL_Texture
Render target, based on SKIA, which renders by using OpenGL to texture.
Definition: 2d_render_target_interface.h:53
virtual SDKResult SDK_CALLTYPE SetAntiAliasingMode(const sdk::gfx::AntiAliasingMode &mode)=0
Sets new anti-aliasing mode.
virtual SDKResult SDK_CALLTYPE RemoveTransformationMatrixes()=0
Removes all of applied user-defined transformation matrixes.
Graphics path primitive, which can be drawn by using render target object.
A RGBA color.
Definition: color_base_types.h:15
virtual SDKResult SDK_CALLTYPE RemoveClippingPathes()=0
Removes all of applied clipping paths from clipping stack.
PixelFormats
Supported pixel formats for render targets.
Definition: 2d_graphics_consts.h:24
virtual SDKResult SDK_CALLTYPE FinishDraw()=0
Finishes the draw process. No calls to drawing methods are allowed more, till another call to StartDr...
@ RenderTarget2D_SKIA_Software_Window
Google SKIA render targets, based on software rendering (kRenderTargetFactorySKIA_CID factory) Render...
Definition: 2d_render_target_interface.h:57
AntiAliasingMode
Possible anti-aliasing modes.
Definition: 2d_graphics_consts.h:95
virtual SDKResult SDK_CALLTYPE Reinitialize()=0
Forces the render target to reinitialize all of underlying components in case it's possible....
virtual SDKResult SDK_CALLTYPE DrawBitmap(const RenderTargetBitmapSP &bitmap, const SDKRectF2D &source_bitmap_rect, const SDKRectF2D &dest_rect) const =0
Draws the specified bitmap by using source rectangle from bitmap and fitting it to destination rectan...
virtual SDKResult SDK_CALLTYPE CreateBitmap(const sdk::vis::scene::ITextureSP &texture, sdk::gfx::RenderTargetBitmapSP &bitmap) const =0
Creates new Bitmap object from ITexture object.
@ RenderTarget2D_Direct2D_DXGI
Render target, based on Direct2D, which renders to DirectX surface.
Definition: 2d_render_target_interface.h:43
virtual SDKResult SDK_CALLTYPE WriteText(const SDKPointF2D &origin_point, const sdk::gfx::RenderTargetTextSP &text, const sdk::gfx::RenderTargetBrushSP &brush) const =0
Draws the specified text by using the origin point and foreground brush The font size is interpreted ...
virtual SDKResult SDK_CALLTYPE CreateIndexBitmap(const SDKSize &bitmap_size, const SDKUInt32 &source_data_stride_size, const sdk::gfx::PixelFormats &source_data_pixel_format, const SDKUInt8 *source_data, const SDKUInt8 *source_palette_data, SDKUInt32 source_palette_data_size, sdk::gfx::RenderTargetBitmapSP &bitmap) const =0
Creates new Bitmap object by using index bitmap data source with palettes Stride order should be same...
@ RenderTarget2D_SKIA_OpenGL_Context
Google SKIA render targets (kRenderTargetFactorySKIA_CID factory) Render target, based on SKIA,...
Definition: 2d_render_target_interface.h:49
virtual SDKResult SDK_CALLTYPE GetMeasurementUnitsType(sdk::gfx::MeasurementUnits &units_type) const =0
Returns current measurement units type.
virtual SDKResult SDK_CALLTYPE CreateStrokeStyle(const sdk::gfx::StrokeStyleOptions &style_options, const float *line_dash_pattern, const SDKUInt32 &line_dash_pattern_size, sdk::gfx::RenderTargetStrokeStyleSP &stroke_style) const =0
Creates a new stroke style See the DrawPath description for important notes.
@ RenderTarget2D_Unknown
Render target type is unknown.
Definition: 2d_render_target_interface.h:35
virtual SDKResult SDK_CALLTYPE GetDPI(float &dpi_xy) const =0
Returns current render target DPI.
@ AntiAliasingMode_None
Anti-aliasing is disabled.
Definition: 2d_graphics_consts.h:97
virtual SDKResult SDK_CALLTYPE PopTransformationMatrix()=0
Removes latest transformation matrix from matrixes stack.
virtual SDKResult SDK_CALLTYPE CreateBitmapFromRawData(const SDKSize &bitmap_size, const SDKUInt32 &source_data_stride_size, const sdk::gfx::PixelFormats &source_data_pixel_format, const SDKUInt8 *source_data, sdk::gfx::RenderTargetBitmapSP &bitmap) const =0
Creates new Bitmap object by using raw data source Stride order should be same, as BMP has (bottom to...
Holds text to draw and all of appropriate text styles.
Set of parameters for stroke style definition.
Definition: 2d_graphics_consts.h:233
static SDK_INLINE bool IsSDKResultError(const SDKResult result)
Tells if result is an error.
Definition: sdk_results.h:253
virtual SDKResult SDK_CALLTYPE GetTransformationMatrix(SDKMatrix3X2 &transformation_matrix) const =0
Returns current resulting transformation matrix.
RenderTarget2DType
All of available render targets enumeration.
Definition: 2d_render_target_interface.h:32
virtual SDKResult SDK_CALLTYPE CreateBitmapBrush(const sdk::gfx::RenderTargetBitmapSP &bitmap, const sdk::gfx::BitmapBrushExtendMode &ox_extend_mode, const sdk::gfx::BitmapBrushExtendMode &oy_extend_mode, sdk::gfx::RenderTargetBrushSP &brush) const =0
Creates a new bitmap brush.
@ RenderTarget2D_Direct2D_DC
Direct2D render targets (kRenderTargetFactoryDirect2D_CID factory) Render target, based on Direct2D,...
Definition: 2d_render_target_interface.h:39
2D Rectangle
Definition: geometry_base_types.h:1295
virtual SDKResult SDK_CALLTYPE SetMeasurementUnitsType(const sdk::gfx::MeasurementUnits &units_type)=0
Sets new value for measurement units type.
Description of all of supported graphics constants.
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
virtual SDKResult SDK_CALLTYPE GetParent(sdk::gfx::RenderTargetFactorySP &parent) const =0
Returns the parent factory instance, which created the given instance.
Definition of graphic texture interfaces.
virtual RenderTarget2DType SDK_CALLTYPE GetType() const =0
Returns the Render Target type.
virtual SDKResult SDK_CALLTYPE CalcStrokedBounds(const sdk::gfx::GraphicsPathSP &path, const SDKMatrix3X2 &transformation_matrix, const float &line_width, const sdk::gfx::RenderTargetStrokeStyleSP &stroke_style, SDKRectF2D &bounds) const =0
Calculates the path bounding rectangle after stroke operation Current transformation matrixes stack f...
static const SDKResult kSDKResult_NotInitialized
Not initialized.
Definition: sdk_results.h:64
virtual SDKResult SDK_CALLTYPE CreateText(const SDKString &output_text, const SDKString &font_family_name, const sdk::gfx::FontStyle &font_style, const sdk::gfx::FontWeight &font_weight, const float &font_size, sdk::gfx::RenderTargetTextSP &text) const =0
Creates a new text.
Common base SDK interfaces.
Single 2D point.
Definition: geometry_base_types.h:33
#define SDK_FAILED(res)
Checks failed result.
Definition: sdk_results_enum.h:69
virtual SDKResult SDK_CALLTYPE GetTextPath(const SDKPointF2D &origin_point, const sdk::gfx::RenderTargetTextSP &text, sdk::gfx::GraphicsPathSP &text_path) const =0
Extracts the graphics path for text from text instance Current transformation matrixes stack from ren...
virtual SDKResult SDK_CALLTYPE PopClippingPath()=0
Removes latest clipping path from clipping stack.
virtual SDKResult SDK_CALLTYPE GetRenderTargetSize(SDKSize &size) const =0
Returns the size of the render target in real device pixels.
#define SDK_OK(res)
Checks succeeded result.
Definition: sdk_results_enum.h:65
virtual SDKResult SDK_CALLTYPE SetDPI(const float &dpi_xy)=0
Sets new DPI for render target, the DPI value will used to recalculate measurement units to device pi...
@ RenderTarget2D_SKIA_OpenGL_FBO
Render target, based on SKIA, which renders by using OpenGL to FBO.
Definition: 2d_render_target_interface.h:51
Generic 2D render target (allows to render 2D images)
Definition: 2d_render_target_interface.h:64
BitmapBrushExtendMode
Describes possible of extend modes for bitmap based brushes.
Definition: 2d_graphics_consts.h:264
MeasurementUnits
Measurement unit types.
Definition: 2d_graphics_consts.h:33
FontStyle
Possible font styles.
Definition: 2d_graphics_consts.h:175
Stroke style for graphics path drawing.
virtual SDKResult SDK_CALLTYPE IsDrawInProgress(bool &is_draw_in_progress) const =0
Returns the flag, which shows, if drawing in progress now or not i.e. appropriate call to StartDraw w...
virtual SDKResult SDK_CALLTYPE CalcTextBounds(const SDKPointF2D &origin_point, const sdk::gfx::RenderTargetTextSP &text, SDKRectF2D &bounds) const =0
Calculates the text bounding rectangle Current measurement units and DPI will be used for calculation...
virtual SDKResult SDK_CALLTYPE DrawPath(const sdk::gfx::GraphicsPathSP &path, const sdk::gfx::RenderTargetBrushSP &brush, const float &line_width, const sdk::gfx::RenderTargetStrokeStyleSP &stroke_style) const =0
Draws the specified graphics path by using stroke style and brush The size parameters like line_width...
virtual SDKResult SDK_CALLTYPE FillBackground(const SDKColorF &clr) const =0
Fills up the whole area (or clipped, if clipping is active) with color.
virtual SDKResult SDK_CALLTYPE CreateSolidColorBrush(const SDKColorF &clr, sdk::gfx::RenderTargetBrushSP &brush) const =0
Creates a new solid color brush.
virtual SDKResult SDK_CALLTYPE GetTextFontMetrics(const sdk::gfx::RenderTargetTextSP &text, sdk::gfx::FontMetrics &text_font_metrics) const =0
Returns the appropriate text font metrics for given text Current measurement units and DPI will be us...
virtual SDKResult SDK_CALLTYPE GetAntiAliasingMode(sdk::gfx::AntiAliasingMode &mode) const =0
Returns current anti-aliasing mode.
virtual SDKResult SDK_CALLTYPE FillPath(const sdk::gfx::GraphicsPathSP &path, const sdk::gfx::RenderTargetBrushSP &brush) const =0
Fills the specified graphics path by specified brush.
Bitmap object for render target.
FontWeight
Possible font weights.
Definition: 2d_graphics_consts.h:158
virtual SDKResult SDK_CALLTYPE StartDraw()=0
Starts draw process. This method should be called first before any call to drawing methods (All of me...
@ RenderTarget2D_Direct2D_HWND
Render target, based on Direct2D, which renders directly to Windows HWND.
Definition: 2d_render_target_interface.h:41
virtual SDKResult SDK_CALLTYPE PushTransformationMatrix(const SDKMatrix3X2 &transformation_matrix)=0
Adds new transformation matrix to transformation matrixes stack.
@ RenderTarget2D_SKIA_Software_Texture
Render target, based on SKIA, which renders by using software renderer to ITexture object.
Definition: 2d_render_target_interface.h:59
SizeUI.
Definition: geometry_base_types.h:1235
Brush for drawing graphics path by using render target.
virtual SDKResult SDK_CALLTYPE FlushBuffers()=0
Forces to flush the internal buffers.
virtual SDKResult SDK_CALLTYPE PushClippingPath(const sdk::gfx::GraphicsPathSP &clip_path)=0
Adds new clipping path to clipping stack.