ElementSnapshot Control
An ElementSnapshot control receives an element from windows presentation foundation (WPF) that is used to render a bitmap image. A determination is made by the control whether or not the bitmap image has been previously generated. If the bitmap image has been previously generated, the control retrieves the generated bitmap. If the image has not been previously generated, the control supplies the element to a native WPF class in order to generate the bitmap of the element. The generated bitmap is then rendered into a WPF scene.
1 . A method for depicting a visual representation in a Windows Presentation Foundation (WPF) scene, the method comprising:
receiving an element from a WPF application that is used to render a bitmap image;
determining whether the bitmap image has been previously generated;
if the image has been previously generated, retrieving the generated bitmap;
if the image has not been previously generated, using a native WPF class to generate the bitmap; and
rendering the generated bitmap into the WPF scene.
2 . The method recited in claim 1 further comprising:
caching the generated bitmap in a cache; and
examining the cache when determining whether the bitmap image has been previously generated.
3 . The method recited in claim 1 further comprising:
receiving with the element a screen space in with which to render a bitmap; and
rendering the generated bitmap into the WPF scene within the screen space.
4 . The method as recited in claim 1 further comprising continuously receiving the render requests to re-render the element from the WPF Application each time the application needs to render the bitmap image.
5 . The method as recited in claim 1 wherein a format of the bitmap is selected from a group of bitmap formats comprising: BMP, JPEG, TIFF, GIF, and PNG.
6 . The method as recited in claim 1 wherein if the image has been previously generated, retrieving the generated bitmap from a cache.
7 . The method as recited in claim 1 wherein the generated bitmap is rendered for insertion into a portion of the WPF scene as indicated by WPF.
8 . A computer readable medium comprising computer-executable instructions for depicting a visual representation in a Windows Presentation Foundation (WPF) scene that, when executed by one or more processors, perform acts comprising:
receiving an element from a WPF application that is used to render a bitmap image;
automatically determining whether the bitmap image has been previously generated;
if the image has been previously generated, retrieving the generated bitmap from a cache;
if the image has not been previously generated, using a native WPF class to generate the bitmap; and
rendering the generated bitmap for insertion into the WPF scene.
9 . The computer readable medium as recited in claim 8 , wherein the bitmap generated using the native WPF class is stored in the cache after being generated.
10 . The computer readable medium as recited in claim 8 further comprising:
caching the generated bitmap in a cache using the native WPF class; and
examining the cache when determining whether the bitmap image has been previously generated.
11 . A method for depicting a visual representation in a Windows Presentation Foundation (WPF) scene, the method comprising:
periodically receiving one or more elements from a WPF application that are used to render bitmap images;
determining whether one of the bitmap images corresponding to one of the received elements has been previously generated;
if the image has been previously generated, retrieving the generated bitmap corresponding to the one of the received elements;
if the image has not been previously generated, using a native WPF class to generate the bitmap for the received one of the elements; and
rendering the generated bitmap into the WPF scene.
12 . The method as recited in claim 10 wherein the bitmap is rendered into the WPF scene via a call to a DrawImage method of a WPF DrawingContext class.
13 . The method as recited in claim 10 wherein the native WPF to generate the bitmap is a WPF RenderTargetBitmap class.