nanogui: Thread: GrArea and colours


[<<] [<] Page 1 of 1 [>] [>>]
Subject: GrArea and colours
From: Richard Kvalsvik ####@####.####
Date: 2 Nov 1999 14:07:06 -0000
Message-Id: <381EEE37.8AC8F23A@crusaders.no>

 Trying to write a 24-bit picture to a window here using RGB(); 

I think I am doing something terrible wrong, because it most certainly
crash.
But this wasn't documented anywhere, so I dont really know what to do.
here goes :


......loop......

     pixels[ j ] = NANOX_RGB( line[ j * 3 ], line[ (j * 3) +1 ], line[
(j * 3) +2 ]);

......loop end......


     GrArea( Nanox_GetWindowID(), Nanox_GetGCID(), x, y, width, height,
pixels  );


this seem to crash a lot most of the times.... what did I miss out ?

-- 	

Richard Kvalsvik
Subject: RE: GrArea and colours
From: Greg Haerr ####@####.####
Date: 2 Nov 1999 23:41:30 -0000
Message-Id: <01BF2550.ED11EE90.greg@censoft.com>

:      pixels[ j ] = NANOX_RGB( line[ j * 3 ], line[ (j * 3) +1 ], line[
: (j * 3) +2 ]);
: 
: ......loop end......
: 
: 
:      GrArea( Nanox_GetWindowID(), Nanox_GetGCID(), x, y, width, height,
: pixels  );

Nano-X doesn't really have good color image support.  There is not standard
format for color images.  Remember that the pixel[] value is a PIXELVAL and
is completely hardware device dependent.  That is, it is only
an RGB value when you are running 24 bit truecolor.  GrArea() was only
meant to paint the results of GrReadArea().

Look at the Microwindows code for DrawDIB(), and the corresponding
engine call DrawImage().

I also suggest you run the LINK_APP_WITH_SERVER=1 Makefile option.

Greg
Subject: Re: GrArea and colours
From: Alex Holden ####@####.####
Date: 3 Nov 1999 17:08:30 -0000
Message-Id: <Pine.LNX.4.04.9911031652560.743-100000@hyperspace>

---------- Forwarded message ----------
Date: 3 Nov 1999 13:20:01 -0000
From: Vidar Hokstad ####@####.####
To: ####@####.####
Cc: ####@####.#### ####@####.####
Subject: Re: GrArea and colours

On Wed, 03 Nov 1999 14:11:41 +0100 you wrote:

>**text-size - for positions. 
>  all text that is outputted is outputted in small chunks - 3 or 4 words 
>at a time. I have no idea how to  
>  calculate the width of a outputted line, and that causes large 
>spacings here and there since I assume  
>  a fixed length on all characters and i's are by far thinner than a M. 
>  Is there a quick way to calculate the pixel-width of a word ? 

There's two ways to do this:

GrGetFontInfo()     - This fills in a structure that includes the width of
every character.
GrGCTextSize()     - This calculates the width of a given string.

I suggest  using GrGetFontInfo(), since that can be done once for each font
used, and
then calculate the length "locally". It doesn't matter much when the app is
linked with  
Nano-X directly, but it is a LOT faster when using the network code.

Vidar.

[Cc:'d my answer to the mailing list since it doesn't contain any private
info...:) ]
 

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.