ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Displaying an in-memory image
Posted by Drazana on Jul-11-2017 19:56
Hello,

is it possible to load an image from memory into a DrawArea?

Thanks
Drazana

  Re: Displaying an in-memory image
Posted by Peter Kwan on Jul-12-2017 00:22
Hi Drazana,

This is possible only for the .NET and Java edition of ChartDirector, or if the image is just unencoded an array of pixels (that is, not encoded in BMP, PNG, JPG or GIF). If the image is encoded, you would need to use some third party software to decode it to an array of pixels to load it into the DrawArea.

For the .NET and Java edition of ChartDirector, the DrawArea.loadPNG, loadJPG and loadGIF methods also accept an System.IO.Stream or java.io.InputStream object, so you can load the image using a memory stream.

For all editions of ChartDirector, you can create an empty DrawArea with the proper width and height, then create a pattern color using DrawArea.patternColor, where the pattern is the array of pixels, and paint a rectangle the same size as the DrawArea using that pattern color. The array of pixels essentially becomes the background of the DrawArea.

Hope this can help.

Regards
Peter Kwan