sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [C++SDK] ISkpRenderer

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 4 Posters 503 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tomasz
      last edited by

      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?

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        I'm not familiar with the old C++ SDK, but you are aware that will be deprecated and removed, yes?

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomasz
          last edited by

          @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.

          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

          1 Reply Last reply Reply Quote 0
          • P Offline
            pballew
            last edited by

            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 0x190A

            type - 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 0x140A

            Hope this helps,
            Paul

            1 Reply Last reply Reply Quote 0
            • P Offline
              pballew
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • T Offline
                tomasz
                last edited by

                @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.

                Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                1 Reply Last reply Reply Quote 0
                • A Offline
                  avariant
                  last edited by

                  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 πŸ˜‰ )

                  1 Reply Last reply Reply Quote 0
                  • tt_suT Offline
                    tt_su
                    last edited by

                    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.

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      avariant
                      last edited by

                      Thanks! Look forward to that day (I hate COM).

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomasz
                        last edited by

                        @avariant said:

                        Thanks! Look forward to that day (I hate COM).

                        +1

                        Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement