public InkTransformFilter(SlideDisplayModel display) { this.m_SlideDisplay = display; this.m_SlideDisplay.Changed["InkTransform"].Add(new PropertyEventHandler(this.HandleInkTransformChanged)); this.HandleInkTransformChanged(this.m_SlideDisplay, null); }
public InkSheetAdapter(SlideDisplayModel display, IAdaptee adaptee) { this.m_SlideDisplay = display; this.m_Adaptee = adaptee; this.m_SlideChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_SlideDisplay.EventQueue, new PropertyEventHandler(this.HandleSlideChanged)); this.m_SlideDisplay.Changed["Slide"].Add(this.m_SlideChangedDispatcher.Dispatcher); this.m_SlideChangedDispatcher.Dispatcher(this.m_SlideDisplay, null); }
/// <summary> /// Construct the renderer /// </summary> /// <param name="display">The SlideDisplayModel</param> /// <param name="sheet">The QuickPollSheetModel</param> public QuickPollSheetRenderer( SlideDisplayModel display, QuickPollSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; repaint_dispatcher_ = new EventQueue.PropertyEventDispatcher(SlideDisplay.EventQueue, this.Repaint); /// Add event listeners this.m_Sheet.QuickPoll.Changed["Updated"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); this.SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); }
public EraserPlugin(SlideDisplayModel display) { this.m_Display = display; this.m_Renderer = new Renderer(); this.m_Display.Changed["Bounds"].Add(new PropertyEventHandler(this.HandleDisplayBoundsChanged)); this.m_Display.Changed["InkTransform"].Add(new PropertyEventHandler(this.HandleDisplayInkTransformChanged)); this.HandleDisplayBoundsChanged(this.m_Display, null); this.HandleDisplayInkTransformChanged(this.m_Display, null); }
public TextSheetRenderer(SlideDisplayModel display, TextSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; repaint_dispatcher_ = new EventQueue.PropertyEventDispatcher(SlideDisplay.EventQueue, this.Repaint); /// Add event listeners this.m_Sheet.Changed["Text"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); this.m_Sheet.Changed["Bounds"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); this.m_Sheet.Changed["Color"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); this.SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); }
public SlideRenderer(SlideDisplayModel display, string sheetsCollectionTag) { this.m_SlideDisplay = display; this.m_SheetsCollectionTag = sheetsCollectionTag; this.m_SheetRenderers = new SheetRenderersCollection(); this.m_SlideChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_SlideDisplay.EventQueue, new PropertyEventHandler(this.HandleSlideChanged)); this.m_SheetDispositionChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_SlideDisplay.EventQueue, new PropertyEventHandler(this.HandleSheetDispositionChanged)); this.m_SlideDisplay.Changed["Slide"].Add(this.m_SlideChangedDispatcher.Dispatcher); this.m_SlideDisplay.Changed["SheetDisposition"].Add(this.m_SheetDispositionChangedDispatcher.Dispatcher); }
public XPSPageRenderer(SlideDisplayModel display, XPSPageSheetModel sheet) : base(display,sheet) { this.m_Display = display; this.m_Sheet = sheet; this.repaint_dispatcher_ = new EventQueue.PropertyEventDispatcher(this.SlideDisplay.EventQueue, this.Repaint); if (this.m_Sheet != null) { this.m_Sheet.Changed["Bounds"].Add(new PropertyEventHandler(repaint_dispatcher_.Dispatcher)); this.SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(repaint_dispatcher_.Dispatcher)); } }
public InkSheetRenderer(SlideDisplayModel display, InkSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; this.m_Renderer = new Renderer(); this.m_Sheet.Changed["Selection"].Add(new PropertyEventHandler(this.HandleSelectionChanged)); this.m_Sheet.InkAdded += new StrokesEventHandler(this.HandleInkAdded); this.m_Sheet.InkDeleted += new StrokesEventHandler(this.HandleInkDeleted); this.SlideDisplay.Changed["InkTransform"].Add(new PropertyEventHandler(this.HandleInkTransformChanged)); this.HandleInkTransformChanged(this.SlideDisplay, null); }
/// <summary> /// Creates a new RealTimeInkSheetRenderer, which will draw ink from the specified /// <see cref="RealTimeInkSheetModel"/> on <see cref="Graphics"/> obtained /// from the specified <see cref="InkSheetRendererParent"/>. /// </summary> /// <remarks> /// By default, rendering of real-time ink is enabled. It may be disabled by setting the /// <see cref="RealTimeInkEnabled"/> property. /// <para> /// Drawing of "static" ink is always enabled, but it is only drawn when the parent /// <see cref="SlideRenderer"/> is invalidated. It is <em>not</em> drawn when new ink /// is added to the <see cref="InkSheetModel"/>, for it is assumed that a "third-party" /// <see cref="TransformableDynamicRenderer"/> or other renderer is doing the job. /// </para> /// </remarks> public RealTimeInkSheetRenderer(SlideDisplayModel display, RealTimeInkSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; // FIXME: When the SlideViewer that created the SlideDisplayModel is invalidated, invoke TransformableDynamicRenderer.Refresh(). this.m_Renderer = new TransformableDynamicRenderer.Core.RealTimeInkAdapter(display, sheet); if((this.m_Sheet.Disposition & SheetDisposition.Remote) == 0) { this.SlideDisplay.Changed["RenderLocalRealTimeInk"].Add(new PropertyEventHandler(this.HandleRenderRealTimeInkChanged)); this.HandleRenderRealTimeInkChanged(this.SlideDisplay, null); } else { this.RenderRealTimeInk = true; } }
public static SheetRenderer ForStaticSheet( SlideDisplayModel display, SheetModel sheet ) { // TODO: Make this pluggable by dynamically loading available renderers, mapped by the types they support. if(sheet is InkSheetModel) { return new InkSheetRenderer(display, (InkSheetModel) sheet); } else if(sheet is ImageSheetModel) { return new ImageSheetRenderer(display, (ImageSheetModel) sheet); } else if(sheet is TextSheetModel) { return new TextSheetRenderer(display, (TextSheetModel) sheet); } else if( sheet is QuickPollSheetModel ) { return new QuickPollSheetRenderer( display, (QuickPollSheetModel)sheet ); } else { return null; } }
public LassoPlugin(Control control, SlideDisplayModel display) { this.m_EventQueue = display.EventQueue; this.m_Control = control; this.m_Display = display; this.m_SelectionPointsTable = new Hashtable(); this.m_SelectionBoundaryTable = new Hashtable(); this.m_SelectionPreviousPointTable = new Hashtable(); this.m_Renderer = new Renderer(); this.m_Control.Paint += new PaintEventHandler(this.HandleControlPaint); this.m_DisplayBoundsChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleDisplayBoundsChanged)); this.m_DisplayInkTransformChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleDisplayInkTransformChanged)); this.m_Display.Changed["Bounds"].Add(this.m_DisplayBoundsChangedDispatcher.Dispatcher); this.m_Display.Changed["InkTransform"].Add(this.m_DisplayInkTransformChangedDispatcher.Dispatcher); this.m_DisplayBoundsChangedDispatcher.Dispatcher(this.m_Display, null); this.m_DisplayInkTransformChangedDispatcher.Dispatcher(this.m_Display, null); }
public SlideViewer() { if (this.m_EventQueue == null) { this.m_EventQueue = new ControlEventQueue(this); } if (this.m_SlideDisplay == null) { this.m_SlideDisplay = new SlideDisplayModel(this, this.m_EventQueue); } this.m_DefaultDeckBGColor = Color.White; // Enable double-buffering of the SlideView. this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); this.m_ContentSlideRenderer = new SlideRenderer(this.m_SlideDisplay, "ContentSheets"); this.m_AnnotationsSlideRenderer = new SlideRenderer(this.m_SlideDisplay, "AnnotationSheets"); this.m_SlideDisplay.Invalidated += new InvalidateEventHandler(this.HandleDisplayInvalidated); this.Name = "SlideViewer"; }
public PresentItBox(SheetModel sheet, MainSlideViewer viewer) { InitializeComponent(); slide_display_ = viewer.SlideDisplay; slide_ = viewer.Slide; viewer_ = viewer; sheet_ = sheet; ///add event listeners ///we need to change how we transform our textbox every time the slidedisplay transform changes. pixel_transform_listener_ = new EventQueue.PropertyEventDispatcher(slide_display_.EventQueue, new PropertyEventHandler(this.HandleTransformChanged)); ///add the dispatcher, not the actual method we want to execute slide_display_.Changed["PixelTransform"].Add(pixel_transform_listener_.Dispatcher); ///set the location and size of our controls relative to the slide by ///using the sheet information. using (Synchronizer.Lock(sheet_.SyncRoot)) { slide_coordinates_ = new Point(sheet.Bounds.Location.X, sheet.Bounds.Location.Y); slide_size_ = sheet.Bounds.Size; } }
public ImageSheetRenderer(SlideDisplayModel display, ImageSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; repaint_dispatcher_ = new EventQueue.PropertyEventDispatcher(this.SlideDisplay.EventQueue, this.Repaint); if (m_Sheet.Image == null) { // we are looking at a background image if (this.m_Sheet.Deck != null) { this.m_Sheet.Deck.SlideContentAdded += new PropertyEventHandler(repaint_dispatcher_.Dispatcher); } else { //FIXME: This happened a couple of times. Ignoring it is not the best fix. Trace.WriteLine("Warning: ImageSheetModel.Deck was found to be null when creating ImageSheetRenderer."); } } else { //we're looking at an ImageIt image this.m_Sheet.Changed["Bounds"].Add(new PropertyEventHandler(repaint_dispatcher_.Dispatcher)); this.m_Sheet.Changed["Image"].Add(new PropertyEventHandler(repaint_dispatcher_.Dispatcher)); this.SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(repaint_dispatcher_.Dispatcher)); } }
/// <summary> /// Constructs a new <see cref="Core"/> instance, which will /// render ink to the graphics device returned by the <see cref="SlideDisplayModel"/>. /// </summary> /// <remarks> /// Furthermore, the ink will be transformed using the /// <see cref="SlideDisplayModel.InkTransform"/> /// and clipped by <see cref="SlideDisplayModel.Bounds"/>. /// </remarks> public Core(SlideDisplayModel display) { this.m_SlideDisplay = display; this.m_Renderer = new Renderer(); this.m_Ink = new Ink(); this.m_DrawingAttributes = new DrawingAttributes(); this.m_PacketsTable = new Dictionary<int,int[]>(); this.m_DrawingAttributesTable = new Dictionary<int,DrawingAttributes>(); this.m_TabletPropertiesTable = new Dictionary<int,TabletPropertyDescriptionCollection>(); this.m_CollectedPacketsTable = new Dictionary<int, List<int>>(); this.m_CurrentStrokeIdTable = new Dictionary<int, int>(); this.m_SlideDisplay.Changed["InkTransform"].Add(new PropertyEventHandler(this.HandleInkTransformChanged)); this.HandleInkTransformChanged(display, null); }
private void DrawSlide2( DeckTraversalModel traversal, int index, System.Drawing.Rectangle displayBounds, System.Drawing.Graphics g ) { float width_scale = g.DpiX / 100f; float height_scale = g.DpiY / 100f; Rectangle bounds = new Rectangle( 0, 0, (int)(displayBounds.Width * 3f), (int)(displayBounds.Height * 3f) ); // Create an image using temporary graphics and graphics buffer object Bitmap imageForPrinting = new Bitmap( bounds.Width, bounds.Height ); using( Graphics graphicsImage = Graphics.FromImage( imageForPrinting ) ) { using( DibGraphicsBuffer dib = new DibGraphicsBuffer() ) { // Create temporary screen Graphics System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); // Create temporary Graphics from the Device Independent Bitmap using( Graphics graphicsTemp = dib.RequestBuffer( screenGraphics, imageForPrinting.Width, imageForPrinting.Height ) ) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using( Synchronizer.Lock( traversal.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.TableOfContents.SyncRoot ) ) { TableOfContentsModel.Entry entry = traversal.Deck.TableOfContents.Entries[index]; using( Synchronizer.Lock( entry.Slide.SyncRoot ) ) { //Draw the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. if( entry.Slide.BackgroundColor != Color.Empty ) { graphicsTemp.Clear( entry.Slide.BackgroundColor ); } else if( traversal.Deck.DeckBackgroundColor != Color.Empty ) { graphicsTemp.Clear( traversal.Deck.DeckBackgroundColor ); } else { graphicsTemp.Clear( Color.Transparent ); } //Get the Slide content and draw it oldState = graphicsTemp.Save(); Model.Presentation.SlideModel.SheetCollection sheets = entry.Slide.ContentSheets; for( int i = 0; i < sheets.Count; i++ ) { SlideDisplayModel display = new SlideDisplayModel( graphicsTemp, null ); Rectangle rect = new Rectangle( 0, 0, bounds.Width, bounds.Height ); Rectangle slide = new Rectangle( rect.X, rect.Y, rect.Width, rect.Height ); float zoom = 1f; if( entry.Slide != null ) { slide = entry.Slide.Bounds; zoom = entry.Slide.Zoom; } System.Drawing.Drawing2D.Matrix pixel, ink; display.FitSlideToBounds( System.Windows.Forms.DockStyle.Fill, rect, zoom, ref slide, out pixel, out ink ); using( Synchronizer.Lock( display.SyncRoot ) ) { display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet( display, sheets[i] ); r.Paint( new System.Windows.Forms.PaintEventArgs( graphicsTemp, bounds ) ); r.Dispose(); } } } } } //Restore the Old State graphicsTemp.Restore( oldState ); // Use the buffer to paint onto the final image dib.PaintBuffer( graphicsImage, 0, 0 ); // Draw this image onto the printer graphics, // adjusting for printer margins g.DrawImage( imageForPrinting, displayBounds ); //Cleanup graphicsTemp.Dispose(); screenGraphics.Dispose(); tempForm.Dispose(); dib.Dispose(); graphicsImage.Dispose(); imageForPrinting.Dispose(); } } } }
// TODO: Correctly Draw the Slide Annotation private void DrawSlide( DeckTraversalModel traversal, int index, System.Drawing.Rectangle rect, System.Drawing.Graphics buffer ) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using( Synchronizer.Lock( traversal.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.TableOfContents.SyncRoot ) ) { TableOfContentsModel.Entry entry = traversal.Deck.TableOfContents.Entries[index]; using( Synchronizer.Lock( entry.Slide.SyncRoot ) ) { //Draw the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. if( entry.Slide.BackgroundColor != Color.Empty ) { buffer.FillRectangle( new System.Drawing.SolidBrush( entry.Slide.BackgroundColor ), rect ); } else if( traversal.Deck.DeckBackgroundColor != Color.Empty ) { buffer.FillRectangle( new System.Drawing.SolidBrush( traversal.Deck.DeckBackgroundColor ), rect ); } else { buffer.FillRectangle( new System.Drawing.SolidBrush( Color.Transparent ), rect ); } //Get the Slide content and draw it oldState = buffer.Save(); Model.Presentation.SlideModel.SheetCollection sheets = entry.Slide.ContentSheets; for( int i = 0; i < sheets.Count; i++ ) { SlideDisplayModel display = new SlideDisplayModel( buffer, null ); Rectangle slide = rect; float zoom = 1f; if( entry.Slide != null ) { slide = entry.Slide.Bounds; zoom = entry.Slide.Zoom; } System.Drawing.Drawing2D.Matrix pixel, ink; display.FitSlideToBounds(System.Windows.Forms.DockStyle.Fill, rect, zoom, ref slide, out pixel, out ink); using(Synchronizer.Lock(display.SyncRoot)) { display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet( display, sheets[i] ); r.Paint( new System.Windows.Forms.PaintEventArgs(buffer, rect) ); r.Dispose(); } //Restore the Old State buffer.Restore( oldState ); oldState = buffer.Save(); //Get the Annotation content and draw it sheets = entry.Slide.AnnotationSheets; for( int i = 0; i < sheets.Count; i++ ) { SlideDisplayModel display = new SlideDisplayModel( buffer, null ); Rectangle slide = rect; float zoom = 1f; if( entry.Slide != null ) { slide = entry.Slide.Bounds; zoom = entry.Slide.Zoom; } System.Drawing.Drawing2D.Matrix pixel, ink; display.FitSlideToBounds(System.Windows.Forms.DockStyle.Fill, rect, zoom, ref slide, out pixel, out ink); using(Synchronizer.Lock(display.SyncRoot)) { display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet( display, sheets[i] ); if( r is Viewer.Slides.InkSheetRenderer ) { ((Viewer.Slides.InkSheetRenderer)r).Paint( buffer, rect ); } else r.Paint( new System.Windows.Forms.PaintEventArgs(buffer, rect) ); r.Dispose(); } //Restore the Old State buffer.Restore( oldState ); /* Microsoft.Ink.Renderer renderer = new Microsoft.Ink.Renderer(); for( int i = 0; i < sheets.Count; i++ ) { SheetModel sm = sheets[i]; if( sm is InkSheetModel ) { InkSheetModel ism = sm as InkSheetModel; using( Synchronizer.Lock( ism.SyncRoot ) ) { foreach( Microsoft.Ink.Stroke stroke in ism.Ink.Strokes ) { renderer.Draw( buffer, stroke ); } } } else if( sm is TextSheetModel ) { TextSheetModel tsm = sm as TextSheetModel; using( Synchronizer.Lock( tsm.SyncRoot ) ) { buffer.DrawString( tsm.Text, tsm.Font, new SolidBrush( tsm.Color ), tsm.Bounds ); } } else if( sm is ImageSheetModel ) { //add any images in the AnnotationSheets ImageSheetModel image_sheet_model = (ImageSheetModel)sm; using( Synchronizer.Lock( image_sheet_model.SyncRoot ) ) { buffer.DrawImage( image_sheet_model.Image, image_sheet_model.Bounds ); } } else { //Unknown, skip it continue; } } */ } } } } }
/// <summary> /// Constructs a new <see cref="TransformableDynamicRenderer"/> instance, which will /// render ink to the graphics device returned by the <see cref="SlideDisplayModel"/>. /// </summary> /// <remarks> /// Furthermore, the ink will be transformed using the /// <see cref="SlideDisplayModel.InkTransform"/> /// and clipped by <see cref="SlideDisplayModel.Bounds"/>. /// </remarks> public TransformableDynamicRenderer(SlideDisplayModel display) { this.m_Core = new Core(display); }
/// <summary> /// Creates a new instance of <see cref="TransformableDynamicRendererLinkedToDisplay"/>, which /// listens to the <see cref="Control.Paint"/> event and <see cref="SlideDisplayModel.Slide"/> property. /// </summary> public TransformableDynamicRendererLinkedToDisplay(Control control, SlideDisplayModel display) : base(display) { this.m_Control = control; this.m_SlideDisplay = display; this.m_SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(this.HandleSlideChanged)); this.m_Control.Paint += new PaintEventHandler(this.HandleViewerPaint); this.HandleSlideChanged(this.m_SlideDisplay, null); }
protected SheetRenderer(SlideDisplayModel display, SheetModel sheet) { this.m_SlideDisplay = display; this.m_Sheet = sheet; }
/// <summary> /// Constructs a new <see cref="RealTimeInkAdapater"/> instance, which will render ink /// generated received from the <see cref="RealTimeInkSheetModel"/> onto the graphics device /// specified by the <see cref="SlideDisplayModel"/> /// </summary> public RealTimeInkAdapter(SlideDisplayModel display, RealTimeInkSheetModel rti) : base(display) { this.m_RTI = rti; this.m_CurrentDrawingAttributesChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_SlideDisplay.EventQueue, new PropertyEventHandler(this.HandleCurrentDrawingAttributesChanged)); this.m_RTI.Changed["CurrentDrawingAttributes"].Add(this.m_CurrentDrawingAttributesChangedDispatcher.Dispatcher); this.m_RTI.StylusDown += new RealTimeInkSheetModel.StylusDownEventHandler(this.HandleStylusDown); this.m_RTI.StylusUp += new RealTimeInkSheetModel.StylusUpEventHandler(this.HandleStylusUp); this.m_RTI.Packets += new RealTimeInkSheetModel.PacketsEventHandler(this.HandlePackets); this.m_CurrentDrawingAttributesChangedDispatcher.Dispatcher(this.m_RTI, null); }