Welcome, Guest. Please login or register.

Author Topic: Opinions please..  (Read 1909 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline OlleTopic starter

  • Newbie
  • *
  • Join Date: Jul 2002
  • Posts: 35
    • Show only replies by Olle
Opinions please..
« on: July 03, 2003, 02:29:49 PM »
Ok, so i have done some work with using tools on a screen, like drawing a rectangle to zoom in an area of a picture.

How do i preserve the background while drawing the rectangle?

I would love to use the COMPLEMENT mode, but it then doesn't allow me to use my own colour of the rectangle (as in windows)

So i wrote a class that had routines for storing the background in an virtual screen, and then cutting and pasting, it works but is slow as hell when drawing the rectangle over the whole screen, ofcourse it would be more clever just to store the backgrounds of the four lines, but how do i do it in a nice way?

Perhaps someone knows a better way to do it?

Thanks..


Shut up, bignose!  :-D
 

Offline xeron

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 2533
    • Show only replies by xeron
    • http://www.petergordon.org.uk
Re: Opinions please..
« Reply #1 on: July 03, 2003, 03:03:14 PM »
Hmnm... compliment mode is by far the fastest way to do it.. but you could have two bitmaps, one which is 2 pixels wide and the height of the screen, and one which is 2 pixels high, and the width of the screen.

Before drawing the lines, blit the left-line current contents to the left line in the vertical bitmap, and the right line current contents to the second line of the vertical bitmap (1,0). Do similar for the horizontals.

Make sure you allocate the bitmaps with your windows bitmap as a friend to ensure they are in the same format, and you can set displayable to keep it in video ram so that under P96 or CGX the graphics card blitter can be used. Just do an AllocBitMap(), then InitRastPort() a previously allocated rastport structure, and attach the bitmap to the rastport.

This should be quick, and not too memory hungry.
Playstation Network ID: xeron6
 

Offline OlleTopic starter

  • Newbie
  • *
  • Join Date: Jul 2002
  • Posts: 35
    • Show only replies by Olle
Re: Opinions please..
« Reply #2 on: July 03, 2003, 03:25:54 PM »
Thanks.. that was exactly what i needed.. ;)

I have been working too much with windows development so my brain is totally wrecked. :-D

Your solution is so obvious and clever.

Thanks m8...
 
Shut up, bignose!  :-D
 

Offline OlleTopic starter

  • Newbie
  • *
  • Join Date: Jul 2002
  • Posts: 35
    • Show only replies by Olle
Re: Opinions please..
« Reply #3 on: July 07, 2003, 11:16:14 PM »
Yepp, i have done it exactly this way and it works..  ;)

Almost...

When i have alot of colours on the screen and then draw my rectangle the background changes to another colour instead of preserving the original, even though i've set it as in the autodocs, for all planes like this...

BltBitMap(srcbmp,srcx,srcy,dstbmp,dstx,dsty,width,height,0xC0,0xFF,NULL);

This should ensure that all planes should be copied shouldn't it?

Note i run this through WinUAE since my std amiga doesn't allow higher rez than 640*480..

Any ideas?
Shut up, bignose!  :-D