#include <acknex.h>
#include <default.c>
BMAP *bmp_nature = "NATURE.JPG";
BMAP *FIREFOX_3_bmap = "FIREFOX_3.JPG";
BMAP *bmp_box = "box.png" ;
PANEL *pan_bmp =
{
bmap = bmp_nature ;
flags = SHOW ;
//scale_x = 0.2 ;
//scale_y = 0.2 ;
}
void main()
{
// Wait for video functions to be ready
wait (1) ;
BMAP *bmp_to = pan_bmp->bmap ;
pan_bmp->pos_x = ( screen_size.x - bmap_width ( bmp_to ) ) * 0.5 ;
pan_bmp->pos_y = ( screen_size.y - bmap_height ( bmp_to ) ) * 0.5 ;
var format = bmap_lock ( bmp_to, 0 ) ;
if ( format > 565 )
{
int width = bmap_width ( bmp_to ) ;
int height = bmap_height ( bmp_to ) ;
int i = 0 ;
int j = 0 ;
COLOR vec_color ;
var pixel ;
var pixel_transparency;
for ( i = 0; i<width ; i++ )
{
for ( j = 0; j < height ; j++ )
{
pixel = pixel_for_bmap ( bmp_to, i, j ) ;
pixel_to_vec ( &vec_color, &pixel_transparency, format, pixel ) ;
vec_mul( &vec_color, vector ( 0.0721, 0.7154, 0.2125 ) ) ;
//vec_mul( &vec_color, vector ( 0.5, 0.587, 0.299 ) ) ;
//vec_mul( &vec_color, vector ( 0.3, 0.59, 0.11 ) ) ;
int gray = vec_color.red + vec_color.blue + vec_color.green ;
int red = (vec_color.red * .393) + (vec_color.green *.769) + (vec_color.blue * .189) ;
int green = (vec_color.red * .349) + (vec_color.green *.686) + (vec_color.blue * .168) ;
int blue = (vec_color.red * .272) + (vec_color.green *.534) + (vec_color.blue * .131) ;
pixel = pixel_for_vec ( vector( gray, gray, gray ), pixel_transparency, format ) ;
pixel_to_bmap ( bmp_to, i, j, pixel ) ;
}
}
}
bmap_unlock ( bmp_to ) ;
}