public override Color GetColor( IList <PdfDirectObject> components, IContentContext context ) { //TODO /* * Pattern pattern = context.Resources.Patterns[components[components.Count-1]]; * if(pattern is TilingPattern) * { * TilingPattern tilingPattern = (TilingPattern)pattern; * if(tilingPattern.PaintType == PaintTypeEnum.Uncolored) * { * ColorSpace underlyingColorSpace = UnderlyingColorSpace; * if(underlyingColorSpace == null) * throw new IllegalArgumentException("Uncolored tiling patterns not supported by this color space because no underlying color space has been defined."); * * // Get the color to be used for colorizing the uncolored tiling pattern! * Color color = underlyingColorSpace.GetColor(components, context); * // Colorize the uncolored tiling pattern! * pattern = tilingPattern.Colorize(color); * } * } * return pattern; */ return(null); }
private string GetFilterColumnHtml(IContentContext contentContext) { var builder = new StringBuilder(); var fieldInfoList = FieldRepository.GetFieldInfoList(contentContext.SiteId); foreach (var fieldInfo in fieldInfoList) { fieldInfo.TagInfoList = TagRepository.GetTagInfoList(fieldInfo.Id, 0); if (fieldInfo.TagInfoList == null || fieldInfo.TagInfoList.Count == 0) { continue; } fieldInfo.CheckedTagIds = ValueRepository.GetTagIdList(contentContext.SiteId, contentContext.ChannelId, contentContext.ContentId, fieldInfo.Id); if (fieldInfo.CheckedTagIds == null || fieldInfo.CheckedTagIds.Count == 0) { continue; } var tagInfoList = fieldInfo.TagInfoList.FindAll(x => fieldInfo.CheckedTagIds.Contains(x.Id)); if (tagInfoList.Count == 0) { continue; } foreach (var tagInfo in tagInfoList) { builder.Append($@"<span class=""badge badge-light"">{tagInfo.Title}</span>"); } } return(builder.ToString()); }
public override Color GetColor( IList <PdfDirectObject> components, IContentContext context ) { return(new SeparationColor(components)); }
public ColorSpace GetResource(IContentContext context) { /* * NOTE: The names DeviceGray, DeviceRGB, DeviceCMYK, and Pattern always identify * the corresponding color spaces directly; they never refer to resources in the * ColorSpace subdictionary [PDF:1.6:4.5.7]. */ PdfName name = Name; if (name.Equals(PdfName.DeviceGray)) { return(DeviceGrayColorSpace.Default); } else if (name.Equals(PdfName.DeviceRGB)) { return(DeviceRGBColorSpace.Default); } else if (name.Equals(PdfName.DeviceCMYK)) { return(DeviceCMYKColorSpace.Default); } else if (name.Equals(PdfName.Pattern)) { return(PatternColorSpace.Default); } else { return(context.Resources.ColorSpaces[name]); } }
public override Color GetColor(IList <PdfDirectObject> components, IContentContext context) { //TODO Pattern pattern = context.Resources.Patterns[(PdfName)components[components.Count - 1]]; if (pattern is TilingPattern) { TilingPattern tilingPattern = (TilingPattern)pattern; if (tilingPattern.PaintType == TilingPattern.PaintTypeEnum.Uncolored) { ColorSpace underlyingColorSpace = UnderlyingColorSpace; if (underlyingColorSpace == null) { throw new ArgumentException("Uncolored tiling patterns not supported by this color space because no underlying color space has been defined."); } // Get the color to be used for colorizing the uncolored tiling pattern! Color color = underlyingColorSpace.GetColor(components, context); // Colorize the uncolored tiling pattern! pattern = tilingPattern.Colorize(color); } } return(pattern); }
public static Contents Wrap( PdfDirectObject baseObject, IContentContext contentContext ) { return(baseObject != null ? new Contents(baseObject, contentContext) : null); }
public override Color GetColor( IList <PdfDirectObject> components, IContentContext context ) { return(new DeviceGrayColor(components)); }
public override Color GetColor( IList <PdfDirectObject> components, IContentContext context ) { return(new DeviceRGBColor(components)); // FIXME:temporary hack... }
/** * <summary>Renders the specified content context into an image context.</summary> * <param name="contentContext">Source content context.</param> * <param name="size">Image size expressed in device-space units (that is typically pixels).</param> * <returns>Image representing the rendered contents.</returns> */ public Image Render( IContentContext contentContext, SizeF size ) { return(Render(contentContext, size, null)); }
/** * <summary>Gets the private information meaningful to the program (application or plugin extension) * creating the marked content.</summary> * <param name="context">Content context.</param> */ public PropertyList GetProperties(IContentContext context) { object properties = Properties; return(properties is PdfName ? context.Resources.PropertyLists[(PdfName)properties] : (PropertyList)properties); }
private Contents( PdfDirectObject baseObject, IContentContext contentContext ) : base(baseObject) { this.contentContext = contentContext; Load(); }
public NavigationController(IContentContext context, ISitecoreContext scContext, IPropertyBuilder builder, INavigationRepository navigationRepository) { _context = context; _scContext = scContext; _builder = builder; _navigationRepository = navigationRepository; (_navigationRepository as NavigationRepository).Initialize(RenderingContext.Current.ContextItem); }
public override async Task <T> Find <T>(IContentContext context) { if (Key is T) { return(Key as T); } return(await base.Find <T>(context)); }
public virtual async Task <T> Find <T>(IContentContext context) where T : class { if (this is T) { return(this as T); } return(null); }
internal Contents( PdfDirectObject baseObject, PdfIndirectObject container, IContentContext contentContext ) : base(baseObject, container) { this.contentContext = contentContext; Load(); }
static public async Task <AES256WithKey> Encrypt(IContentContext context, IBinaryContent keyData, Content content) { var result = new AES256WithKey() { Key = keyData }; await result.Create(await keyData.GetBinContent(context), content.Serialize()); return(result); }
public override async Task <T> Find <T>(IContentContext context) { var a = await base.Find <T>(context); if (a == null) { return(await content.Find <T>(context)); } return(a); }
public async Task <Content> GetContent(IContentContext context) { var data = await Decrypt(context); if (data == null) { return(null); } return(Deserialize(data)); }
/// <summary> /// Returns a <see cref="ContentView"/> for a given <see cref="IContentContext"/>. /// </summary> /// <param name="contentContext">The context to get the <see cref="ContentView"/> for.</param> public ContentView GetContent(IContentContext contentContext) { var dataSource = CreateDataSource(); //get content for this location var content = dataSource.GetAllContentForLocation(contentContext.Location); //create an immutable content collection for use by the view var collection = new ContentView(content, contentContext, dataSource); return collection; }
/// <summary> /// Returns a <see cref="ContentView"/> for a given <see cref="IContentContext"/>. /// </summary> /// <param name="contentContext">The context to get the <see cref="ContentView"/> for.</param> public ContentView GetContent(IContentContext contentContext) { var dataSource = CreateDataSource(); //get content for this location var content = dataSource.GetAllContentForLocation(contentContext.Location); //create an immutable content collection for use by the view var collection = new ContentView(content, contentContext, dataSource); return(collection); }
/** * <summary>Gets the initial current transformation matrix.</summary> */ public Matrix GetInitialCtm( ) { Matrix initialCtm; if (Scanner.RenderContext == null) // Device-independent. { initialCtm = new Matrix(); // Identity. } else // Device-dependent. { IContentContext contentContext = Scanner.ContentContext; SizeF canvasSize = Scanner.CanvasSize; // Axes orientation. RotationEnum rotation = contentContext.Rotation; switch (rotation) { case RotationEnum.Downward: initialCtm = new Matrix(1, 0, 0, -1, 0, canvasSize.Height); break; case RotationEnum.Leftward: initialCtm = new Matrix(0, 1, 1, 0, 0, 0); break; case RotationEnum.Upward: initialCtm = new Matrix(-1, 0, 0, 1, canvasSize.Width, 0); break; case RotationEnum.Rightward: initialCtm = new Matrix(0, -1, -1, 0, canvasSize.Width, canvasSize.Height); break; default: throw new NotImplementedException(); } // Scaling. RectangleF contentBox = contentContext.Box; SizeF rotatedCanvasSize = rotation.Transform(canvasSize); initialCtm.Scale( rotatedCanvasSize.Width / contentBox.Width, rotatedCanvasSize.Height / contentBox.Height ); // Origin alignment. initialCtm.Translate(-contentBox.Left, -contentBox.Top); //TODO: verify minimum coordinates! } return(initialCtm); }
public override void ExecutePageHierarchy() { _cargoEngine = Startup.CargoEngine; _contentContext = new ContentContext { Locale = this.Culture, Location = this.VirtualPath.Replace("~", ""), EditingEnabled = true //Request.IsAuthenticated }; _cargoContent = _cargoEngine.GetContent(_contentContext); base.ExecutePageHierarchy(); }
/** * <summary>Renders the specified content context into an image context.</summary> * <param name="contentContext">Source content context.</param> * <param name="size">Image size expressed in device-space units (that is typically pixels).</param> * <param name="area">Content area to render; <code>null</code> corresponds to the entire * <see cref="IContentContext.Box">content bounding box</see>.</param> * <returns>Image representing the rendered contents.</returns> */ public SKBitmap Render(IContentContext contentContext, SKSize size, SKRect?area) { //TODO:area! var image = new SKBitmap( (int)size.Width, (int)size.Height, SKColorType.Rgba8888, SKAlphaType.Opaque //PixelFormat.Format24bppRgb ); using (var canvas = new SKCanvas(image)) contentContext.Render(canvas, size); return(image); }
internal XObjectWrapper( ContentScanner scanner ) : base((XObject)scanner.Current) { IContentContext context = scanner.ContentContext; Matrix ctm = scanner.State.Ctm; this.box = new RectangleF( ctm.Elements[4], context.Box.Height - ctm.Elements[5], ctm.Elements[0], Math.Abs(ctm.Elements[3]) ); this.name = BaseDataObject.Name; this.xObject = BaseDataObject.GetResource(context); }
public override Color GetColor(IList <PdfDirectObject> components, IContentContext context) { if (components.Count == 1) { return(new DeviceGrayColor(components)); } else if (components.Count == 3) { return(new DeviceRGBColor(components)); // FIXME:temporary hack... } else if (components.Count == 4) { return(new DeviceCMYKColor(components)); } return(null); }
/** * <summary>Renders the specified content context into an image context.</summary> * <param name="contentContext">Source content context.</param> * <param name="size">Image size expressed in device-space units (that is typically pixels).</param> * <param name="area">Content area to render; <code>null</code> corresponds to the entire * <see cref="IContentContext.Box">content bounding box</see>.</param> * <returns>Image representing the rendered contents.</returns> */ public Image Render( IContentContext contentContext, SizeF size, RectangleF?area ) { //TODO:area! Image image = new Bitmap( (int)size.Width, (int)size.Height, PixelFormat.Format24bppRgb ); contentContext.Render(Graphics.FromImage(image), size); return(image); }
/** * <summary>Extracts text strings from the specified content context.</summary> * <param name="contentContext">Source content context.</param> */ public IDictionary <RectangleF?, IList <ITextString> > Extract( IContentContext contentContext ) { IDictionary <RectangleF?, IList <ITextString> > extractedTextStrings; { List <ITextString> textStrings = new List <ITextString>(); { // 1. Extract the source text strings! List <ContentScanner.TextStringWrapper> rawTextStrings = new List <ContentScanner.TextStringWrapper>(); Extract( new ContentScanner(contentContext), rawTextStrings ); // 2. Sort the target text strings! if (sorted) { Sort(rawTextStrings, textStrings); } else { foreach (ContentScanner.TextStringWrapper rawTextString in rawTextStrings) { textStrings.Add(rawTextString); } } } // 3. Filter the target text strings! if (areas.Count == 0) { extractedTextStrings = new Dictionary <RectangleF?, IList <ITextString> >(); extractedTextStrings[DefaultArea] = textStrings; } else { extractedTextStrings = Filter(textStrings, areas.ToArray()); } } return(extractedTextStrings); }
/** * <summary>Extracts plain text from the given content context.</summary> * <param name="contentContext">Source content context.</param> */ public string ExtractPlain( IContentContext contentContext ) { StringBuilder textBuilder = new StringBuilder(); foreach (List <ITextString> textStrings in Extract(contentContext).Values) { if (textBuilder.Length > 0) { textBuilder.Append('\n'); } // Separates text belonging to different areas. foreach (ITextString textString in textStrings) { textBuilder.Append(textString.Text).Append('\n'); } } return(textBuilder.ToString()); }
public SubscriptionRepository(IContentContext contentContext) : base(contentContext) { }
public override Color GetColor( IList<PdfDirectObject> components, IContentContext context ) { return new SeparationColor(components); }
protected Repository(IContentContext contentContext) { ContentContext = contentContext; }
public UserRepository(IContentContext contentContext) : base(contentContext) { }
public override Color GetColor( IList<PdfDirectObject> components, IContentContext context ) { return new DeviceRGBColor(components); }
public override Color GetColor( IList<PdfDirectObject> components, IContentContext context ) { return new DeviceRGBColor(components); // FIXME:temporary hack... }
/** <summary>Renders the specified content context into an image context.</summary> <param name="contentContext">Source content context.</param> <param name="size">Image size expressed in device-space units (that is typically pixels).</param> <param name="area">Content area to render; <code>null</code> corresponds to the entire <see cref="IContentContext.Box">content bounding box</see>.</param> <returns>Image representing the rendered contents.</returns> */ public Image Render( IContentContext contentContext, SizeF size, RectangleF? area ) { //TODO:area! Image image = new Bitmap( (int)size.Width, (int)size.Height, PixelFormat.Format24bppRgb ); contentContext.Render(Graphics.FromImage(image), size); return image; }
/// <summary> /// Create a new <see cref="ContentView"/> with given content, a content context, and a data source. /// This <see cref="ContentView"/> owns the data source and will dispose it when disposed. /// </summary> /// <param name="content">The initial content for the view.</param> /// <param name="contentContext">The content context this view represents.</param> /// <param name="dataSource">The data source to use.</param> public ContentView(IEnumerable<ContentItem> content, IContentContext contentContext, ICargoDataSource dataSource) { ContentContext = contentContext; Content = content.ToDictionary(x => x.Key); DataSource = dataSource; }
public override Color GetColor( IList<PdfDirectObject> components, IContentContext context ) { //TODO /* Pattern pattern = context.Resources.Patterns[components[components.Count-1]]; if(pattern is TilingPattern) { TilingPattern tilingPattern = (TilingPattern)pattern; if(tilingPattern.PaintType == PaintTypeEnum.Uncolored) { ColorSpace underlyingColorSpace = UnderlyingColorSpace; if(underlyingColorSpace == null) throw new IllegalArgumentException("Uncolored tiling patterns not supported by this color space because no underlying color space has been defined."); // Get the color to be used for colorizing the uncolored tiling pattern! Color color = underlyingColorSpace.GetColor(components, context); // Colorize the uncolored tiling pattern! pattern = tilingPattern.Colorize(color); } } return pattern; */ return null; }
/** * <summary>Gets the <see cref="ColorSpace">color space</see> resource to be set.</summary> * <param name="context">Content context.</param> */ public ColorSpace GetColorSpace(IContentContext context) { return(GetResource(context)); }
public MessageRepository(IContentContext contentContext) : base(contentContext) { }
public CustomerRepository(IContentContext contentContext) : base(contentContext) { }
/** <summary>Renders the specified content context into an image context.</summary> <param name="contentContext">Source content context.</param> <param name="size">Image size expressed in device-space units (that is typically pixels).</param> <returns>Image representing the rendered contents.</returns> */ public Image Render( IContentContext contentContext, SizeF size ) { return Render(contentContext, size, null); }