home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
Watch / Listen Media
View Pictures
Test application: For "lightning fast thumbnail creation"
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Inker" data-source="post: 169473" data-attributes="member: 10541"><p>You'll have to use the Texturemanager to convert the bitmap to a texture and then load that texture to the control. But you need to make sure they get unloaded too when you don't need them anymore or the memory usage will go through the roof.</p><p></p><p>Something like:</p><p></p><p>[CODE]System.Drawing.Image img = whatever.LoadImage();</p><p>string name = "whatever"; // unique per thumbnail, perhaps use the path</p><p>Size s = new Size(100,100);</p><p>item.ThumbnailImage = buildMemoryImage(img, name, s);</p><p></p><p>public static string buildMemoryImage(System.Drawing.Bitmap image, string identifier, System.Drawing.Size size)</p><p>{</p><p> string name = String.Format("[Thumbnail:{0}]", identifier);</p><p> try</p><p> {</p><p> if (GUITextureManager.LoadFromMemory(null, name, 0, 0, 0) == 0)</p><p> {</p><p> GUITextureManager.LoadFromMemory(image, name, 0, size.Width, size.Height);</p><p> }</p><p> }</p><p> catch (Exception ex)</p><p> {</p><p> // error</p><p> }</p><p> return name;</p><p></p><p>}[/CODE]</p><p></p><p></p><p></p><p>Because it doesnt search recursivly, its just a test app <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="Inker, post: 169473, member: 10541"] You'll have to use the Texturemanager to convert the bitmap to a texture and then load that texture to the control. But you need to make sure they get unloaded too when you don't need them anymore or the memory usage will go through the roof. Something like: [CODE]System.Drawing.Image img = whatever.LoadImage(); string name = "whatever"; // unique per thumbnail, perhaps use the path Size s = new Size(100,100); item.ThumbnailImage = buildMemoryImage(img, name, s); public static string buildMemoryImage(System.Drawing.Bitmap image, string identifier, System.Drawing.Size size) { string name = String.Format("[Thumbnail:{0}]", identifier); try { if (GUITextureManager.LoadFromMemory(null, name, 0, 0, 0) == 0) { GUITextureManager.LoadFromMemory(image, name, 0, size.Width, size.Height); } } catch (Exception ex) { // error } return name; }[/CODE] Because it doesnt search recursivly, its just a test app :-) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
Watch / Listen Media
View Pictures
Test application: For "lightning fast thumbnail creation"
Contact us
RSS
Top
Bottom