1. RE: Palettes..GRAPHICS

Jordah,

Before I wrapped the DibDraw functions (in my small Dib functions 
library)I had looked at using all the usual palette functions as you 
have. I then realized that things were a whole lot simpler using 
DibDraw, albeit somewhat slower. Why don't you try using my Dib 
functions instead?

Regards,
Mike


jordah ferguson wrote:
> Hi All,
> 
>     Below is a 256 system palette(syspal) my routine creates. The 
> problem is that i have a 16 Color
> Video card. When i attempt to test it, it just gives me a black color 
> since my display device 
> cannot output more than 16 colors. I want to create a logical palette 
> for my draw window
> DC but with the GDI functions i have to fill in these bits as RGB 
> quads,CreatePalette,
> then SelectPalette() followed by RealizePalette().
> 
> 	The only helpful routine i have coded using the GDI routines to give me 
> 
> a palette
> is GetSystemPaletteEntries() which only gives me 16 colors as supposed 
> to. I know i can do this
> another way by simply enumerating the graphical solid pens but according 
> 
> to my predictions, is that
> this method will just simply return to me 16 colors......
> 
> I know there is a way things can be done and most colors shown on screen 
> 
> but how, is the problem
> for example i have AHA icon editor that displays all or most of the 256 
> colors. So how do they
> do it? to they directly do low-level stuff on the Display Card which GDI 
> 
> safely doesn't do? Also could some one create a loop either using 
> SetPixel or any other graphical
> functions using the system palette entries i have presented below and 
> tell me the 
> output is like... ie sufficient/lucks many other colors. Thanx.
> 
> Jordah Ferguson.
> 
> function RGB(sequence Triad)
>   return Triad[1] + 
> 	 Triad[2] * 256 + 
> 	 Triad[3] * 65536 
>   -- Triad[4] is flag; so ignored when getting COLORREF Value
> end function
> --------------------------------------------------------
> 
> function PeekPalette(atom addr,integer x)
>    sequence res
>    integer i i = 0
>    res = repeat(0,x)
>    for n = 1 to x-1 do
>       res[n] = RGB(peek({addr + i,4}))
>       i += 4
>    end for
>    res[x] = RGB(peek({addr + i,4}))
>    return res
> end function
> --------------------------------------------------------
> 
> global function GetSystemPaletteEntries(atom HDC,integer start,integer 
> n)
>   -- n is the number of palette entries you want to receive; i use 20 on 
> my PC
>   -- start is the index of the first color you want to receive from DC
>   -- HDC is the display Context of desired window
>    atom Pointer,x
>    sequence pal pal = {}
>    Pointer = allocate(4 * n)
>    x = c_func(zGetSystemPaletteEntries,{HDC,start,n,Pointer})
>    pal = PeekPalette(Pointer,n)
>    free(Pointer)
>    return pal
> end function
> -------------------------------------------------------
> 
> constant syspal = 
>   
> {#0,#2A0000,#2A00,#2A2A00,#2A,#2A002A,#152A,#2A2A2A,#151515,#3F1515,#153F15,
> 
> 
>
> #3F3F15,#15153F,#3F153F,#153F3F,#3F3F3F,#0,#50505,#80808,#B0B0B,#E0E0E,#111111,
> 
> 
>
> #141414,#181818,#1C1C1C,#202020,#242424,#282828,#2D2D2D,#323232,#383838,#3F3F3F,
> 
> 
>
> #3F0000,#3F0010,#3F001F,#3F002F,#3F003F,#2F003F,#1F003F,#10003F,#3F,#103F,#1F3F,
> 
> 
> #2F3F,#3F3F,#3F2F,#3F1F,#3F10,#3F00,#103F00,#1F3F00,#2F3F00,#3F3F00,#3F2F00,
> 
> 
>
> #3F1F00,#3F1000,#3F1F1F,#3F1F27,#3F1F2F,#3F1F37,#3F1F3F,#371F3F,#2F1F3F,#271F3F,
> 
> 
<snip>



vulcan at win.co.nz

new topic     » topic index » view message » categorize

2. RE: Palettes..GRAPHICS

Darn!!! how did i forget that lib?... thanx a lot mike.

I remember using it in my previous programs, i owe you one :P

Jordah

Mike wrote:
> Jordah,
> 
> Before I wrapped the DibDraw functions (in my small Dib functions 
> library)I had looked at using all the usual palette functions as you 
> have. I then realized that things were a whole lot simpler using 
> DibDraw, albeit somewhat slower. Why don't you try using my Dib 
> functions instead?
> 
> Regards,
> Mike
> 
> 
> jordah ferguson wrote:
> > Hi All,
> > 
> >     Below is a 256 system palette(syspal) my routine creates. The 
> > problem is that i have a 16 Color
> > Video card. When i attempt to test it, it just gives me a black color 
> > since my display device 
> > cannot output more than 16 colors. I want to create a logical palette 
> > for my draw window
> > DC but with the GDI functions i have to fill in these bits as RGB 
> > quads,CreatePalette,
> > then SelectPalette() followed by RealizePalette().
> > 
> > 	The only helpful routine i have coded using the GDI routines to give me 
> > 
> > 
> > a palette
> > is GetSystemPaletteEntries() which only gives me 16 colors as supposed 
> > to. I know i can do this
> > another way by simply enumerating the graphical solid pens but according 
> > 
> > 
> > to my predictions, is that
> > this method will just simply return to me 16 colors......
> > 
> > I know there is a way things can be done and most colors shown on screen 
> > 
> > 
> > but how, is the problem
> > for example i have AHA icon editor that displays all or most of the 256 
> > colors. So how do they
> > do it? to they directly do low-level stuff on the Display Card which GDI 
> > 
> > 
> > safely doesn't do? Also could some one create a loop either using 
> > SetPixel or any other graphical
> > functions using the system palette entries i have presented below and 
> > tell me the 
> > output is like... ie sufficient/lucks many other colors. Thanx.
> > 
> > Jordah Ferguson.
> > 
> > function RGB(sequence Triad)
> >   return Triad[1] + 
> > 	 Triad[2] * 256 + 
> > 	 Triad[3] * 65536 
> >   -- Triad[4] is flag; so ignored when getting COLORREF Value
> > end function
> > --------------------------------------------------------
> > 
> > function PeekPalette(atom addr,integer x)
> >    sequence res
> >    integer i i = 0
> >    res = repeat(0,x)
> >    for n = 1 to x-1 do
> >       res[n] = RGB(peek({addr + i,4}))
> >       i += 4
> >    end for
> >    res[x] = RGB(peek({addr + i,4}))
> >    return res
> > end function
> > --------------------------------------------------------
> > 
> > global function GetSystemPaletteEntries(atom HDC,integer start,integer 
> > n)
> >   -- n is the number of palette entries you want to receive; i use 20 on 
> > my PC
> >   -- start is the index of the first color you want to receive from DC
> >   -- HDC is the display Context of desired window
> >    atom Pointer,x
> >    sequence pal pal = {}
> >    Pointer = allocate(4 * n)
> >    x = c_func(zGetSystemPaletteEntries,{HDC,start,n,Pointer})
> >    pal = PeekPalette(Pointer,n)
> >    free(Pointer)
> >    return pal
> > end function
> > -------------------------------------------------------
> > 
> > constant syspal = 
> >   
> > {#0,#2A0000,#2A00,#2A2A00,#2A,#2A002A,#152A,#2A2A2A,#151515,#3F1515,#153F15,
> > 
> > 
> >
> > #3F3F15,#15153F,#3F153F,#153F3F,#3F3F3F,#0,#50505,#80808,#B0B0B,#E0E0E,#111111,
> > 
> > 
<snip>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu