256 palette 
Author Message
 256 palette

I'm still using vb3. does anybody have sample code to realize a palette for
a picture in a picturebox on a 256 color display. Or could any recommend a
book that covers the details with actual code examples. I find lots of
examples on the web for C but can't seem to find out how to do this from
Visual Basic and the API. Why isn't there a simple call to the API that says
"optimize the system palette for this picture.hdc". it seems like a very
fundamental thing to have the API do, right?

Any Help would be appreciated

Mark



Sun, 11 Mar 2001 03:00:00 GMT  
 256 palette
Do you have the windows reserved "20" colours in the palette ?

(first 10 and last 10 indexs)

This stops the dreaded palette flash on 256 colour resolutions.  If you want
to remap the bitmap to the current system palette it could look awful if the
user has a wierd background image selected.

Use PSP and decrease the colour depth to 256 colours and make sure that
"include windows colours" is ticked.

Might  / Might Not help you

Ta
Geoff

Quote:

>I'm still using vb3. does anybody have sample code to realize a palette for
>a picture in a picturebox on a 256 color display. Or could any recommend a
>book that covers the details with actual code examples. I find lots of
>examples on the web for C but can't seem to find out how to do this from
>visual basic and the API. Why isn't there a simple call to the API that
says
>"optimize the system palette for this picture.hdc". it seems like a very
>fundamental thing to have the API do, right?

>Any Help would be appreciated

>Mark



Sat, 17 Mar 2001 03:00:00 GMT  
 256 palette
Thanks for your reply Geoff

I don't know about PSP or where and how to change the windows palette using
vb3
I know it can be done with the API, but I've never been able to find enough
info or examples to do it.

I did come up with a work around that took me about 10 hours to finally
figure out.

because I'm using stretchblt and bitblt, I can't use an image control (which
always displays with the correct palette) Ive even tried to set the
image.picture to picture1.image and that would not work either.

The fix was to load the same picture into all 3 controls with loadpicture.
simply assigning each picture with the picture property of another simply
did not work, assigning it to a image property worked better but was still
not reliable when switching picture.

I needed 3 controls because
1. held the full size image which had to be save because final window is
resizable.
2. held the resized image as buffer for screen display while drawing
graphics on it.
3. the actual control the finished image was to be displayed in.

by using loadpicture for all 3 images there was a problem of the screen
control displaying the full size raw image. setting the control to invisible
did not work at all, even with a refresh and or doevent, what did work
though was to make the picture 1 x 1 before using loadpicture on it. then
resizing it and blting the finished frame onto it.

It is an ugly fix, having to load a large bitmap 3 times. wish I could have
just made a few API calls and just corrected the palette. but it did work.

Thanks again.



Sun, 18 Mar 2001 03:00:00 GMT  
 256 palette
PSP=Paint Shop Pro

A must have for any palette editing you need to apply to bitmaps.  Its
shareware but has a 30 day free trial.

What we do is:

1.  Load bitmap into PSP
2.  Increase the Colour Depth to 16 Million
3.  Reduce the colour depth to 256 colours and tell it to "include windows
colours"

At this point we can save the palette out to a .PAL file and re-apply the
palette to any other bitmaps used in the same app.

Hope that helps.

Geoff

PS.  Some delphi control icons (Eg. the up and down arrow spinner)  contains
palette info and{*filter*}s up the other palettes used in your app causing either
palette flash or completely messing it up.

Quote:

>Thanks for your reply Geoff

>I don't know about PSP or where and how to change the windows palette using
>vb3
>I know it can be done with the API, but I've never been able to find enough
>info or examples to do it.

>I did come up with a work around that took me about 10 hours to finally
>figure out.

>because I'm using stretchblt and bitblt, I can't use an image control
(which
>always displays with the correct palette) Ive even tried to set the
>image.picture to picture1.image and that would not work either.

>The fix was to load the same picture into all 3 controls with loadpicture.
>simply assigning each picture with the picture property of another simply
>did not work, assigning it to a image property worked better but was still
>not reliable when switching picture.

>I needed 3 controls because
>1. held the full size image which had to be save because final window is
>resizable.
>2. held the resized image as buffer for screen display while drawing
>graphics on it.
>3. the actual control the finished image was to be displayed in.

>by using loadpicture for all 3 images there was a problem of the screen
>control displaying the full size raw image. setting the control to
invisible
>did not work at all, even with a refresh and or doevent, what did work
>though was to make the picture 1 x 1 before using loadpicture on it. then
>resizing it and blting the finished frame onto it.

>It is an ugly fix, having to load a large bitmap 3 times. wish I could have
>just made a few API calls and just corrected the palette. but it did work.

>Thanks again.



Mon, 19 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Altering 256 Palette

2. Convert image from 16bpp to 256 palette

3. 256 Color Palette

4. Using 256 color Palettes in High/True Color

5. halftone palette/256 colors

6. choose a color in a 256 color palette ?

7. Custom 256-color palettes - how??

8. 256 color palette with VB controls

9. Still need help with palette for 256 color mode

10. 256-color palette in VB4 MDI Forms

11. Change Screen Color Palette from 256 to hi-color in VB

12. Create Palette (256 colors)

 

 
Powered by phpBB® Forum Software