dwgdirect.net C++类库

Are you Sure?
The source code is now on GitHub:
Description
The WriteableBitmapEx library is a collection of extension methods for the . The WriteableBitmap class is available for all XAML flavors including Windows Phone, WPF, WinRT Windows Store XAML, (Windows 10) UWP and Silverlight. It allows the direct manipulation of a bitmap and can be used for image manipulation,
to generate fast procedural images by drawing directly to a bitmap and more.
The WriteableBitmap API is very minimalistic and there's only the raw
array for such operations. The WriteableBitmapEx library tries to compensate that with extensions methods that are easy to use like built in methods and offer
like functionality. The library extends the WriteableBitmap class with elementary and fast (2D drawing) functionality, conversion methods and functions to combine (blit) WriteableBitmaps.
The extension methods are grouped into different C# files using a partial class approach. It is possible to include just a few methods by using the specific source code files directly or the full functionality via the built binaries.
The latest binaries are always available as .
WriteableBitmapEx was also ported to .
for a list of features that will be added in the future. Please use the
to add new issues which are not already reported.
like drawing functionality for the WriteableBitmap.
Support for Windows Phone Silverlight, Windows Phone WinRT, desktop Silverlight, WPF, Windows 8/8.1 WinRT XAML and Windows 10 UWP.
Support for the
(alpha premultiplication will be performed) Also overloads for faster int32 as color (assumed to be already alpha premultiplied)
SetPixel method with various overloads GetPixel method to get the pixel color at a specified x, y coordinate Fast Clear methods Fast Clone method to copy a WriteableBitmap ForEach method to apply a given function to all pixels of the bitmap
Transformation
Crop method to extract a defined region Resize method with support for bilinear interpolation and nearest neighbor Rotate in 90& steps clockwise and any arbitrary angle Flip vertical and horizontal
Fast line drawing algorithms including various anti-aliased algorithm Variable stroke thickness and penned / stamp lines Ellipse, polyline, quad, rectangle and triangle Cubic Bezi&r, Cardinal spline and closed curves
Filled shapes
Fast ellipse and rectangle fill method Triangle, quad, simple and complex polygons Bezi&r and Cardinal spline curves
Different blend modes including alpha, additive, subtractive, multiply, mask and none
Optimized fast path for non blended blitting
Convolution, Blur Brightness, contrast, gamma adjustments Gray/brightness, invert
Conversion
Convert a WriteableBitmap to a byte array Create a WriteableBitmap from a byte array Create a WriteableBitmap easily from the application resource or content Create a WriteableBitmap from an any platform supported image stream Write a WriteableBitmap as a
to a stream Separate extension method to save as a . Download
Windows Phone specific methods
Save to media library and the camera roll
External Code
Live samples
Silverlight samples that show the WriteableBitmapEx in action:
includes various scenarios where different shapes are drawn. By default a little demo is shown called &Breathing Flower&. Basically different sized circles rotating around a center ring are generated. The sample also contains a static
page showing some of the possible shapes. The
starts with a demo that animates the Cardinal spline's tension of the FillCurveClosed method, plus some random animated filled ellipses. The sample also contains a static page showing some of the possible filled shapes.
demonstrates the Bezi&r and Cardinal spline methods. The sample starts with a demo animation that uses the Cardinal spline DrawCurve method to draw an artificial plant that grows procedurally. The other part of the sample is interactive
and allows to draw and manipulate Bezi&r and Cardinal splines with the mouse. See
for further information. The
combines WriteableBitmaps and shows a neat particle effect.
Video of the .
External resources:
Adam Kinney made a
that uses the WriteableBitmapEx library to dynamically apply a torn weathered effect to a photo.
Erik Klimczak from Calrity Consulting wrote a very good blog post about . He uses the WriteableBitmapEx to get the best performance.
Peter Bromberg wrote a great article called .
Performance!
The WriteableBitmapEx methods are much faster than the XAML
subclasses. For example, the WriteableBitmapEx line drawing approach is more than 20-30 times faster than the Silverlight
element. If a lot of shapes need to be drawn, the WriteableBitmapEx methods are the right choice.
Easy to use!
// Initialize the WriteableBitmap with size 512x512 and set it as source of an Image control
WriteableBitmap writeableBmp = BitmapFactory.New(512, 512);
ImageControl.Source = writeableB
using(writeableBmp.GetBitmapContext()){
// Load an image from the calling Assembly's resources via the relative path
writeableBmp = BitmapFactory.New(1, 1).FromResource(&Data/flower2.png&);
// Clear the WriteableBitmap with white color
writeableBmp.Clear(Colors.White);
// Set the pixel at P(10, 13) to black
writeableBmp.SetPixel(10, 13, Colors.Black);
// Get the color of the pixel at P(30, 43)
Color color = writeableBmp.GetPixel(30, 43);
// Green line from P1(1, 2) to P2(30, 40)
writeableBmp.DrawLine(1, 2, 30, 40, Colors.Green);
// Line from P1(1, 2) to P2(30, 40) using the fastest draw line method
int[] pixels = writeableBmp.P
int w = writeableBmp.PixelW
int h = writeableBmp.PixelH
WriteableBitmapExtensions.DrawLine(pixels, w, h, 1, 2, 30, 40, myIntColor);
// Blue anti-aliased line from P1(10, 20) to P2(50, 70) with a stroke of 5
writeableBmp.DrawLineAa(10, 20, 50, 70, Colors.Blue, 5);
// Black triangle with the points P1(10, 5), P2(20, 40) and P3(30, 10)
writeableBmp.DrawTriangle(10, 5, 20, 40, 30, 10, Colors.Black);
// Red rectangle from the point P1(2, 4) that is 10px wide and 6px high
writeableBmp.DrawRectangle(2, 4, 12, 10, Colors.Red);
// Filled blue ellipse with the center point P1(2, 2) that is 8px wide and 5px high
writeableBmp.FillEllipseCentered(2, 2, 8, 5, Colors.Blue);
// Closed green polyline with P1(10, 5), P2(20, 40), P3(30, 30) and P4(7, 8)
int[] p = new int[] { 10, 5, 20, 40, 30, 30, 7, 8, 10, 5 };
writeableBmp.DrawPolyline(p, Colors.Green);
// Cubic Bezi&r curve from P1(5, 5) to P4(20, 7)
// with the control points P2(10, 15) and P3(15, 0)
writeableBmp.DrawBezier(5, 5, 10, 15, 15, 0, 20, 7,
Colors.Purple);
// Cardinal spline with a tension of 0.5
// through the points P1(10, 5), P2(20, 40) and P3(30, 30)
int[] pts = new int[] { 10, 5, 20, 40, 30, 30};
writeableBmp.DrawCurve(pts, 0.5,
Colors.Yellow);
// A filled Cardinal spline with a tension of 0.5
// through the points P1(10, 5), P2(20, 40) and P3(30, 30)
writeableBmp.FillCurveClosed(pts, 0.5,
Colors.Green);
// Blit a bitmap using the additive blend mode at P1(10, 10)
writeableBmp.Blit(new Point(10, 10), bitmap, sourceRect, Colors.White, WriteableBitmapExtensions.BlendMode.Additive);
// Override all pixels with a function that changes the color based on the coordinate
writeableBmp.ForEach((x, y, color) =& Color.FromArgb(color.A, (byte)(color.R / 2), (byte)(x * y), 100));
} // Invalidate and present in the Dispose call
// Take snapshot
var clone = writeableBmp.Clone();
// Save to a TGA image stream (file for example)
writeableBmp.WriteTga(stream);
// Crops the WriteableBitmap to a region starting at P1(5, 8) and 10px wide and 10px high
var cropped = writeableBmp.Crop(5, 8, 10, 10);
// Rotates a copy of the WriteableBitmap 90 degress clockwise and returns the new copy
var rotated = writeableBmp.Rotate(90);
// Flips a copy of the WriteableBitmap around the horizontal axis and returns the new copy
var flipped = writeableBmp.Flip(FlipMode.Horizontal);
// Resizes the WriteableBitmap to 200px wide and 300px high using bilinear interpolation
var resized = writeableBmp.Resize(200, 300, WriteableBitmapExtensions.Interpolation.Bilinear);
Additional Information
The WriteableBitmapEx library has its origin in several blog posts that also describe the implemenation and usage of some aspects in detail. The blog posts might be seen as the documentation.&
introduced the SetPixel methods.&
provided the DrawLine methods.&
brought the shape functionality (ellipse, polyline, quad, rectangle, triangle).&
came with the byte array conversion methods and hows how to encode / decode a WriteableBitmap to JPEG.&
provided the Blit functions.&
announced this project.&
provided the original TgaWrite function.&
announced version 0.9.0.0 and gives some further information about the curve sample.&
introtuced the WriteableBitmapEx version for the Windows Phone and a sample.&
announced version 0.9.5.0, has some information about the new Fill methods and comes with a nice sample.&
announced version 1.0.0.0 and provides some background about the WinRT Metro Style version.&
Support it
started this project, maintains it and provided most of the code.&
wrote the Blit methods.&
added some Blending modes to the Blit method.&
contributed the ForEach method.&
proposed an optimization of the Clear(Color) method.&
suggested the Color Keying BlendMode.&&&
fixed a bug in the Blit alpha blending.&
John Ng San Ping added the AdjustBrightness, Contrast and Gray methods.&
Your name here? We are always looking for valuable contributions.&&&
Last edited
by , version 117
| Ad revenue is .
related projects君,已阅读到文档的结尾了呢~~
【doc】 基于DWGdirect技术的图形内容全文搜索
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
【doc】 基于DWGdirect技术的图形内容全文搜索
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口// Sample Code
Sample Code
This sample illustrates how to embed various raster image formats (e.g. TIFF, JPEG, JPEG2000, JBIG2, GIF, PNG, BMP, etc.) in a PDF document.
, , , , , , ,
Annotation
Shows how to add a text annotation to an existing page and how to create link annotations between several pages:
, , , , , , ,
The sample code illustrates how to read and edit existing outline items and create new bookmarks using the high-level API.
, , , , , , ,
ContentReplacer
This sample shows how to use '' to search and replace text strings and images in existing PDF (e.g. business cards and other PDF templates). Unlike PDF forms, the ContentReplacer works on actual PDF content and is not limited to static rectangular annotation regions.
, , , , , , ,
This sample shows how to use PDFNet Convert Add-on (i.e. 'pdftron.PDF.Convert' namespace) for direct, high-quality conversion between PDF, XPS, EMF, SVG, TIFF, PNG, JPEG, and other image formats. The sample also shows how to convert any printable document (e.g. Word, HTML, RTF, MS Office, DXF, DWG, etc) to PDF or XPS using a universal document converter.
, , , , , , ,
DigitalSignatures
Demonstrates the basic usage of high-level digital signature API to digitally sign and/or certify PDF documents.
, , , , , , ,
ElementBuilder
Illustrates how to use PDFNet page
API, how to embed fonts and images and how to copy graphical elements from one page to another.
, , , , , , ,
ElementEdit
The sample code shows how to edit the page display list and how to modify graphics state attributes on existing Elements. In particular the sample program strips all images from the page and changes text color to blue.
, , , , , , ,
ElementReaderAdv
The sample shows how to use some of more advanced PDFNet features. The sample code illustrates how to extract text, paths, and images. The sample also shows how to do color conversion, image normalization, and how to process changes in the graphics state.
, , , , , , ,
ElementReader
Illustrates how to traverse page display list using .
Encryption
Illustrates
support in PDFNet. The sample code reads an encrypted document and sets a new SecurityHandler.
, , , , , , ,
PDFNet includes a full support for FDF (Forms Data Format) and capability to merge/extract forms data (FDF) with/from PDF. The sample illustrates basic FDF merge/extract functionality available in PDFNet.
, , , , , , ,
The sample shows how to directly convert HTML pages to PDF using 'pdftron.PDF.HTML2PDF', which is part of separately licensable PDFNet Convert Add-On. HTML2PDF converter supports HTML conversion from a string or URL and offers many options to control page size and formating.
, , , , , , ,
ImageExtract
This sample illustrates couple of approaches to PDF image extraction.
, , , , , , ,
Imposition
The sample illustrates how multiple pages can be combined/imposed using PDFNet. Page imposition can be used to arrange/order pages prior to printing or to assemble a 'master' page from several 'source' pages. Using PDFNet API it is possible to write applications that can re-order the pages such that they will display in the correct order when the hard copy pages are compiled and folded correctly.
, , , , , , ,
InteractiveForms
The sample illustrates some basic PDFNet capabilities related
to interactive forms (also known as AcroForms).
, , , , , , ,
The sample project illustrates how to recompress bi-tonal (black and white) images in existing PDF documents using JBIG2 compression. The sample is intended to show how to specify hint information for image encoder and is not meant to be a generic PDF optimization tool. PDFNet supports both loss-less and lossy JBIG2 compression. To give you a feeling of compression rates possible with PDFNet we re-compressed a document containing 17 scanned pages. The
input document is ~1.4MB and is using standard CCITT Fax compression.
compression shrunk down the file to 641KB.
compression shrunk down the file to 176KB.
, , , , , , ,
LogicalStructure
This sample explores the structure and content of a tagged PDF document and dumps the structure information to the console window.
, , VB.Net, , , , ,
Multithreaded
illustrates how to use PDFDoc locking mechanisms to access the document concurrently.
PDFDoc uses a recursive shared lock model.
Multiple threads can read the document at the same time, but only one thread can write to the document.
A given thread can acquire as many locks of the same type as it wants, in a recursive fashion.
The sample shows how to use 'pdftron.PDF.Optimizer' to reduce PDF file size by reducing the file size, removing redundant information, and compressing data streams using the latest in image compression technology. 'pdftron.PDF.Optimizer' is an optional Add-On to PDFNet Core SDK.
, , , , , , ,
PageLabels
This example illustrates how to work with PDF page labels. PDF page labels can be used to describe a page. This is used to allow for non-sequential page numbering or the addition of arbitrary labels for a page (such as the inclusion of Roman numerals at the beginning of a book).
, , , , , , ,
This example illustrates how to create various PDF patterns and shadings.
, , , , , , ,
This sample illustrates how to use PDF/A add-on to validate existing PDF documents for PDF/A compliance as well as to convert generic PDF documents to PDF/A format.
, , , , , , ,
This sample shows how to create and use PDFDC (i.e. a PDF Device Context). Windows developers can use standard GDI or GDI+ API-s to write on PDFDC and to generate PDF documents based on their existing drawing functions. PDFDC can also be used to implement file conversion from any printable file format to PDF.
PDFDocMemory
The sample illustrates how to read/write a PDF document from/to memory buffer. This is useful for applications that work with dynamic PDFdocuments that don't need to be saved/read from a disk.
, , , , , , ,
This sample illustrates how to use the built-in rasterizer in order to render PDF images on the fly and how to save resulting images in PNG and JPEG format.
, , , , , , ,
This sample demonstrates how to create PDF layers (also known as Optional Content Groups - OCGs). The sample also shows how to extract and render PDF layers.
, , , , , , ,
PDFPackage
This sample illustrates how to create, extract, and manipulate PDF Packages (also known as PDF Portfolios).
, , , , , ,
The sample illustrates how to
pages from one document to another, how to , and
pages and how to use ImportPages() method for very efficient copy and merge operations.
, , , , , , ,
This sample illustrates how to print PDF document using currently selected default printer. It is possible to use PDFNet printing functionality in both client and server applications without dependance on any third party components.
The sample shows how to use 'pdftron.PDF.Redactor' to remove potentially sensitive content within PDF documents. PDFTron Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion is destroyed and is not simply hidden with clipping or image masks.
, , , , , , ,
This sample shows how to customize the viewer control by implementing a number of custom tools (such as freehand tool, link creation tool, rectangular zoom etc) and custom GUI elements (such as custom navigation and printing). For a more introductory example of how to use PDFViewCtrl, please see PDFViewSimple sample project.
PDFViewSimple
This sample shows how to use PDF viewer control in a basic project. The sample uses a number of built-in features from PDFViewCtrl to implement document navigation, text highlighting, markup, and editing. If you are looking for a sample showing how to further customize the viewer (e.g. by implementing custom tools or custom GUI elements), please take a look at PDFView sample project.
PDFViewWPF
This sample shows how to use PDFViewWPF class.
PDFViewWPFSimple
This sample shows how to use PDFViewWPF class.
Shows how to change Page's
using Rect class.
, , , , , , ,
The sample illustrates how to use basic to edit an existing document.
, , , , , , ,
The sample shows how to use 'pdftron.PDF.Stamper' utility class to stamp PDF pages with text, images, or with other PDF pages. ElementBuilder and ElementWriter should be used for more complex PDF stamping operations.
, , , , , , ,
TextExtract
The sample illustrates the basic text extraction capabilities of PDFNet.
, , , , , , ,
TextSearch
This sample shows how to use TextSearch to search text on PDF pages using regular expressions. TextSearch utility class builds on functionality available in
to simplify most common search operations.
, , , , , ,
This example illustrates how to embed U3D content (3 dimensional models) in PDF.
, , , , , , ,
UnicodeWrite
An example illustrating how to create Unicode text and how to embed composite fonts.
, , , , , , ,
These samples shows how to use integrate PDFNet
into any HTML5, Silverlight, or Flash web application.
The sample is using 'pdftron.PDF.Convert.ToXod()' to convert/stream PDF, XPS, MS Office, RTF, HTML and other document formats to WebViewer
'pdftron.PDF.Convert.ToXod()' is an optional Add-On to the Core SDK and is part of PDFNet .
, , , , , , ,
These samples illustrate how to use the pdftron.PDF.Convert utility class to convert DOCX files to PDF.
This conversion is performed entirely within PDFNet and has no external or system dependencies dependencies. Conversion results will be the same on all platforms.
This example shows how to use PDFNet Convert Add-on (i.e. 'pdftron.PDF.Convert' namespace) to dynamically generate PDF or XPS directly from a FlowDocument, XAML, or WPF. Converting XAML/FlowDocument to PDF is not only easy, but is also very flexible in terms of how content is paginated and flowed into a fixed document such as PDF or XPS.
Next Steps:Last modified on Mar 17, :51 AM
Download in other formats:

我要回帖

更多关于 c 类库 的文章

 

随机推荐