what do you mean by offset? how
Printable View
what do you mean by offset? how
If you consider it like a string rather than a picture, how would you move the first two letters to the back of a string? There are several ways to do it, and some are better than others, but simple will be good enough for now.
--
Mats
so i could use >> operator,
say data = data >> 3
?
oh i was just reading up on the >> operator.
for the string thing i would get the first character them move to last character.
for a 5 item array.......
so array[0] moves to array[4]
but am not sure on how to say move
M-N?
i think
help :(
well i think id take the last column in the array and move it to the first if i was to scroll right, but im still like confused on exactly how to do it, need a hint.
how would i set it to another area
cant i do something like using the >> operator?
The >> operator is essentially a divide by a power of 2, so for example x >> 3 is the same as x / (2 * 2 * 2), which turns out as x / 8. It doesn't do anything useful on strings (or any other arrays).
[In C++ the >> operator, and the complementary << operator, are used as a way to input and output (respectively) data from/to the console, as alternatives to scanf and printf - but in standard C, that's not meaningful at all. ]
--
Mats
hmmm, i dont know then how i can do it.
I need some help on this pls.
how to i move the colums to the other end for horizontal scroll?
Start by writing a piece of code to scroll a piece of text around, based on:
str: char array with text in it.
n = strlen(str);
m = some number you've given.
write a function
scroll(str, n, m)
that modifies by str "rotating" it M steps.
If you can't do that, it's no point in trying to get that working on an image - it will just be much harder to figure out what's going on, because you won't be bale to immediately spot what's going wrong. Once you can do that, just change the scroll to take pixels (ints) instead of chars, or rows of pixels instead of chars for the vertical scroll, and you have your function ready to go.
--
Mats
IS something like this adequate for image scrolling procedure :
Code:Image_horiscroller(INTEGER image_olddata[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], INTEGER
width, INTEGER height, INTEGER horiscroll)
INTEGER * image_data[EP100_LIB_MAX_X][ EP100_LIB_MAX_Y]
INTEGER i, j
FOR (i <1
TO i<= width) DO
FOR (j <1
TO j<=height) DO
IF ((i + horiscroll)> width) THEN
image_data * [i+horiscroll100]
<image_
olddata[i]
ELSE IF ((i + horiscroll)<0 THEN
image_data * [i+horiscroll+100] <image_
olddata[i]
ELSE
image_data * [i+horiscroll] <image_
olddata[i]
ENDIF
ENDIF
ENDIF
END_Image_horiscroller
Image_vertiscroller(INTEGER image_olddata[EP100_LIB_MAX_X][EP100_LIB_MAX_Y], INTEGER
width, INTEGER height, INTEGER vertiscroll)
INTEGER image_data * [EP100_LIB_MAX_X][ EP100_LIB_MAX_Y]
INTEGER i, j
FOR (i <1
TO i<= height) DO
FOR (j <1
TO j<=width) DO
IF ((i + vertiscroll)> height) THEN
image_data * [i+vertiscroll100]
<image_
olddata[i]
ELSE IF ((i + vertiscroll)<0 THEN
image_data * [i+vertiscroll+100] <image_
olddata[i]
ELSE
image_data * [i+vertiscroll] <image_
olddata[i]
ENDIF
ENDIF
ENDIF
END_Image_vertiscroller
There seems to be a constant 100 in there that I don't quite understand the meaning of.
--
Mats