Author Topic: Windows Experience.  (Read 22833 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #40 on: October 20, 2008 »
Hiya and thankyou Jim,

I wonder if you're not too busy and would be able to show me how to actually do the following for regions please matey? As Im a littlle bit lost on it. And it would help me tremendously!! :D

Quote
To get areas to show through your bitmap, create a rectangular region, then subtract away regions for the transparent colour.  I'd do this by, for each scanline of the image, create a 1 pixel high region for each of the non-seethrough runs of pixels and add it to an empty region using OR.  Repeat for each scanline.

[ edit ]
I've been looking through the source code to the Camouflage Music disk ( available from Rbraz.com ), and it looks as if there is a colour that it ignores as the main image used for the skin / window region just uses full green colour of 255 for the mask (hex: 00FF00 )? Reason I put this is as I can't find anything that is used in any way to mask any images in the drawing bits with that colour.

Also tried to look for stuff on MSDN, for text that appears when the mouse pointer is over a button, but don't know what area to look in. Have been there, and also dont a search but nothing.
[ /edit ]

Mighty thanks,
Clyde.
« Last Edit: October 21, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #41 on: October 23, 2008 »
To recap incase my topic was a bit of a mouthfull.

Am having difficulties with the following:

1 - Creating ( Button ) Regions with a routine that as suggested uses the scanline. And / Or any other method.

2 - Displaying the stored arrays image used for the main interface ( aka The Skin ) properlly with being able to see the desktop underneath with using a mask colour. Perhaps there is a default colour that windows automatically senses for this purpose.


Any joys anybody please dudes?

Cheers and humble thanks in advance,
Clyde.
« Last Edit: October 23, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #42 on: October 23, 2008 »
They are both the same problem.  I haven't had any time to work on it so if you want to work on it yourself you need to look at the windows Region API which is what we've all been looking at in the last couple of posts.
Before you look at the windows bit though, you need to build the shape which corresponds either to the solid or transparent areas of your background image (your choice, either can be made to work).  You can create it like this:  If you consider each scanline of your background image as a 1 pixel high rectangle, you should be able to create a bunch of rectangles which if you were to join them all together would cover your picture, minus the blank bits.  So you can get each row of the sprite which is your background and work on making rects for the solid bits.  The code might go like this:
Code: [Select]
for y=0 to height-1
if pixel[0][y]=background colour then
  inout=0 'transparent
else
 inout=1 'solid
endif
  start=0
for x = 1 to width-1
 if inout=1 and pixel[x][y]=transparent 'gone from solid to trans
   'make a rectangle from 'start' to x, y to y+1
 else if intout=0 and pixel[x][y]=solid ' gone from trans to solid
   start=x
 end if
next
if inout=1 then 'ended up solid, so make a rectangle to the rhs of the window
  'make a rectangle from 'start' to 'width'-1, y to y+1
end if
next

If you can work on making those rectangles, then I can show you how to make a Region from them and apply it to the window.

Jim

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #43 on: October 23, 2008 »
Thanks heaps for that Jim dude, and I fullly understand and appreciate your busy etc.

I shall get cracking and post up the routine based around the code above, as soon as i've done it, hopefully if there's anything wrong with it you'll be able to point it out for me.

Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #44 on: October 23, 2008 »
Ok here's the basis to the routine to make regions from an image as yet untested. All I've done is put in the rectangle stuff; looking forward to the next step of putting these to good use. As long as the routine looks ok that is?

Side Note: Im thinking this will apply for both a Window and a Button region; with a slight bit of modification (eg changing the routine name and the calls a tad ) And fingers crossed will allow for funky / non rectangular shaped designs?

Code: [Select]
Sub CreateRegionFromImage( ByVal Image As GFXBuffer Pointer, ByVal PosX As Integer, ByVal PosY As Integer )
   
    Dim As Integer inout, start, x, y
   
    Dim As Rect RegionRect
   
    For y=0 To Image->Height-1
       
        If Image->pixels[ (0+y)*Image->WWidth ]=Image->Mask Then
           
            '
            ' Transparent - is that the right term for this?
            '
            inout=0
           
        Else
            '
            ' Solid.
            '
            inout=1
       
        EndIf
       
        For x=1 To Image->WWidth-1
           
            '
            ' Gone From Solid To Transparent.
            '
            If inout=1 And Image->Pixels[ x+y*Image->WWidth ]=Image->Mask Then                 
                '
                ' Make a rectangle from 'start' to x, y to y+1
                '
                With RegionRect
                    .Left   =Start  +Image->PosX
                    .Top    =x      +PosX
                    .Right  =y      +PosY
                    .Bottom =(y+1)  +PosY
                End With
               
                '
                ' Gone From Transparent To Solid.
                '
                ElseIf inout=0 And Image->pixels[ x+y*Image->WWidth ]>0 And Image->pixels[ x+y*Image->WWidth ]<>Image->Mask Then start=x
                           
            EndIf
       
        Next
       
        '
        ' Ended Up As Solid, So Make A Rectangle To The Rhs( whats that? ) Of The Window.
        '
        If inout=1 Then
           
            '
            ' Make a rectangle from 'start' to 'width'-1, y to y+1
            '
            With RegionRect
                .Left   =Start              +PosX
                .Top    =(Image->WWidth-1)  +PosX
                .Right  =y                  +PosY
                .Bottom =(y+1)              +PosY
            End With
           
        End If

    Next
   
End Sub

[ Edit ]
I think I will create a tester program using TinyPTC for quickness.
Stay tooned.
[ /Edit ]

Cheers and big thanks,
Clyde.
« Last Edit: October 23, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #45 on: October 23, 2008 »
Looks hopeful!   Mocking it up in PTC so you can see it is an excellent idea.

Jim

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #46 on: October 23, 2008 »
Cheers matey, im almost done with it.
Something isnt quite right somewhere, going by the on screen results.
« Last Edit: October 23, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #47 on: October 23, 2008 »
Ok here it is; but doesnt behave properly as you'll see.

Thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #48 on: October 24, 2008 »
Why do you think it doesn't work?

You've got the tools to work it out.  One hint is I forgot to change 'inout' during the loop, but that's not all of the problem.

What is the bmp you are using?  There's no way to tell what the output should be from the .bas files.  How do you determine the mask colour?

rhs = right hand side.

Jim



« Last Edit: October 24, 2008 by Jim »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #49 on: October 24, 2008 »
With the Mask Color I manually add it to the loading of the image command for the which in this case is &HFF00FF. The GFXBuffer type stores this into the field mask. ( image->mask=mask )

Cheers and thanks,
Clyde.
« Last Edit: October 24, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #50 on: October 24, 2008 »
Main bug was in the rectangle routine!
Code: [Select]
'
' Regional Tester By Mr Clyde "Fuzzy Wuzzy" Radcliffe
' Image Loading & Drawing Routines (c) Gravity 2008
' Image Conversion Tools - BMP2RAW / Bin2Bas By Rbz - C0d1gos
'

Option Static
Option Explicit

#Include Once "Tinyptc_ext.bi"
#Include Once "Windows.bi"
#Include Once "crt.bi"

'#Include Once "Media\Button1R.bas"
'#Include Once "Media\Button1P.bas"

#Include Once "Media\Skin1R.bas"
#Include Once "Media\Skin1P.bas"

Const XRES=800
Const YRES=600

Type GFXBuffer
    wwidth As Integer
    height As Integer
    mask   As UInteger
    pixels As UInteger pointer
End Type

Dim Shared As GFXBuffer Pointer SkinBuffer, ScreenBuffer


Declare Sub DrawGFXBuffer( ByVal Dest   As GFXBuffer Pointer,_
                           ByVal Source As GFXBuffer Pointer,_
                           ByVal PosX   As Integer,_
                           ByVal PosY   As Integer )

Declare Sub DrawRegionFromImage( ByVal Dest     As GFXBuffer Pointer,_
                                 ByVal Image    As GFXBuffer Pointer,_
                                 ByVal PosX     As Integer,_
                                 ByVal PosY     As Integer )

Declare Sub DrawRectangle( ByVal Dest   As GFXBuffer Pointer,_
                           ByVal X0     As Integer,_
                           ByVal Y0     As Integer,_
                           ByVal X1     As Integer,_
                           ByVal Y1     As Integer )

Declare Sub InitializeTester()
Declare Sub RunTester()

Declare Function CreateGFXBuffer( Byval WWidth As Integer,_
                                  Byval Height As Integer,_
                                  ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
                         
Declare Function LoadGraphics8Bit( ByVal WWidth As Integer,_
                                   ByVal Height As Integer,_
                                   ByVal Raw    As UByte Pointer,_
                                   ByVal Palet  As UByte Pointer,_
                                   ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer


InitializeTester()
RunTester()


Sub DrawGFXBuffer( ByVal Dest   As GFXBuffer Pointer,_
                   ByVal Source As GFXBuffer Pointer,_
                   ByVal PosX   As Integer,_
                   ByVal PosY   As Integer )
                   
    Dim As Integer x,y
   
    For y=0 To Source->Height-1
        For x=0 To Source->WWidth-1
           
            Dest->Pixels[ x+y*Dest->WWidth ]=Source->Pixels[ x+y*Source->WWidth ]

        Next
    Next

End Sub


Sub DrawRectangle( ByVal Dest   As GFXBuffer Pointer,_
                   ByVal X0     As Integer,_
                   ByVal X1     As Integer,_
                   ByVal Y0     As Integer,_
                   ByVal Y1     As Integer )
   
    Dim As Integer x,y
    Dim As Integer StartX=X0, EndX=X1-1
    Dim As Integer StartY=Y0, EndY=Y1-1
   
    If StartX<0             Then StartX=0
    If EndX>=Dest->wwidth   Then EndX  =Dest->wwidth-1
   
    If StartX<=EndX Then
       
        If StartY<0             Then StartY=0
        If EndY>=Dest->height   Then EndY=Dest->height-1
       
        If StartY<=EndY Then
            For y=StartY To EndY
                For x=StartX To EndX
                    *( Dest->pixels+x+y*Dest->wwidth)=&HFF
                Next
            Next
       
        End if
   
    End if
   
End Sub


Sub DrawRegionFromImage( ByVal Dest     As GFXBuffer Pointer,_
                         ByVal Image    As GFXBuffer Pointer,_
                         ByVal PosX     As Integer,_
                         ByVal PosY     As Integer )
   
    Dim As Integer inout, start, x, y
   
    Dim As Rect RegionRect
   
    For y=0 To Image->height-1
       
        If Image->pixels[ 0+y*Image->WWidth ]=Image->Mask Then
           
            '
            ' Transparent - is that the right term for this?
            '
            inout=0
           
        Else
            '
            ' Solid.
            '
            inout=1
       
        EndIf
       
        start=0
       
        For x=1 To Image->WWidth-1
           
            '
            ' Gone From Solid To Transparent.
            '
            If inout=1 And Image->Pixels[ x+y*Image->WWidth ]=Image->Mask Then                 
               
                '
                ' Make a rectangle from 'start' to x, y to y+1
                '
                DrawRectangle( ScreenBuffer, Start+PosX, x+PosX, y+PosY, (y+1)+PosY )
               
                'With RegionRect
                '    .Left   =StartX  +Image->PosX
                '    .Top    =x      +PosX
                '    .Right  =y      +PosY
                '    .Bottom =(y+1)  +PosY
                'End With
               
                '
                ' Gone From Transparent To Solid.
                '
inout=0
            ElseIf (inout=0) And  (Image->pixels[ x+y*Image->WWidth ]<>Image->Mask) Then
Start=x
inout=1
            EndIf
       
        Next
       
        '
        ' Ended Up As Solid, So Make A Rectangle To The Rhs( whats that? ) Of The Window.
        '
        If inout=1 Then
           
            '
            ' Make a rectangle from 'start' to 'width'-1, y to y+1
            '
            DrawRectangle( ScreenBuffer, Start+PosX, (Image->WWidth-1)+PosX, y+PosY, (y+1)+PosY )
           
            'With RegionRect
            '    .Left   =Start              +PosX
            '    .Top    =(Image->WWidth-1)  +PosX
            '    .Right  =y                  +PosY
            '    .Bottom =(y+1)              +PosY
            'End With
           
        End If

    Next
   
End Sub


Sub InitializeTester()

    PTC_Open( "Tester", XRES, YRES )
   
    ScreenBuffer=CreateGFXBuffer( XRES, YRES )

    SkinBuffer=LoadGraphics8Bit( 512, 256, @Skinmk1r(0), @skinmk1p(0), &HFF00FF )
   
End Sub


Sub RunTester()
   
    Dim Key As String
   
    While Key<>Chr(27)
       
        DrawGFXBuffer       ( ScreenBuffer, SkinBuffer, 0, 0 )
        DrawRegionFromImage ( ScreenBuffer, SkinBuffer, 0, SkinBuffer->height )
       
        PTC_Update @(ScreenBuffer->Pixels[0])
   
        Key=Inkey()
   
    Wend
   
End Sub


Function CreateGFXBuffer( Byval WWidth As Integer,_
                          Byval Height As Integer,_
                          ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
   
    Dim As GFXBuffer Pointer Buffer=Callocate(Len( GFXBuffer )+Len( UInteger )*WWidth*Height)
   
    Buffer->wwidth=WWidth
    Buffer->height=Height
    Buffer->mask  =Mask
    Buffer->pixels=Cast( UInteger Pointer, Cast( Byte Pointer, Buffer )+Len( GFXBuffer ))
   
    Function=Buffer
   
End Function


Function LoadGraphics8Bit( ByVal WWidth As Integer,_
                           ByVal Height As Integer,_
                           ByVal Raw    As UByte Pointer,_
                           ByVal Palet  As UByte Pointer,_
                           ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
                                   
    Dim As GFXBuffer Pointer Buffer=CreateGFXBuffer( WWidth, Height, Mask )

    Dim As UInteger pal(0 to 255)
    Dim As Integer a,x,y

    '
    ' Retrieve Palette Info.
    '
    For a=0 to 255
        pal(a)=(palet[a*3] Shl 16) Or (palet[a*3+1] Shl 8) Or(palet[a*3+2])
    Next   
   
    '
    ' Make Image Based On Colour Indexing With The Raw values.
    '
    For y=0 to Height-1
        For x=0 to WWidth-1
            Buffer->Pixels[ x+y*WWidth ]=Pal(Raw[x+y*WWidth])
        Next
    Next
   
    Function=Buffer
   
End Function

Pretty eh?

Jim
« Last Edit: October 24, 2008 by Jim »
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #51 on: October 24, 2008 »
Code: [Select]
'
' Regional Tester By Mr Clyde "Fuzzy Wuzzy" Radcliffe
' Image Loading & Drawing Routines (c) Gravity 2008
' Image Conversion Tools - BMP2RAW / Bin2Bas By Rbz - C0d1gos
'

Option Static
Option Explicit

#Include Once "Tinyptc_ext.bi"
#Include Once "Windows.bi"
#Include Once "crt.bi"

'#Include Once "Media\Button1R.bas"
'#Include Once "Media\Button1P.bas"

#Include Once "Media\Skin1R.bas"
#Include Once "Media\Skin1P.bas"

Const XRES=800
Const YRES=600

Type GFXBuffer
    wwidth As Integer
    height As Integer
    mask   As UInteger
    pixels As UInteger pointer
End Type

Dim Shared As GFXBuffer Pointer SkinBuffer, ScreenBuffer


Declare Sub DrawGFXBuffer( ByVal Dest   As GFXBuffer Pointer,_
                           ByVal Source As GFXBuffer Pointer,_
                           ByVal PosX   As Integer,_
                           ByVal PosY   As Integer )

Declare function DrawRegionFromImage( ByVal Dest     As GFXBuffer Pointer,_
                                 ByVal Image    As GFXBuffer Pointer,_
                                 ByVal PosX     As Integer,_
                                 ByVal PosY     As Integer ) as HRGN

Declare Sub DrawRectangle( ByVal Dest   As GFXBuffer Pointer,_
                           ByVal X0     As Integer,_
                           ByVal Y0     As Integer,_
                           ByVal X1     As Integer,_
                           ByVal Y1     As Integer )

Declare Sub InitializeTester()
Declare Sub RunTester()

Declare Function CreateGFXBuffer( Byval WWidth As Integer,_
                                  Byval Height As Integer,_
                                  ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
                         
Declare Function LoadGraphics8Bit( ByVal WWidth As Integer,_
                                   ByVal Height As Integer,_
                                   ByVal Raw    As UByte Pointer,_
                                   ByVal Palet  As UByte Pointer,_
                                   ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer


InitializeTester()
RunTester()


Sub DrawGFXBuffer( ByVal Dest   As GFXBuffer Pointer,_
                   ByVal Source As GFXBuffer Pointer,_
                   ByVal PosX   As Integer,_
                   ByVal PosY   As Integer )
                   
    Dim As Integer x,y
   
    For y=0 To Source->Height-1
        For x=0 To Source->WWidth-1
           
            Dest->Pixels[ x+y*Dest->WWidth ]=Source->Pixels[ x+y*Source->WWidth ]

        Next
    Next

End Sub


Sub DrawRectangle( ByVal Dest   As GFXBuffer Pointer,_
                   ByVal X0     As Integer,_
                   ByVal X1     As Integer,_
                   ByVal Y0     As Integer,_
                   ByVal Y1     As Integer )
   
    Dim As Integer x,y
    Dim As Integer StartX=X0, EndX=X1-1
    Dim As Integer StartY=Y0, EndY=Y1-1
   
    If StartX<0             Then StartX=0
    If EndX>=Dest->wwidth   Then EndX  =Dest->wwidth-1
   
    If StartX<=EndX Then
       
        If StartY<0             Then StartY=0
        If EndY>=Dest->height   Then EndY=Dest->height-1
       
        If StartY<=EndY Then
            For y=StartY To EndY
                For x=StartX To EndX
                    *( Dest->pixels+x+y*Dest->wwidth)=&HFF
                Next
            Next
       
        End if
   
    End if
   
End Sub


Function DrawRegionFromImage( ByVal Dest     As GFXBuffer Pointer,_
                         ByVal Image    As GFXBuffer Pointer,_
                         ByVal PosX     As Integer,_
                         ByVal PosY     As Integer ) as HRGN
   
    Dim As Integer inout, start, x, y
   
    Dim As Rect RegionRect
   
    Dim reg as HRGN

reg = CreateRectRgn(0,0,0,0)

    For y=0 To Image->height-1
       
        If Image->pixels[ 0+y*Image->WWidth ]=Image->Mask Then
           
            '
            ' Transparent - is that the right term for this?
            '
            inout=0
           
        Else
            '
            ' Solid.
            '
            inout=1
       
        EndIf
       
        start=0
       
        For x=1 To Image->WWidth-1
           
            '
            ' Gone From Solid To Transparent.
            '
            If inout=1 And Image->Pixels[ x+y*Image->WWidth ]=Image->Mask Then                 
               
                '
                ' Make a rectangle from 'start' to x, y to y+1
                '
                DrawRectangle( ScreenBuffer, Start+PosX, x+PosX, y+PosY, (y+1)+PosY )
               
                With RegionRect
                    .Left   =Start  +PosX
                    .Right  =X      +PosX
                    .Top    =Y      +PosY
                    .Bottom =y+1  +PosY
                End With
CombineRgn(reg,reg,CreateRectRgnIndirect(@RegionRect),RGN_OR)
               
                '
                ' Gone From Transparent To Solid.
                '
inout=0
            ElseIf (inout=0) And  (Image->pixels[ x+y*Image->WWidth ]<>Image->Mask) Then
Start=x
inout=1
            EndIf
       
        Next
       
        '
        ' Ended Up As Solid, So Make A Rectangle To The Rhs( whats that? ) Of The Window.
        '
        If inout=1 Then
           
            '
            ' Make a rectangle from 'start' to 'width'-1, y to y+1
            '
            DrawRectangle( ScreenBuffer, Start+PosX, (Image->WWidth-1)+PosX, y+PosY, (y+1)+PosY )
           
            With RegionRect
                .Left   =Start              +PosX
                .Right  =(Image->WWidth-1)  +PosX
                .Top    =y                  +PosY
                .Bottom =y+1              +PosY
            End With
    CombineRgn(reg,reg,CreateRectRgnIndirect(@RegionRect),RGN_OR)           
        End If

    Next

    return reg
   
End Function


Sub InitializeTester()

    PTC_Open( "Tester", XRES, YRES )
   
    ScreenBuffer=CreateGFXBuffer( XRES, YRES )

    SkinBuffer=LoadGraphics8Bit( 512, 256, @Skinmk1r(0), @skinmk1p(0), &HFF00FF )
   
End Sub



Sub RunTester()
   
    Dim Key As String
Dim win as HWND

win = ptc_getwindow()

'SetWindowLong(win, GWL_EXSTYLE, WS_EX_COMPOSITED)
'SetWindowLong(win, GWL_STYLE, WS_POPUP Or WS_VISIBLE)
        SetWindowRgn(win, DrawRegionFromImage ( ScreenBuffer, SkinBuffer, 0, 0), True)
   
    While Key<>Chr(27)
       
        DrawGFXBuffer       ( ScreenBuffer, SkinBuffer, 0, 0 )
        'DrawRegionFromImage ( ScreenBuffer, SkinBuffer, 0, 0 )
       
        PTC_Update @(ScreenBuffer->Pixels[0])
        Key=Inkey()
   
    Wend
   
End Sub


Function CreateGFXBuffer( Byval WWidth As Integer,_
                          Byval Height As Integer,_
                          ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
   
    Dim As GFXBuffer Pointer Buffer=Callocate(Len( GFXBuffer )+Len( UInteger )*WWidth*Height)
   
    Buffer->wwidth=WWidth
    Buffer->height=Height
    Buffer->mask  =Mask
    Buffer->pixels=Cast( UInteger Pointer, Cast( Byte Pointer, Buffer )+Len( GFXBuffer ))
   
    Function=Buffer
   
End Function


Function LoadGraphics8Bit( ByVal WWidth As Integer,_
                           ByVal Height As Integer,_
                           ByVal Raw    As UByte Pointer,_
                           ByVal Palet  As UByte Pointer,_
                           ByVal Mask   As UInteger=0 ) As GFXBuffer Pointer
                                   
    Dim As GFXBuffer Pointer Buffer=CreateGFXBuffer( WWidth, Height, Mask )

    Dim As UInteger pal(0 to 255)
    Dim As Integer a,x,y

    '
    ' Retrieve Palette Info.
    '
    For a=0 to 255
        pal(a)=(palet[a*3] Shl 16) Or (palet[a*3+1] Shl 8) Or(palet[a*3+2])
    Next   
   
    '
    ' Make Image Based On Colour Indexing With The Raw values.
    '
    For y=0 to Height-1
        For x=0 to WWidth-1
            Buffer->Pixels[ x+y*WWidth ]=Pal(Raw[x+y*WWidth])
        Next
    Next
   
    Function=Buffer
   
End Function
Here it is with the region being created and applied.  If you move this code back in to your proper framework it will fix up the offsets and overlap problems.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #52 on: October 27, 2008 »
Cheers Jim, and yep it does look pretty cool. Will have a play around putting this into the framework during tommorrow. Obviously I will return with questions etc, when I hit a dead end.

Hugest of thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #53 on: October 29, 2008 »
For any of those that are secretly following this, I will be back to this in a few days. Just got some stuff to deal with first at the moment.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #54 on: November 04, 2008 »
Righty-o Im back in the land of windows coding again,

This time I have attempted but not very succesfully in creating a region for the window. If you run the attached source it will need you to run task manager and stop the process; as there is something a foot in the listing.

I also would like to know how to omit the mask colour from being drawn, once the region bug has been splatted.

Once this is succesfull, I will then proceed with applying the same technique to the buttons creation.

Cheers and huge thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Windows Experience.
« Reply #55 on: November 04, 2008 »
Sorry dude, I got nothing but this :

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #56 on: November 04, 2008 »
Yep; you wont see anything dude, as there's something wrong in the code.
btw If you use -s gui ( switch gui ), you'll stop getting the command box.
« Last Edit: November 04, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Hezad

  • Sponsor
  • Pentium
  • *******
  • Posts: 613
  • Karma: 44
  • I believe .. in Patrick.
    • View Profile
    • Hezad.com Web hosting
Re: Windows Experience.
« Reply #57 on: November 04, 2008 »
oh okay  ;D

yeah just noticed "but not very succesfully" ><

..

Well .. I can't help then, sorry :P


Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Windows Experience.
« Reply #58 on: November 04, 2008 »
Thanks for your interest and response dude, appreciate you having a look.

Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Windows Experience.
« Reply #59 on: November 04, 2008 »
I can't see anything with or without the call to ApplyWindowRegion!

Jim

Challenge Trophies Won: