[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2007-11-23T12:59:38-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/2451 2007-11-23T12:59:38-05:00 2007-11-23T12:59:38-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15698#p15698 <![CDATA[Well]]>
Some people index the RGB color settings for the bitmap first, so you have to find the start of the image data and remember where to start and finish. The color data usually ends at index 47 in SCREEN 12. 767 in 13. So the width is at 48 and the height is at 49. Or 0 and 1 with the default colors like you are probably using.

To find the end of the data, you have to read the array backwards until you find the first value above 0. To do that and be sure it is not just black, PSET(width, Height), 15 and GET the image again. You could also use POINT to find the lower right corner color attribute. I hope you only BSAVEd the image and not black parts of the screen. The original bitmap header gave you the width and height to GET.

Code:

IF POINT(width&, height&) = 0 THEN       PSET(width&, height&), 1      GET (width&, height&), Array(48)   '0 if no RGB values indexedEND IF
Then use a reverse loop to find values that are greater than 0.

Code:

FOR I = UBOUND(Array) to 0 STEP -1       IF Array(I) > 0 THEN maxindex = I : EXIT FORNEXT
Now you know the exact parts of the array that hold the data. You can then flip it, rotate it, whatever. To flip it, just read the array backwards.

Ted

Statistics: Posted by burger2227 — Fri Nov 23, 2007 12:59 pm


]]>
2007-11-20T18:40:14-05:00 2007-11-20T18:40:14-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15692#p15692 <![CDATA[Rotating a bit map image]]>
Yes! It would be incredibly inefficient to use rotation via angles when all you want to do is reverse bits
Yes, but using angles is more flexible. Angles can handle all rotations, while the flip/rotate loops can only handle eight directions. It's nice to say "rotate P(x1,y1) Φ? around P(x2,y2)." :)

Statistics: Posted by Mentat — Tue Nov 20, 2007 6:40 pm


]]>
2007-11-20T16:22:45-05:00 2007-11-20T16:22:45-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15691#p15691 <![CDATA[Rotating a bit map image]]>
Their should be a simpler way, I think. When you only want to rotate in angles that are multiplies of 90 degrees
Yes! It would be incredibly inefficient to use rotation via angles when all you want to do is reverse bits.

as Codemss demo aludes, you take bits

a b c d e
f g h i j
k l m n o

and simply do
e d c b a
j i h g f
o n m l k

Fast and perfect. Angles give approximations. They are when you actually want to rotate, say, 15 degrees.

Mac

Statistics: Posted by Mac — Tue Nov 20, 2007 4:22 pm


]]>
2007-11-20T11:32:06-05:00 2007-11-20T11:32:06-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15689#p15689 <![CDATA[Rotating a bit map image]]> Statistics: Posted by D.S — Tue Nov 20, 2007 11:32 am


]]>
2007-09-22T12:56:10-05:00 2007-09-22T12:56:10-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15287#p15287 <![CDATA[Rotating a bit map image]]> EXTREMELY useful for graphics. I forgot about flipping the For loops. That's more efficient.

Statistics: Posted by Mentat — Sat Sep 22, 2007 12:56 pm


]]>
2007-09-22T12:47:12-05:00 2007-09-22T12:47:12-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15286#p15286 <![CDATA[Rotating a bit map image]]> this looks a lot simpler, something that I can actually understand. YAY!

yea, i haven't been through trig yet...actually i'm taking it this year, so maybe i'll understand it then.

Statistics: Posted by Raspberrypicker — Sat Sep 22, 2007 12:47 pm


]]>
2007-09-22T11:38:39-05:00 2007-09-22T11:38:39-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15283#p15283 <![CDATA[Rotating a bit map image]]>
CLS
SCREEN 12
DEFINT A-Z
DIM map(3, 3)
DATA 2, 0, 0, 1
DATA 0, 177, 177, 0
DATA 0, 177, 177, 0
DATA 0, 4, 5, 0
FOR y = 0 TO 3
FOR x = 0 TO 3
READ map(x, y)
NEXT
NEXT

PRINT "Rotation = 0 degrees"
FOR x = 0 TO 3
FOR y = 0 TO 3
LOCATE y + 3, x + 1
PRINT CHR$(map(x, y))
NEXT
NEXT
PRINT

PRINT "Rotation = 90 degrees clockwise"
FOR x = 0 TO 3
FOR y = 0 TO 3
LOCATE y + 9, x + 1
PRINT CHR$(map(y, 3 - x))
NEXT
NEXT
PRINT

PRINT "Rotation = 180 degrees clockwise"
FOR x = 0 TO 3
FOR y = 0 TO 3
LOCATE y + 15, x + 1
PRINT CHR$(map(3 - x, 3 - y))
NEXT
NEXT
PRINT

PRINT "Rotation = 270 degrees clockwise"
FOR x = 0 TO 3
FOR y = 0 TO 3
LOCATE y + 21, x + 1
PRINT CHR$(map(3 - y, x))
NEXT
NEXT
PRINT

Statistics: Posted by Codemss — Sat Sep 22, 2007 11:38 am


]]>
2007-09-21T16:12:13-05:00 2007-09-21T16:12:13-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15278#p15278 <![CDATA[Rotating a bit map image]]>
But if all else fails, do it by hand. :)

Statistics: Posted by Mentat — Fri Sep 21, 2007 4:12 pm


]]>
2007-09-21T15:42:35-05:00 2007-09-21T15:42:35-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15277#p15277 <![CDATA[Rotating a bit map image]]>

thanx guys...if it doesn't work I'll come back to complain, hee-hee j/p

Statistics: Posted by Raspberrypicker — Fri Sep 21, 2007 3:42 pm


]]>
2007-09-20T06:13:57-05:00 2007-09-20T06:13:57-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15268#p15268 <![CDATA[Rotating a bit map image]]>

Code:

LET X=OX+(X-OX)*COS(A) ? (Y-OY)*SIN(A)LET Y=OY+(Y-OY)*COS(A)+(X-OX)*SIN(A)
This will rotate point(X,Y) around the point(OX,OY) by a counterclockwise angle of A (in radians)

Statistics: Posted by Mentat — Thu Sep 20, 2007 6:13 am


]]>
2007-09-20T02:12:48-05:00 2007-09-20T02:12:48-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15267#p15267 <![CDATA[Rotating a bit map image]]>
http://www.petesqbsite.com/sections/tut ... tation.txt
http://www.petesqbsite.com/sections/tut ... ation.html

Statistics: Posted by Guest — Thu Sep 20, 2007 2:12 am


]]>
2007-09-19T19:14:41-05:00 2007-09-19T19:14:41-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=15265#p15265 <![CDATA[Rotating a bit map image]]>
If I draw a car using a bit map, and then the car wants to go left. I need the front part of the car to face left then. So essentially, this would just be rotating the image.

Ex.

Code:

DATA 1,2,3,4DATA 1,2,3,4DATA 1,2,3,4DATA 1,2,3,4
turns into:

Code:

DATA 4,4,4,4DATA 3,3,3,3DATA 2,2,2,2DATA 1,1,1,1
Quite boring to re-type all this out, especially which bigger bitmaps, eh?
But if I must I must.

Statistics: Posted by Raspberrypicker — Wed Sep 19, 2007 7:14 pm


]]>