コード例 #1
0
 private void setup()
 {
     procedureDate = DateTime.Now;
     Notes         = DefaultNotes;
     StateName     = DefaultStateName;
     ThumbInfo     = null;
 }
コード例 #2
0
        void renderButton_MouseButtonClick(Widget source, EventArgs e)
        {
            closeCurrentImage();
            SceneViewWindow drawingWindow = sceneViewController.ActiveWindow;

            if (drawingWindow != null)
            {
                ImageRendererProperties imageProperties = new ImageRendererProperties();
                imageProperties.Width  = RenderWidth;
                imageProperties.Height = RenderHeight;
                imageProperties.UseWindowBackgroundColor = true;
                imageProperties.AntiAliasingMode         = (int)aaCombo.SelectedIndex * 2;
                if (imageProperties.AntiAliasingMode == 0)
                {
                    imageProperties.AntiAliasingMode = 1;
                }
                imageProperties.ShowBackground        = showBackground.Checked;
                imageProperties.ShowWatermark         = showWatermark.Checked;
                imageProperties.TransparentBackground = transparent.Checked;
                imageRenderer.renderImageAsync(imageProperties, (product) =>
                {
                    currentImage = product;
                    if (currentImage != null)
                    {
                        int previewWidth  = previewMaxWidth;
                        int previewHeight = previewMaxHeight;
                        if (currentImage.Width > currentImage.Height)
                        {
                            float ratio   = (float)currentImage.Height / currentImage.Width;
                            previewHeight = (int)(previewWidth * ratio);
                        }
                        else
                        {
                            float ratio  = (float)currentImage.Width / currentImage.Height;
                            previewWidth = (int)(previewHeight * ratio);
                        }
                        if (previewWidth > currentImage.Width || previewHeight > currentImage.Height)
                        {
                            previewWidth  = currentImage.Width;
                            previewHeight = currentImage.Height;
                        }
                        imageAtlas      = new ImageAtlas("RendererPreview", new IntSize2(previewWidth, previewHeight));
                        String imageKey = imageAtlas.addImage("PreviewImage", currentImage);
                        previewImage.setSize(previewWidth, previewHeight);
                        previewImage.setItemResource(imageKey);
                    }
                    toggleRequireImagesWidgets();
                });
            }
        }
コード例 #3
0
 public ThumbnailPickerInfo(int width, int height, NotesThumbnail thumb)
 {
     imageProp        = new ImageRendererProperties();
     imageProp.Width  = width;
     imageProp.Height = height;
     imageProp.UseWindowBackgroundColor  = false;
     imageProp.CustomBackgroundColor     = BACK_COLOR;
     imageProp.AntiAliasingMode          = 2;
     imageProp.UseActiveViewportLocation = false;
     imageProp.OverrideLayers            = true;
     imageProp.TransparentBackground     = true;
     imageProp.ShowBackground            = false;
     imageProp.ShowWatermark             = false;
     imageProp.ShowUIUpdates             = false;
     imageProp.LayerState     = thumb.LayerState;
     imageProp.CameraPosition = thumb.CameraPosition.Translation;
     imageProp.CameraLookAt   = thumb.CameraPosition.LookAt;
 }
コード例 #4
0
 public override void configureThumbnailProperties(ImageRendererProperties imageProperties)
 {
     base.configureThumbnailProperties(imageProperties);
     foreach (var command in action.Commands)
     {
         if (command is MoveCameraCommand)
         {
             MoveCameraCommand moveCamera = (MoveCameraCommand)command;
             imageProperties.CameraPosition  = moveCamera.CameraPosition.Translation;
             imageProperties.CameraLookAt    = moveCamera.CameraPosition.LookAt;
             imageProperties.UseIncludePoint = moveCamera.CameraPosition.UseIncludePoint;
             imageProperties.IncludePoint    = moveCamera.CameraPosition.IncludePoint;
         }
         if (command is ChangeLayersCommand)
         {
             ChangeLayersCommand changeLayers = (ChangeLayersCommand)command;
             imageProperties.OverrideLayers = true;
             imageProperties.LayerState     = changeLayers.Layers;
         }
     }
 }
コード例 #5
0
        private SceneThumbInfo renderSceneThumbnail()
        {
            SceneThumbInfo          sceneThumbInfo  = new SceneThumbInfo();
            ImageRendererProperties imageProperties = new ImageRendererProperties();

            imageProperties.Width                     = SlideImageManager.SceneThumbWidth;
            imageProperties.Height                    = SlideImageManager.SceneThumbHeight;
            imageProperties.AntiAliasingMode          = 2;
            imageProperties.TransparentBackground     = false;
            imageProperties.UseActiveViewportLocation = false;
            imageProperties.OverrideLayers            = true;
            imageProperties.ShowBackground            = false;
            imageProperties.ShowWatermark             = false;
            imageProperties.ShowUIUpdates             = false;
            slide.StartupAction.configureThumbnailProperties(imageProperties);
            imageProperties.CustomizeCameraPosition = (camera, viewport) =>
            {
                SceneNode node        = camera.getParentSceneNode();
                Vector3   position    = node.getDerivedPosition();
                Vector3   lookAt      = imageProperties.CameraLookAt;
                Vector3   topLeft     = SceneViewWindow.Unproject(0, 0, camera.getViewMatrix(), camera.getProjectionMatrix());
                Vector3   bottomRight = SceneViewWindow.Unproject(1, 1, camera.getViewMatrix(), camera.getProjectionMatrix());
                Vector3   include     = imageProperties.IncludePoint;

                //Move camera back more
                float   distance  = -60;
                Vector3 direction = (position - lookAt).normalized();
                node.setPosition(position - (direction * distance));
                camera.lookAt(lookAt);

                Vector2 includeLoc = SceneViewWindow.Project(include, camera.getViewMatrix(), camera.getProjectionMatrix(), imageProperties.Width, imageProperties.Height);
                sceneThumbInfo.IncludeX = (int)includeLoc.x;
                sceneThumbInfo.IncludeY = (int)includeLoc.y;
                sceneThumbInfo.Color    = viewport.getBackgroundColor();
            };

            sceneThumbInfo.SceneThumb = imageRenderer.renderImage(imageProperties);
            return(sceneThumbInfo);
        }
コード例 #6
0
 public virtual void configureThumbnailProperties(ImageRendererProperties imageProperties)
 {
 }