The hottest technology to display multiple color i

  • Detail

Technology of displaying multiple color images in Windows

Abstract This paper discusses the technology and implementation method of displaying multiple color images in the same window of windows, and provides an optimization program to compress the number of colors of the original image

keyword palette windows image processing

at present, most microcomputers are equipped with high-performance TVGA or SVGA graphics cards. Among these graphics cards, red, green and blue colors account for six respectively, and the total number of colors accounts for 18. Therefore, 262144 colors can be displayed, and even 24 bit true colors can be displayed in more advanced graphics cards. Using palette technology, 256 colors can be displayed in one window, and each image has 256 independent palettes. Changing the palette during display can meet the color requirements of each image

however, in some applications, it is required to display two or more color images in the same window. If according to the conventional design, only one image can be correctly displayed in the window, while the colors of other images will be confused because their palettes are changed. In our research, plastic additives are loaded and attached to the resin in an extraordinary amount to make the concentrate; When making plastic products, send the multimedia inquiry system - Shandong tourism resources inquiry subsystem, the system requires to take a color map of Shandong Province as the background, and then set a touch button in each tourist attraction. When the user touches the button, the importance and maintenance method of the automobile suspension torsion bar spring fatigue testing machine in the lower right part of the window will display the color image of the scenic spot. If the image is not specially processed, the color palette of the window is also changed while the color image of the scenic spot is displayed, so that the color of the background image is distorted. In order to solve this problem, we do special processing on the image, so that the background image and the color palette of each scenic spot image do not conflict. At the same time, we should also consider that windows occupies the first 20 color palettes, which are generally not allowed to be changed. According to the actual situation of the system, we have made the following layout of the palette: palette 0 ~ 19 is reserved for Windows system; Palette No. 20 ~ 148 is used for the background image, and once the background image is used, it will not be changed; Color palettes 149 to 255 are used for each scenic spot image. When different scenic spot images are displayed, these color palettes can be changed at any time. Define an array of paletteentry type palette[256] to store each color component. This type is a structure defined by windows:

typedef struct {

byte pered;

byte pegreen;

byte peblue;

byte peflags;

} paletteentry

in this way, put the palette 20 ~ 148 of the background image and the palette 149 ~ 255 of the scenic spot image into pal

ette[20] ~ palette[255] respectively, and then press the following steps implement the palette

1. Define HDC HDC; HPALETTE w-hp; LOGPALETTE *pal;

2. Assign a value of

pal= (nplogvalue) localalloc (lmem-fixed,

sizeof (logvalue) + 256*sizeof (paletteentry))

pal- palVersion=0300;

#include stdio. h

#include math. h

#include alloc. h

unsigned char palette[256][4];

long TAB[256];

unsigned char TT[256],BB[256];

int width,depth,bytes;

void zh_ Fan Tu (file *fp, int Color1, int color2)


unsigned char *p, *q, CC, ch;

long len;

int Max no, I, J, m, N, R0, B0, G0, R1, B1, G1;

double DD, Dmin;

char s[4];

max no=color2-color1+1;

for (i=0; I I i++) tab[i]=0;

p= (char *) malloc (bytes+1);

for (i=0; I depth; i++) {

causes sheet metal corrosion FREAD (P, bytes, 1, FP) ;


for (j=0;j bytes;j++,q++) if(j =width) break;

else {

ch=(unsigned char)*q;




for (i=0;i i++) tt[i]=(unsigned char)i;

for (i=0;i i++) for (j=i+1;j j++)

if (TAB[i] TAB[j])

len=TAB[i]; TAB[i]=TAB[

Copyright © 2011 JIN SHI