![]() |
|
The part enlargement with stretch_blit |
Garnet
Member #5,816
May 2005
|
Using a stretch_blit, when expands bitmap "part" , it becomes stretching wrong w/h ratio and filled many black vertical lines. for( i = 0; i < 10; i++ ){ stretch_blit( bitmap , screen,0,i*12,bitmap->w,12,dx,dy,bitmap->w*2,12*2 ); }
This sample is 2times-expanding to screen which per height 12px slice parts from bitmap of source. I use Allegro 4.2.0 with Mac OSX 10.4.5 Your Regards. |
Thomas Harte
Member #33
April 2000
![]() |
Any chance of a screenshot? And how do you calculate dx, dy? I'm on OS X 10.4.5 also, and tried this: (EDIT: better example)
Which produced the expected: [My site] [Tetrominoes] |
Garnet
Member #5,816
May 2005
|
Thanks Thomas!
|
Thomas Harte
Member #33
April 2000
![]() |
The problem is that stretch_blit cannot convert from one colour depth to another while it is blitting. You place "set_color_depth(32);" after your call to set_gfx_mode, so what you effectively do is enter an 8bpp 640x400 graphics mode, then load your bitmap as a 32bpp image. This is therefore not a bug in Allegro in the sense of code that doesn't do what it should. The official advice is either to use the same colour depth of graphics mode and source bitmap for stretch blitting (i.e. move your set_color_depth to before your set_gfx_mode or else don't call it at all if you can live in 8bpp all the way through) or to stretch blit to an intermediate buffer that has the same colour depth as your source bitmap. Then blit that to the screen, as ordinary blit can convert from one colour depth to another whereas stretch_blit cannot. [My site] [Tetrominoes] |
Garnet
Member #5,816
May 2005
|
Thank you for your helpful advice. |
|