Forum > Graphics

[SOLVED] SVG thumbnails

(1/4) > >>

Pe3s:
Hello forumers, there is a component that has the ability to display thumbnails of .svg files in the specified folder ?

domasz:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses BGRABitmap, BGRASVG; ...Bgra := TBgraBitmap.Create('file.svg');Bgra2 := Bgra.Resample(200,200);
In order to list files in a directory- FindFirst, FindNext

Pe3s:
I meant to create a grid of thumbnails based on the path.

domasz:
Prepare thumbnails using the code I posted earlier and display them in TDrawGrid.

circular:
Hi @Pe3s,

That's a great question. There isn't component that display all SVGs in a directory. Though, it is simple to generate a thumbnail from a file and use it in an existing component like a TDrawGrid or a TListView.

To make a thumbnail, there is a dedicated function in BGRAThumbnail unit:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses BGRABitmap, BGRAThumbnail; bgra := GetFileThumbnail('file.svg', 200, 200, BGRAWhite, true); 
Regards

Navigation

[0] Message Index

[#] Next page

Go to full version