Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: BGRABitmap tutorial

  1. #1

    BGRABitmap tutorial

    Hello people.

    I've started a tutorial for BGRABitmap. It's a graphical library for Lazarus, that is used in LazPaint.

    It shows how to load and stretch images, use direct pixel access, combine layers, fill with gradients, use line styles and splines, generate textures with Perlin noise and render lighting with Phong shading.

    Each tutorial is accompanied by screenshots.

    http://wiki.lazarus.freepascal.org/BGRABitmap_tutorial

  2. #2
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Not a lazarus user myself, but nice stuff nonetheless...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  3. #3
    Interesting! It offers a lot more than the delphi VCL does, out of the box. (allthough delphi has it's own set of graphics libraries).

    I wonder how fast the library is. Has anyone ever done a stresstest?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Those are some pretty cool tutorials. I'm curious though, would these uses of the Bitmap object using the OS' GUI not be rather slow even on Windows Vista/7 or Mac OS X?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #5
    Quote Originally Posted by chronozphere View Post
    Interesting! It offers a lot more than the delphi VCL does, out of the box. (allthough delphi has it's own set of graphics libraries).

    I wonder how fast the library is. Has anyone ever done a stresstest?
    Well it depends. Some code could be optimized. It's all in Pascal, no assembler here.

    Quote Originally Posted by WILL View Post
    Those are some pretty cool tutorials. I'm curious though, would these uses of the Bitmap object using the OS' GUI not be rather slow even on Windows Vista/7 or Mac OS X?
    The point of BGRABitmap is to use TBitmap only when necessary. It uses a DIB section if possible, so it is kind of direct drawing. Specific code for a platform can be added to have DIB sections. It's already done for Windows and on GTK.

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Well your last 2 tutorials go into 3D stuff, so I was just wondering how practical all that would be if you decided to do some animation for visual effect. Is it worth it to try this for a nicer looking application GUI or would we just be better off using OpenGL or Direct3D instead?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7
    If you animate some phong buttons, it is very fast, but if you animate the whole screen, it is a little bit slow. So if you make some phong animation when the mouse moves over the controls, it would say it works.

    There is sample chart in testbgrafunc (it's in LazPaint archive). You can give it a try. You can see how smooth are the different capabilities of BGRABitmap.

  8. #8
    I'd like to play with this, but the FPC wiki seems to be down.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  9. #9
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    I was wondering about a water or ocean type effect on the background of the form or something like that. I think I know what the answer might be though.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  10. #10
    Quote Originally Posted by chronozphere View Post
    I'd like to play with this, but the FPC wiki seems to be down.
    Yes, unfortunately. You can still have a look at the bgrafunctest folder in LazPaint archive. You can find it here :
    http://sourceforge.net/projects/lazpaint/files/src/

    Quote Originally Posted by WILL View Post
    I was wondering about a water or ocean type effect on the background of the form or something like that. I think I know what the answer might be though.
    Well, it depends. You can precalculate an ocean texture. Then, just showing it is ok. But if you want to animate it, well, it would be too slow, except maybe with a very small texture.
    Last edited by circular; 09-04-2011 at 08:11 AM. Reason: link

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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