Announcement

Collapse
No announcement yet.

Rendering bitmaps in ellipses

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rendering bitmaps in ellipses

    For astronomical purposes ( I have written a fair good gravity integrator in Powerbasic) i want to use pictures op planets to fill in ellipses .
    This works quite well till now as I use the "GRAPHIC RENDER Bitmap$" command . However the planets are represented as a square till now .
    Any Idea how I can fit and draw the planets picture in its ellipse ?
    Some of the Win32Api. may apply .
    To give some idea about the programs performance you can visit the www.orbitsimulator.com site .
    Many thanks . Frank Kestens.

  • #2
    There are different ways to accomplish this.

    One is to use the TransparentBlt API function to draw the bitmap. You will need to create a memory DC, select the bitmap into that DC and then use this function to do a transparent Blt from the memory DC to the Graphic control.

    A second technique for images which have a fixed shaped, like a circle or ellipse, is to select a clipping region into the graphic controls DC which only allows the part of the image you want to be drawn and then BitBlt the image like usual. Windows will clip the rest of the image out. You can create a circular region using CreateEllipticRgn and then select it into a DC using SelectObject to define a clipping region.
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      Originally posted by Chris Boss View Post
      There are different ways to accomplish this.

      One is to use the TransparentBlt API function to draw the bitmap. You will need to create a memory DC, select the bitmap into that DC and then use this function to do a transparent Blt from the memory DC to the Graphic control.

      A second technique for images which have a fixed shaped, like a circle or ellipse, is to select a clipping region into the graphic controls DC which only allows the part of the image you want to be drawn and then BitBlt the image like usual. Windows will clip the rest of the image out. You can create a circular region using CreateEllipticRgn and then select it into a DC using SelectObject to define a clipping region.
      Thanks for the prompt answer !
      I guess to do so I need BitBlt.inc , right ? Where can I find this ?

      Comment


      • #4
        BitBlt and TransparentBlt should be defined in the win32api.inc file.
        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment


        • #5
          Originally posted by Chris Boss View Post
          BitBlt and TransparentBlt should be defined in the win32api.inc file.
          Thanks .
          I'm not familiar with the Win32 instructions .
          How might the code be , given a bitmap$ ?

          Comment


          • #6
            >I'm not familiar with the Win32 instructions



            (Reading the WinAPI documentation IS a skill you WILL need to master, so you may as well start now).
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X