View Full Version : Anyone Know how to Add pic to gui from website?
laakerules
01-15-2012, 09:05 PM
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.
Dynamite
01-15-2012, 09:11 PM
Do you mean a form?
-Boom
laakerules
01-15-2012, 09:11 PM
HMmmm, i could make it download and place it into a certain spot then load it from there though? Rite?
Do you mean a form?
-Boom
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/dd448/laakerules/on_cap10.png
to look like this on the GUI
http://i1220.photobucket.com/albums/dd448/laakerules/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.php?t=68856&highlight=paint+on+smart
Edit: Yeah the BMP for that image is nasty huge. 1.1k lines+
laakerules
01-15-2012, 09:27 PM
Holy crap 1.1k lines!!!!!!!!!!!!!!!! :0
Richard
01-15-2012, 09:31 PM
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.
Brandon
01-15-2012, 09:33 PM
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.
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.
laakerules
01-15-2012, 09:34 PM
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.
Richard
01-15-2012, 09:50 PM
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.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.