Page 2 of 2 FirstFirst 12
Results 26 to 35 of 35

Thread: Fractal drawer!

  1. #26
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Thanks IceFire!
    I did NewColor.BeginDrag(False, 0); instead of NewColor.BeginDrag(False, 32);
    I honestly don't know the difference, I just saw someone else use 32 before and figured it work.

  2. #27
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

  3. #28
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    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

  4. #29
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

  5. #30
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by almost View Post
    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

  6. #31
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

  7. #32
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    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.

  8. #33
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    This is really nice work!

  9. #34
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    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.

  10. #35
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks guys =)
    I'm now trying to make a 3d fractal.
    But it's never been done and its somewhat overwhelming

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •