Menu

#36 create sub-bitmap of sub-bitmap

closed
nobody
Windows (54)
5
2012-10-09
2001-11-18
No

In Windows (MinGW, WinME) and allegro 3.9.40, creating
a sub-bitmap of a sub-bitmap doesn't work the same as
DOS (djgpp), the new bitmap is offset. Please see
example program below - the output should be a cross
in the centre of a box.

Peter

Discussion

  • Anonymous

    Anonymous - 2001-11-18

    Example C++ program

     
  • Robert J Ohannessian

    Logged In: YES
    user_id=41801

    It seems that the bug only affects the screen under Windows, and that hline and vline are working corectly. Here's another test code, which displays the problem in a better light. The light blue line and the circles should be drawn at the center of the screen (inside the sub-sub-bitmap) but they are not.

    <pre>

    include <allegro.h>

    int main()
    {
    BITMAP m, s;

    allegro_init();
    install_keyboard();
    set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
    
    m = create_sub_bitmap(screen, 160,120, 320, 240);
    s = create_sub_bitmap(m,       80, 60, 160, 120);
    
    rect(screen, 160,120, 160+320-1, 120+240-1, makecol(0, 255, 0));
    rect(screen, 160+80,120+60, 160+80+160-1, 120+60+120-1, makecol(0, 255, 0));
    
    rect(m, 0, 0, 319, 239, makecol(255, 0, 0));
    rect(s, 0, 0, 159, 119, makecol(255, 0, 0));
    
    line(s, 0, 0, 159, 119, makecol(255, 255, 255));
    line(s, 0, 0, 159, 119, makecol(0, 255, 255));
    
    circle(s, 80, 60, 30, makecol(255, 255, 0));
    circlefill(s, 80, 60, 20, makecol(255, 255, 0));
    
    hline(s, 1, 60, 158, makecol(128, 128, 255));
    
    readkey();
    
    set_gfx_mode(GFX_TEXT,0,0,0,0);
    return 0;
    

    } END_OF_MAIN();
    </pre>

     
  • Eric Botcazou

    Eric Botcazou - 2001-11-20

    Logged In: YES
    user_id=113920

    The fix is in the CVS tree, thanks to both of you for the
    report and the exegesis ;-)
    hline() and vline() were correctly working if the driver
    was hw-accelerated because they are hw-accelerated
    primitives, contrary to oblique lines and circles.

     
  • Eric Botcazou

    Eric Botcazou - 2001-11-20

    Logged In: YES
    user_id=113920

    The fix is in the CVS tree, thanks to both of you for the
    report and the exegesis ;-)
    hline() and vline() were correctly working if the driver
    was hw-accelerated because they are hw-accelerated
    primitives, contrary to oblique lines and circles.

     

Log in to post a comment.