public SheetMessage(Message parent, SerializedPacket p) : base(parent, p) { this.SheetCollectionSelector = (SheetCollection)SerializedPacket.DeserializeLong(p.GetNextPart()); this.Disposition = (SheetDisposition)SerializedPacket.DeserializeLong(p.GetNextPart()); this.Bounds = SerializedPacket.DeserializeRectangle(p.GetNextPart()); this.Height = SerializedPacket.DeserializeInt(p.GetNextPart()); }
public XPSPageSheetModel(XPSDocumentPageWrapper pageWrapper, Guid id, SheetDisposition disposition, Rectangle bounds, int height) : base(id, disposition, bounds, false, height) { this.m_DocumentPage = null; this.m_DocumentPageWrapper = pageWrapper; this.m_Width = bounds.Width; }
public ImageSheetModel(DeckModel deck, Guid id, SheetDisposition disp, Rectangle bounds, ByteArray md5, int height) : base(id, disp, bounds, false, height) { this.m_MD5 = md5; this.m_Deck = deck; this.visible_ = true; }
public SheetModel(Guid id, SheetDisposition disp, Rectangle rect, int height) { this.m_Id = id; this.m_Bounds = rect; this.m_Disposition = disp; this.m_Height = height; }
public SheetMessage( Message parent, SerializedPacket p ) : base(parent, p) { this.SheetCollectionSelector = (SheetCollection)SerializedPacket.DeserializeLong( p.GetNextPart() ); this.Disposition = (SheetDisposition)SerializedPacket.DeserializeLong( p.GetNextPart() ); this.Bounds = SerializedPacket.DeserializeRectangle( p.GetNextPart() ); this.Height = SerializedPacket.DeserializeInt( p.GetNextPart() ); }
/// <summary> /// Removes the remote component of the sheet dispositions /// </summary> public void RemoveRemoteDisposition() { foreach (SheetModel s in this.AnnotationSheets) { SheetDisposition d = s.Disposition & ~SheetDisposition.Remote; s.Disposition = d; } }
/// <summary> /// Constructs a TextSheetModel from a message /// </summary> /// <param name="id"></param> /// <param name="text"></param> /// <param name="editable"></param> /// <param name="is_public"></param> /// <param name="bounds"></param> /// <param name="color"></param> public TextSheetModel(Guid id, string text, SheetDisposition disp, bool editable, bool is_public, Rectangle bounds, Color color, Font font) : base(id, disp, bounds, editable, 0) { text_ = text; is_editable_ = editable; font_ = font; color_ = color; public_ = is_public; }
public SheetMessage(SheetModel sheet, SheetCollection collection) : base(sheet.Id) { this.AddLocalRef(sheet); this.Disposition = sheet.Disposition; this.SheetCollectionSelector = collection; using (Synchronizer.Lock(sheet.SyncRoot)) { this.Bounds = sheet.Bounds; } this.Height = sheet.Height; }
public SheetMessage(SheetModel sheet, SheetCollection collection) : base(sheet.Id) { this.AddLocalRef( sheet ); this.Disposition = sheet.Disposition; this.SheetCollectionSelector = collection; using(Synchronizer.Lock(sheet.SyncRoot)) { this.Bounds = sheet.Bounds; } this.Height = sheet.Height; }
/// <summary> /// Constructs a default textsheetmodel which has been scaled to fit the current transform /// </summary> /// <param name="id"></param> /// <param name="text"></param> /// <param name="editable"></param> /// <param name="is_public"></param> /// <param name="c"></param> /// <param name="untransformed_bounds"></param> /// <param name="scale_x"></param> /// <param name="scale_y"></param> public TextSheetModel(Guid id, string text, SheetDisposition disp, bool editable, bool is_public, Color c, Rectangle untransformed_bounds, float i_scale_x, float i_scale_y) : base(Guid.NewGuid(), editable, 0) { Rectangle new_bounds = new Rectangle((int)(untransformed_bounds.X * i_scale_x),(int)( untransformed_bounds.Y * i_scale_y), (int)(untransformed_bounds.Width * i_scale_x), (int)(untransformed_bounds.Height * i_scale_y)); using (Synchronizer.Lock(this.SyncRoot)) { this.Bounds = new_bounds; } text_ = text; public_ = is_public; color_ = c; font_ = new Font(TextStylusModel.GetInstance().DefaultFont.Name, (int)(TextStylusModel.GetInstance().DefaultFont.Size)); }
/// <summary> /// Constructs a default textsheetmodel which has been scaled to fit the current transform /// </summary> /// <param name="id"></param> /// <param name="text"></param> /// <param name="editable"></param> /// <param name="is_public"></param> /// <param name="c"></param> /// <param name="untransformed_bounds"></param> /// <param name="scale_x"></param> /// <param name="scale_y"></param> public TextSheetModel(Guid id, string text, SheetDisposition disp, bool editable, bool is_public, Color c, Rectangle untransformed_bounds, float i_scale_x, float i_scale_y) : base(Guid.NewGuid(), editable, 0) { Rectangle new_bounds = new Rectangle((int)(untransformed_bounds.X * i_scale_x), (int)(untransformed_bounds.Y * i_scale_y), (int)(untransformed_bounds.Width * i_scale_x), (int)(untransformed_bounds.Height * i_scale_y)); using (Synchronizer.Lock(this.SyncRoot)) { this.Bounds = new_bounds; } text_ = text; public_ = is_public; color_ = c; font_ = new Font(TextStylusModel.GetInstance().DefaultFont.Name, (int)(TextStylusModel.GetInstance().DefaultFont.Size)); }
/// <summary> /// Instantiates a new <see cref="SlideDisplayModel"/>. /// </summary> /// <param name="control"> /// The control that will be used for <see cref="CreateGraphics"/>; presumably, the <see cref="SlideViewer"/> /// on which the slide will be rendered. /// </param> public SlideDisplayModel(Graphics g, ControlEventQueue dispatcher) { this.m_Control = null; this.m_Graphics = g; this.m_EventQueue = dispatcher; this.m_Renderer = new Renderer(); // Initialize transform matrices to the identity matrix. this.m_PixelTransform = new Matrix(); this.m_InkTransform = new Matrix(); // Initialize the bounds to an empty rectangle to avoid NullReferenceExceptions. this.m_Bounds = Rectangle.Empty; // Default is to render real time ink. this.m_RenderLocalRealTimeInk = true; //Initialize Disposition to Instructor and display BG as default this.m_SheetDisposition = SheetDisposition.All | SheetDisposition.Background; }
// NOTE: Eventually this code should be converted to use SlideRenderer instead of each SheetRenderer. There were some issues with doing // this initially so for the time being we will keep it like this. public static Bitmap DrawSlide(TableOfContentsModel.Entry currentEntry, System.Drawing.Color background, SheetDisposition dispositions) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using (Synchronizer.Lock(currentEntry.Slide.SyncRoot)) { Rectangle rect = new Rectangle(0, 0, currentEntry.Slide.Bounds.Width, currentEntry.Slide.Bounds.Height); //Note: Uses DibGraphicsBuffer from TPC SDK to do antialiasing //See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dntablet/html/tbconprintingink.asp /// create the bitmap we're exporting to Bitmap toExport = new Bitmap(rect.Width, rect.Height); /// create what we will be drawing on to the export Graphics toSave = Graphics.FromImage(toExport); /// draw the slide data on a temporary graphics object in a temporary form System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); DibGraphicsBuffer dib = new DibGraphicsBuffer(); Graphics tempGraphics = dib.RequestBuffer(screenGraphics, rect.Width, rect.Height); //Add the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. tempGraphics.Clear(background); //Get the Slide content and draw it oldState = tempGraphics.Save(); Model.Presentation.SlideModel.SheetCollection sheets = currentEntry.Slide.ContentSheets; for (int i = 0; i < sheets.Count; i++) { Model.Viewer.SlideDisplayModel display = new Model.Viewer.SlideDisplayModel(tempGraphics, null); Rectangle slide = rect; float zoom = 1f; if (currentEntry.Slide != null) { slide = currentEntry.Slide.Bounds; zoom = currentEntry.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.SheetDisposition = dispositions; display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet(display, sheets[i]); if ((r.Sheet.Disposition & dispositions) != 0) { r.Paint(new System.Windows.Forms.PaintEventArgs(tempGraphics, rect)); } r.Dispose(); } //Restore the Old State tempGraphics.Restore(oldState); oldState = tempGraphics.Save(); //Get the Annotation content and draw it sheets = currentEntry.Slide.AnnotationSheets; for (int i = 0; i < sheets.Count; i++) { Model.Viewer.SlideDisplayModel display = new Model.Viewer.SlideDisplayModel(tempGraphics, null); Rectangle slide = rect; float zoom = 1f; if (currentEntry.Slide != null) { slide = currentEntry.Slide.Bounds; zoom = currentEntry.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.SheetDisposition = dispositions; display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet(display, sheets[i]); if ((r.Sheet.Disposition & dispositions) != 0) { r.Paint(new System.Windows.Forms.PaintEventArgs(tempGraphics, rect)); } r.Dispose(); } //Restore the Old State tempGraphics.Restore(oldState); //Export the image //Merge the graphics dib.PaintBuffer(toSave, 0, 0); //Dispose all the graphics toSave.Dispose(); screenGraphics.Dispose(); tempGraphics.Dispose(); return(toExport); } }
public RealTimeInkSheetModel( Guid id, SheetDisposition disposition, Rectangle bounds, Ink ink ) : base(id, disposition, bounds, ink) { }
public ImageSheetModel(Guid id, Image image, SheetDisposition disp, bool is_editable, Point p, Size s, int height) : base(id, disp, new Rectangle(p, s), is_editable, height) { image_ = image; }
public RealTimeInkSheetModel(Guid id, SheetDisposition disposition, Rectangle bounds, Ink ink) : base(id, disposition, bounds, ink) { }
public EditableSheetModel(Guid id, SheetDisposition disposition, Rectangle bounds, bool editable, int height) : base(id, disposition, bounds, height) { is_editable_ = editable; }
public InkSheetModel(Guid id, SheetDisposition disposition, Rectangle bounds, Ink ink) : base(id, disposition, bounds, 0) { this.m_SerializableInk = new SerializableInk(ink); }
/// <summary> /// Instantiates a new <see cref="SlideDisplayModel"/>. /// </summary> /// <param name="control"> /// The control that will be used for <see cref="CreateGraphics"/>; presumably, the <see cref="SlideViewer"/> /// on which the slide will be rendered. /// </param> public SlideDisplayModel( Graphics g, ControlEventQueue dispatcher ) { this.m_Control = null; this.m_Graphics = g; this.m_EventQueue = dispatcher; this.m_Renderer = new Renderer(); // Initialize transform matrices to the identity matrix. this.m_PixelTransform = new Matrix(); this.m_InkTransform = new Matrix(); // Initialize the bounds to an empty rectangle to avoid NullReferenceExceptions. this.m_Bounds = Rectangle.Empty; // Default is to render real time ink. this.m_RenderLocalRealTimeInk = true; //Initialize Disposition to Instructor and display BG as default this.m_SheetDisposition = SheetDisposition.All | SheetDisposition.Background; }
/// <summary> /// constructs a default textsheet at the origin, which is by default editable /// </summary> /// <param name="id"></param> /// <param name="bounds"></param> public TextSheetModel(Guid id, SheetDisposition disp, Color color) : this(id, null, disp, true, true, new Rectangle(), color, TextStylusModel.GetInstance().DefaultFont) { }
public SheetModel(Guid id, SheetDisposition disp, int height) : this(id, disp, Rectangle.Empty, height) { }
// NOTE: Eventually this code should be converted to use SlideRenderer instead of each SheetRenderer. There were some issues with doing // this initially so for the time being we will keep it like this. public static Bitmap DrawSlide(TableOfContentsModel.Entry currentEntry, BackgroundTemplate template, System.Drawing.Color background, SheetDisposition dispositions, int width, int height, float scale ) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using (Synchronizer.Lock(currentEntry.Slide.SyncRoot)) { Rectangle rect; int boundsWidth = currentEntry.Slide.Bounds.Width; int boundsHeight = currentEntry.Slide.Bounds.Height; int exportWidth = width; int exportHeight = height; if (width > 0 && height > 0) { // Do Nothing } else if (width > 0) { exportHeight = (int)Math.Round( ( (float)width / (float)boundsWidth ) * (float)boundsHeight ); } else if (height > 0) { exportWidth = (int)Math.Round( ( (float)height / (float)boundsHeight ) * (float)boundsWidth ); } else { exportWidth = boundsWidth; exportHeight = boundsHeight; } // Scale the size exportWidth = (int)Math.Round( exportWidth * scale ); exportHeight = (int)Math.Round( exportHeight * scale ); rect = new Rectangle(0, 0, exportWidth, exportHeight); //Note: Uses DibGraphicsBuffer from TPC SDK to do antialiasing //See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dntablet/html/tbconprintingink.asp /// create the bitmap we're exporting to Bitmap toExport = new Bitmap(rect.Width, rect.Height); /// create what we will be drawing on to the export Graphics toSave = Graphics.FromImage(toExport); /// draw the slide data on a temporary graphics object in a temporary form System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); DibGraphicsBuffer dib = new DibGraphicsBuffer(); Graphics tempGraphics = dib.RequestBuffer(screenGraphics, rect.Width, rect.Height); //Add the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. tempGraphics.Clear(background); //Add the background template if (template != null) { using (BackgroundTemplateRenderer bkgRender = new BackgroundTemplateRenderer(template)) { bkgRender.DrawAll(tempGraphics, rect); } } //Get the Slide content and draw it oldState = tempGraphics.Save(); Model.Presentation.SlideModel.SheetCollection sheets = currentEntry.Slide.ContentSheets; for (int i = 0; i < sheets.Count; i++) { Model.Viewer.SlideDisplayModel display = new Model.Viewer.SlideDisplayModel(tempGraphics, null); Rectangle slide = rect; float zoom = 1f; if (currentEntry.Slide != null) { slide = currentEntry.Slide.Bounds; zoom = currentEntry.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.SheetDisposition = dispositions; display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet(display, sheets[i]); if ((r.Sheet.Disposition & dispositions) != 0) r.Paint(new System.Windows.Forms.PaintEventArgs(tempGraphics, rect)); r.Dispose(); } //Restore the Old State tempGraphics.Restore(oldState); oldState = tempGraphics.Save(); //Get the Annotation content and draw it sheets = currentEntry.Slide.AnnotationSheets; for (int i = 0; i < sheets.Count; i++) { Model.Viewer.SlideDisplayModel display = new Model.Viewer.SlideDisplayModel(tempGraphics, null); Rectangle slide = rect; float zoom = 1f; if (currentEntry.Slide != null) { slide = currentEntry.Slide.Bounds; zoom = currentEntry.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.SheetDisposition = dispositions; display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet(display, sheets[i]); if ((r.Sheet.Disposition & dispositions) != 0) r.Paint(new System.Windows.Forms.PaintEventArgs(tempGraphics, rect)); r.Dispose(); } //Restore the Old State tempGraphics.Restore(oldState); //Export the image //Merge the graphics dib.PaintBuffer(toSave, 0, 0); //Dispose all the graphics toSave.Dispose(); screenGraphics.Dispose(); tempGraphics.Dispose(); return toExport; } }
public InkSheetModel( Guid id, SheetDisposition disposition, Rectangle bounds, Ink ink ) : base(id, disposition, bounds, 0) { this.m_SerializableInk = new SerializableInk( ink ); }
// NOTE: Eventually this code should be converted to use SlideRenderer instead of each SheetRenderer. There were some issues with doing // this initially so for the time being we will keep it like this. public static Bitmap DrawSlide(TableOfContentsModel.Entry currentEntry, BackgroundTemplate template, System.Drawing.Color background, SheetDisposition dispositions) { return PPTDeckIO.DrawSlide(currentEntry, template, background, dispositions, 0, 0, 1.0f); }
/// <summary> /// constructs a default textsheet at the origin, which is by default editable /// </summary> /// <param name="id"></param> /// <param name="bounds"></param> public TextSheetModel(Guid id, SheetDisposition disp, Color color) : this(id, null, disp, true,true, new Rectangle(), color, TextStylusModel.GetInstance().DefaultFont) { }