Color find

From Bennu Wiki
Jump to: navigation, search


Syntax

INT color_find ( <BYTE red> , <BYTE green> , <BYTE blue> )

Description

Match an RGB value to a particular palette index. This is usefull in 8 bit mode.

The previous name find_color() is deprecated.

Parameters

BYTE red - Level of red in the desired color from 0 to 255.
BYTE green - Level of green in the desired color from 0 to 255.
BYTE blue - Level of blue in the desired color from 0 to 255.

Returns

INT : Returns the palette inxed of the color that corresponds with the rgb combination.


Example

IMPORT "mod_say";
IMPORT "mod_debug";
IMPORT "mod_key";
IMPORT "mod_map";
IMPORT "mod_video";
IMPORT "mod_wm";
IMPORT "mod_draw";
IMPORT "mod_screen";
IMPORT "mod_text";

GLOBAL

   int map_id;    // id code of the map to load

   int status;    // status for debugging

   
PROCESS main();

BEGIN

   set_mode(320,200,32);
   
   // load the map
   map_id=load_map("3COCHE.MAP");
   
   status=color_find(0,0,0);
   say("color: "+status);
   status=color_find(0,252,0);
   say("color: "+status);
   status=color_find(0,67,0);
   say("color: "+status);
   status=color_find(0,243,0);
   say("color: "+status);
   status=color_find(0,10,0);
   say("color: "+status);
   status=color_find(255,252,0);
   say("color: "+status);
   status=color_find(100,252,100);
   say("color: "+status);
  
  
END


mod_map
Globals None
Imported:
FullscreenGraphmodeM7ScalemodeScaleresolutionScaleresolutionaspectratioScaleresolutionorientation
Constants BCLEARCHARSETCP850CHARSETISO8859GANIMATIONSPEEDGANIMATIONSTEPGANIMATIONSTEPSGCENTERXGCENTERYGDEPTHGFRAMESGHEIGHTGPITCHGWIDEGWIDTHGXCENTERGYCENTERNFBFIXEDWIDTHNFBVARIABLEWIDTH
Imported:
BABLENDBALPHABHMIRRORBNOCOLORKEYBSBLENDBTRANSLUCENTBVMIRRORDOUBLEBUFFERHWSURFACEM1024X768M1280X1024M320X200M320X240M320X400M360X240M376X282M400X300M512X384M640X400M640X480M800X600MODE16BITSMODE16BPPMODE2XSCALEMODE8BITSMODE8BPPMODEDOUBLEBUFFERMODEFRAMELESSMODEFULLSCREENMODEHARDWAREMODEMODALMODEWAITVSYNCMODEWINDOW
Functions Bdfload()Centerset()Colorfind()Colorsget()Colorsset()Fade()Fadeoff()Fadeon()Fntload()Fntnew()Fntsave()Fntunload()Fpgadd()Fpgdel()Fpgexists()Fpgload()Fpgnew()Fpgsave()Fpgunload()Getpixel()Glyphget()Glyphset()Graphicinfo()Graphicset()Mapblockcopy()Mapbuffer()Mapclear()Mapclone()Mapdel()Mapexists()Mapgetpixel()Mapinfo()Mapinfoget()Mapinfoset()Mapload()Mapname()Mapnew()Mapput()Mapputpixel()Mapsave()Mapsetname()Mapunload()Mapxput()Mapxputnp()Palclone()Paldel()Palget()Palload()Palmapassign()Palmapgetid()Palmapremove()Palnew()Palrefresh()Palsave()Palset()Palunload()Paletteconvert()Paletteroll()Pcxload()Pngload()Pngsave()Pointget()Pointset()Putpixel()Rgb()Rgbget()Rgba()Rgbaget()