{"id":126,"date":"2009-07-09T12:41:36","date_gmt":"2009-07-09T12:41:36","guid":{"rendered":"http:\/\/nextwavemultimedia.com\/blog\/?p=126"},"modified":"2009-07-09T14:04:53","modified_gmt":"2009-07-09T14:04:53","slug":"300-dpi-in-flexflash","status":"publish","type":"post","link":"https:\/\/www.nextwavemultimedia.com\/blog\/actionscript-30\/300-dpi-in-flexflash\/","title":{"rendered":"Outputing 300 DPI in Flex \/ Flash"},"content":{"rendered":"<p>This example uses the mx.graphics.ImageSnapshot class, which lets you take snapshot images of Flex user interface components. The underlying Flash Player API is <em>flash.display.BitmapData.draw()<\/em>. The maximum dimensions that <em>BitmapData.draw()<\/em> can capture is 2880&#215;2880 pixels. By default, ImageSnapshot is also limited to this. ImageSnapshot has the following additional features:<\/p>\n<p>\u00e2\u20ac\u00a2\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Ability to specify an image format encoding (PNG is the default, JPG is the only other implementation.<br \/>\n\u00e2\u20ac\u00a2\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 For components that extend mx.core.UIComponent, calls UIComponent.prepareToPrint() and when finished calls UIComponent.finishPrint(). This lets you change the appearance of the component for capture; for example, remove selected item highlights.<br \/>\n\u00e2\u20ac\u00a2\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Conversion of captured images to Base64-encoded Strings for text-based serialization purposes, such as embedding in XML)<br \/>\n\u00e2\u20ac\u00a2\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Simple API to specify a desired resolution in dots per inch (DPI) that works out the underlying matrix required to scale the off-screen capture to a particular resolution.<br \/>\n\u00e2\u20ac\u00a2\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Ability to controls whether the ImageSnapshot class tries to take multiple snapshots to support resolutions higher than 2880&#215;2880 by stitching together several snapshots into one big ByteArray representing raw bitmap data before applying the encoding (for example, PNG). However, this is limited because a ByteArray can only hold 256 megabytes of data. Total composite image resolution is limited to about 8192&#215;8192 . By default, the requested DPI is reduced until it fits inside 2880&#215;2880 to avoid runtime errors.<\/p>\n<p>The maximum DPI allowed when taking a snapshot depends on the dimensions of the component being captured and the on-screen resolution. The scale factor is the requested DPI divided by the on-screen resolution, which is then multiplied by the dimensions of the rectangular bounds of the user interface component being captured.<br \/>\nFor example, suppose you have a component that is 400&#215;300 pixels in area, has an on-screen resolution of 96 dpi, and a requested resolution is 300 dpi. The resulting scale factor is 300 \/ 96 = 3.125 times. Therefore, the captured image will be 1250 x 937.5 pixels.<\/p>\n<p>Happy printing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example uses the mx.graphics.ImageSnapshot class, which lets you take snapshot images of Flex user interface components. The underlying Flash Player API is flash.display.BitmapData.draw(). The <span class=\"ellipsis\">&hellip;<\/span> <span class=\"entry-more-link-wrapper\"><a href=\"https:\/\/www.nextwavemultimedia.com\/blog\/actionscript-30\/300-dpi-in-flexflash\/\" class=\"entry-more-link entry-more-link-excerpt btn btn-primary\"><span>Read More<\/span><\/a><\/span><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[33,29,32,30,31],"_links":{"self":[{"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/posts\/126"}],"collection":[{"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":12,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/posts\/126\/revisions\/129"}],"wp:attachment":[{"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nextwavemultimedia.com\/blog\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}