I have a simba version that compiles now.
But no matter how I use a bitmap in simba I get tons of errors.
I have tried using TMufasaBitmap and TBitmap.
I have tried Bitmap:= TMufasaBitmap.Create and Bitmap:= BitmapFromString(w, h, '');
Everything crashes the script/ freezes my computer, making it extremely hard to debug.
Edit:
This is testing out how to use a bitmap.
It just creates a bitmap and tries to set some of its pixels then draw the bitmap on the form.
"Error: Exception: You are accessing an invalid point, (0,0) at bitmap[0] at line 69"
Simba Code:program new;
var
Bmp: TMufasaBitmap;
Canvas: TCanvas;
Form: TForm;
x, y: integer;
procedure InitForm;
begin
Form:= TForm.Create(nil);
Form.Caption := 'Freakin Fractals - By Almost';
Form.Color := 15582994;
Form.Font.Color := clWindowText;
Form.Font.Height := -11;
Form.Font.Name := 'MS Sans Serif';
Form.Font.Style := [];
Form.Visible := False;
Form.PixelsPerInch := 96;
Form.Windowstate:= WSMaximized;
Form.Height:= 500;
Form.Width:= 800;
Bmp.DrawToCanvas(0, 0, Form.Canvas);
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(v, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
Form.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
Bmp:= TMufasaBitmap.create;
for x:= 0 to 50 do
for y:= 0 to 50 do
Bmp.FastSetPixel(x, y, 0);
SafeInitForm;
SafeShowFormModal;
Form.Free;
Bmp.Free;
end.
You have to make sure the point you are trying to draw on is available on the bitmap. If your bitmap is 20x20 you can't paint on 52,12.
Also, I don't think that's the correct way of creating a TMufasaBitmap... Correct me if I'm wrong
I don't see any way of setting the width and height of it.
TMufasaBitmap.Width is read only.
And BitmapFromString returns an integer.
Maybe TMufasaBitmap.Something:= BitmapFromstring?
I don't think that's the right way either but that's what Wizzup did in his example and I'm not sure what else to do.
Don't know if the test files are delivered within an install..
http://git.villavu.com/?p=simba.git;...698907;hb=HEAD
Check out http://git.villavu.com/?p=simba.git;....simba;hb=HEAD
Verrekte Koekwous
I looked through the test files and apparently bitmaps work when used just like in scar...
GF my time.
I don't see TBitmap or bitmaps being used as objects at all...
And for some reason it won't copy a bitmap onto a TForm.Canvas, you have to create a TImage or something and copy it.
Simba Code:program new;
var
Bmp: integer;
Form: TForm;
x, y: integer;
Image: TImage;
procedure InitForm;
begin
Form:= TForm.Create(nil);
Form.Caption := 'Freakin Fractals - By Almost';
Form.Color := 15582994;
Form.Font.Color := clWindowText;
Form.Font.Height := -11;
Form.Font.Name := 'MS Sans Serif';
Form.Font.Style := [];
Form.Visible := False;
Form.PixelsPerInch := 96;
Form.Windowstate:= WSMaximized;
Form.Height:= 500;
Form.Width:= 800;
Image:= TImage.Create(Form);
Image.Parent:= Form;
Image.SetBounds(0, 0, 200, 200);
DrawBitmap(Bmp, Image.Canvas, 0, 0);
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(v, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
Form.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
Bmp:= CreateBitmap(100, 100);
CopyClientToBitmap(Bmp,0,0,99,99);
for x:= 0 to 50 do
for y:= 0 to 50 do
FastSetPixel(Bmp, x, y, clwhite);
SafeInitForm;
SafeShowFormModal;
Form.Free;
FreeBitmap(Bmp);
end.
I don't see any differences, except the procedure DrawBitmap, which is an easier to use version of CopyCanvas.
And CreateBitmap is an easier to use version of BitmapFromString if you are just creating a blank.
Edit3:
Finally figured it out :O
TForm.OnPaint doesn't work correctly and was constantly activating causing the edit boxes and buttons and everything to freeze up and causing the form to be unable to close.
Might have a working simba version very soon.
Exit2:
This was supposed to be an edit on to the last post, oops =P
Edit4:
Got a working version for simba.
I will put it up but simba has some issues.
There is no way to do TTabSheet.OnMouseDown, there is no TProgressBar, TForm.Paint won't work right, and there is a TSaveDialog.Execute but not a TColorDialog.Execute
And I think that's all, I don't really remember.
Beautiful work. Do the Mays curve too. f(x) = f(1 - x) iirc. Made that on a Psion series 3![]()
SRL is a Library of routines made by the SRL community written for the Program Simba.We produce Scripts for the game Runescape.
Thanks guys =)
I'm now trying to make a 3d fractal.
But it's never been done and its somewhat overwhelming
There are currently 1 users browsing this thread. (0 members and 1 guests)