[C++SDK] ISkpRenderer
-
I have hard time figuring out what object should I query to get the ISkpRenderer*. There is no info on it in SDK docs.
I have tried with ISkpAppliaction, ISkpDocument, ISkpView(Current), but without success.I want to use member function called RenderToBitmap.
HRESULT ISkpRenderer;;RenderToBitmap ( [in] unsigned long width, [in] unsigned long height, [in] unsigned long bytesPerPixel, [in] unsigned long bytesPerRow, [in] unsigned long backgroundMode, [in] unsigned long format, [in] unsigned long type, [in] BOOL topToBottom, [in] BOOL nprSpeedMatters, [in] float outputDPI, [in] float linewidth, [in, out] unsigned char * bitmapBytes )
There are some intriguing parameters I am not really sure what they stand for or what options they offer: bytesPerRow, backgroundMode, format, type. My guess it that 0 will work fine for backgroundMode, format and type. The most mysterious for me is bytesPerRow.
Does anyone know?
-
I'm not familiar with the old C++ SDK, but you are aware that will be deprecated and removed, yes?
-
@tt_su said:
I'm not familiar with the old C++ SDK, but you are aware that will be deprecated and removed, yes?
Yes, I do. It is fine. I have to access the visible bitmap at high resolution as fast as possible. I will check the ISkpCamera. Maybe this will give me the required object.
It would be nice to see same functionality in the SLAPI in a future.
-
tomasz,
I'll remind you that SkpReader is being deprecated, and strongly recommend that you convert to either Ruby or the C API as soon as possible. I'll add an item on our side regarding your need to access the visible bitmap in high resolution through the C API.
Looks like there's a get_Renderer on ISkpDocument. Is that one that you tried? If so, what did it do?
For those parameters you mention, they are:
bytesPerRow - allows for padding
backgroundMode - the EBGRenderMode. Here's our enum values.
enum EBGRenderMode {
kBGNormal = 0,
kBGWhite,
kBGTransparent
};format - Pixel format. Options:
#define GL_COLOR_INDEX 0x1900
#define GL_STENCIL_INDEX 0x1901
#define GL_DEPTH_COMPONENT 0x1902
#define GL_RED 0x1903
#define GL_GREEN 0x1904
#define GL_BLUE 0x1905
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190Atype - Size of each data value. Here are the options.
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
#define GL_2_BYTES 0x1407
#define GL_3_BYTES 0x1408
#define GL_4_BYTES 0x1409
#define GL_DOUBLE 0x140AHope this helps,
Paul -
tomasz,
Can you clarify what specifically you're trying to do here? I'm writing up the issue for slapi and I want to ensure I capture what you need correctly. Are you wanting to get access to 2D image data representing the current SketchUp drawing?
Thanks,
Paul@tomasz said:
@tt_su said:
I'm not familiar with the old C++ SDK, but you are aware that will be deprecated and removed, yes?
Yes, I do. It is fine. I have to access the visible bitmap at high resolution as fast as possible. I will check the ISkpCamera. Maybe this will give me the required object.
It would be nice to see same functionality in the SLAPI in a future.
-
@pballew said:
Looks like there's a get_Renderer on ISkpDocument.
I have missed it!
Thank you for all details. It looks it works all right in SU8 and earlier.@pballew said:
I'll remind you that SkpReader is being deprecated, and strongly recommend that you convert to either Ruby or the C API as soon as possible.
I am aware of the fact. I would gladly use SLAPI for SU 2013+. The solution would be welcomed by any plugin developer that wants to do any form of post-processing of SketchUp view output.
I want to get 2D representation of a current view in a high resolution preferably without writing it to disk, because speed matters in this particular case. If the new function would be something similar to RenderToBitmap(), then it would be just fine.
-
Just to make sure I haven't missed anything, the SLAPI can't be used to access the model data in an active SketchUp session the way the old COM API can, correct? Still just file read and write? (I know the preferred route is Ruby, of course, but the COM API is magnitudes faster)
(Sorry to butt in on your thread tomasz )
-
Yes, currently the SLAPI cannot access the live model. That's why the old C++ can still be used in the current version of SketchUp.
Once SLAPI do support this the old C++SDK will be completely removed from the product.
-
Thanks! Look forward to that day (I hate COM).
-
Advertisement