Re: Re: drawing a generated bitmap



thank you for the answer :)

> Don't draw pixel by pixel, it would be awfully slow.
> Use GdkPixbufs and gdk_draw_pixbuf().

you mean "don't draw pixel by pixel using drawpoint", is that it?

> Something along these lines should be doable *if* you can
> get a indexed color visual, which you cannot count on.  So
> I would just redraw it (incidentally I develop a program
> which uses false-color maps a lot and redrawing works good
> enough).

that's a pity but i'll have to cope with that if there's no other way. 

however, i ran into a problem with colourmaps. i was using gdk.image (has the 
putpixel method which treats the colours in a more traditional way, and seems 
to be fast enough for my needs) but didn't manage to change the colours it 
uses. i keep getting a blue gradient which is not precisely what i want.
here's the code:

def img=Image(ImageType.Fastest,Visual.System,500,500);
for (mutable x=0, x<500; x++) for (mutable y=0; y<500; y++)
	img.PutPixel(x,y,(x+y):>UInt32);
		
def gc=GC(args.Event.Window);
mutable col=Color(0xff,0,0);
gc.Colormap.AllocColor(ref col,true,true);
img.Colormap=gc.Colormap;

args.Event.Window.DrawImage(gc,img,0,0,0,0,500,500);

i don't seem to be able to spot anything red in the result. could you please 
tell me what i am doing wrong?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]