From: Sormuras Newsgroups: comp.os.msdos.djgpp Subject: Allegro,bitmaps and SPEED Date: Mon, 27 Oct 1997 16:42:40 +0000 Organization: CTSR Lines: 51 Message-ID: <3454C480.2434@GMX.de> Reply-To: Sormuras AT GMX DOT de NNTP-Posting-Host: pppin68.koblenz.rhein-zeitung.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hello! I need a little help to do some speeding with allegro's bitmaps ... :) I want to draw a bitmap (c) onto another one (b) at the position (x,y). /*all the range checking is done*/ Bitmap (c) colors are to be interpretated as follows: pixel > 128 : add the difference to 128 pixel == 128 : leave pixel on (b) untouched pixel < 128 : decrement the diff to 128 // ...in a picture // // (b) + (c) -> (b') // // 2,3,4,3,2 126,128,128,128,126 0,3,4,3,0 // 2,3,4,3,2 127,128,128,128,127 1,3,4,3,1 // 2,3,4,3,2 127,128,130,128,127 1,3,6,3,1 // 2,3,4,3,2 127,128,128,128,127 1,3,4,3,1 // 2,3,4,3,2 126,128,128,128,126 0,3,4,3,0 // Here is my first attemp: //Yeah! I know, it's slow! That's why I'm writing! void add_relative (BITMAP *b, BITMAP *c, int x, int y) { int i,j,z; for ( j=0; j < c->h; j++ ) for ( i=0; i < c->w; i++ ) { z = _getpixel(b,i+x,j+y)+_getpixel(c,i,j)-128; if (zmax_value) z=max_value; _putpixel( b, i+x, j+y, z ); } } For every reply, many thanks in advance! -- Sormuras +--------------------------------------------------+ / // // //// /// // / / // /| *--------------------------------------------------+/| | e-mail : Sormuras AT GMX DOT de |/+ | homepage : http://homes.Rhein-Zeitung.de/~kstein |/ +--------------------------------------------------+