Excactly as title, all i want to know is if its possible to add a picture from a direct link to a simba GUI?
Printable View
Excactly as title, all i want to know is if its possible to add a picture from a direct link to a simba GUI?
You can add pictures but you will have to convert a .BMP to a string using the option 'Bitmap conversion' under Tools on the main Simba bar. As for use from a link I doubt that is possible.
Do you mean a form?
-Boom
HMmmm, i could make it download and place it into a certain spot then load it from there though? Rite?
No i can easily do the form, for it in a location on the computer. I was just wondering if you could like have it take the pic off a direct link such as
http://i1220.photobucket.com/albums/...s/on_cap10.png
to look like this on the GUI
http://i1220.photobucket.com/albums/...s/on_cap10.png
Well you can try to look at the Tut by flight about drawing on SMART. You can add text AND images. Be warned though the bigger the image the bigger and messier the string will look.
http://villavu.com/forum/showthread....paint+on+smart
Edit: Yeah the BMP for that image is nasty huge. 1.1k lines+
Holy crap 1.1k lines!!!!!!!!!!!!!!!! :0
You don't actually have to do the whole string conversation, you can just download the file from a URL, store it into a folder, and just access that file from within the folder. Looks far neater.
Include smart and this will do it.. Thing is ur better of splitting this function into two parts.. One part that will download the file if it doesn't exist.. then the other part that will paint it onto smart.. I'll leave that to u as I did most of it already.
Simba Code:program ImageProc;
//{$loadlib SSecurity} //Plugin to convert Any images to Bitmaps.. Not needed since simba can do PNG's
{$i SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
Function ImageProc(BMPName: String; Placement: TPoint; TP: TStringArray): String; //Don't touch this function..
var
Image, Path: string;
FP, Item, X, Y, SX, SY, I, B, H: Integer;
ATPA: T2DPointArray;
Canvas: TCanvas;
Colors: TIntegerArray;
begin
Image:= GetPage('http://i1220.photobucket.com/albums/dd448/laakerules/on_cap10.png');
Path:= ScriptPath + BMPName + '.png';
Path:= Trim(Path);
FP:= CreateFile(Path);
WriteFileString(FP, Image);
CloseFile(FP);
//ImgToBMP(ScriptPath + BMPName + '.bmp'); //Function in plugin..
Item:= LoadBitmap(ScriptPath + BMPName + '.png');
GetBitmapSize(Item, Sx, SY);
//Paint on smart Bitmap.
SmartSetDebug(True); //Turns Debug on..
GetClientDimensions(x, y);
SetArrayLength(ATPA, Length(TP));
for I := 0 to High(ATPA) do
begin
ATPA[i] := LoadTextTPA(TP[i], UpChars, H);
for B := 0 to High(ATPA[i]) do
ATPA[i][B].y := ATPA[i][B].y + i*(H);
end;
if Length(Colours) = 4 then
begin
SetArrayLength(Colors, Length(TP));
for i := 0 to High(Colors) do
Colors[i] := Colours[1];
end else
Colors := Colours;
DrawATPABitmapEx(Item, ATPA, Colors);
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Item, Canvas, Placement.x, Placement.y);
FreeBitmap(Item);
end;
Begin
SetupSRL;
ImageProc('law', Point(0, 0), ['']);
end.
Ya richard, i can do that. But could i add a implementation into the Form that when it opens it downloads the immage places it somewhere then uses that image? make it so that my script users dont have to download it themselves and place it in a certain folder somewhere themselves.
The code ggzz posted shows how to do it. To save on execution time, though, it's best to check to see if the file already exists.