Index: [thread] [date] [subject] [author]
  From: Marcus Sundberg <mackan@stacken.kth.se>
  To  : ggi-develop@eskimo.com
  Date: Thu, 13 May 1999 20:27:29 +0200

Re: Semi-Snag in PyGGI...

Jim Meier wrote:
> Sorry about that - just quick pseudocode. To make it make sense, the ggi_pixel p should
> be renamed this_is_the_pixel_to_copy_many_times and the ggi_pixel*p should be renamed to
> this_is_an_index_into_the_pixel_buffer.
> However, incorporating Evan Martin's fix of my broken pointer arithmetic, we end up
> with:
> 
> int block_size=(number_of_pixels*actual_pixel_size_in_bytes);
> ggi_pixel this_is_the_pixel_to_copy_many_times=ggiMapColor(vis, &color);
> ggi_pixel *pixel_buffer=(ggi_pixel*)malloc(block_size);
> uint8 *this_is_an_index_into_the_pixel_buffer=pixel_buffer
> for(i=0;i<number_of_pixels;i++){
> 
> *(ggi_pixel*)this_is_an_index_into_the_pixel_buffer=this_is_the_pixel_to_copy_many_times;
> 
>     this_is_an_index_into_the_pixel_buffer+=actual_pixel_size_in_bytes;
> }

Ok that will work in concept, as long as you have one version of the
loop for each of 8, 16, 24 and 32 bit/pixel modes, and make 
this_is_an_index_into_the_pixel_buffer a pointer to the apropriate
type.

But there is absolutely _no_ reason to do what you do above because
it will be upto one hundred times slower than using ggiDrawHLine/VLine.

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

Index: [thread] [date] [subject] [author]