Skip to content

Commit ef554ee

Browse files
committed
Too many changes to list 'em all. Forcing to use two-sided pages is the
major one though.
1 parent 0f489ed commit ef554ee

File tree

6 files changed

+669
-834
lines changed

6 files changed

+669
-834
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
NOTE
2+
====
3+
4+
As of this commit all "pages" will be 2-sided. Meaning indices { 0, 2, 4, 6, ...}
5+
are front-facing and { 1, 3, 5, 7, ...} back-facing ones. This happens when page is on right side.
6+
On left side page is "flipped over" similarly as a page does on a regular book.
7+
8+
Here's an example video from cags12 showing 2-sided page support in landscape mode;
9+
[http://www.youtube.com/watch?v=iwu7P5PCpsw]
10+
111
Introduction
212
============
313
Project for implementing 'page curl' effect on Android + OpenGL ES 1.0 (possibly 1.1/2.0 too if there's clear advantage in using them).
@@ -121,5 +131,3 @@ Not to forget many of the true real-time rendering heros. One day We're about to
121131
* Rgba&Tbc - Elevated [http://www.youtube.com/watch?v=_YWMGuh15nE]
122132
* Andromeda&Orb - Stargazer [http://www.youtube.com/watch?v=5u1cqYLNbJI]
123133
* Cncd&Flt - Numb Res [http://www.youtube.com/watch?v=LTOC_ajkRkU]
124-
125-
// cags12 Edit: Added 2 pages landscape support - [http://www.youtube.com/watch?v=iwu7P5PCpsw]

project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-10
11+
target=android-8

src/fi/harism/curl/CurlActivity.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2011 Harri Smått
2+
Copyright 2012 Harri Smatt
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15-
*/
15+
*/
1616

1717
package fi.harism.curl;
1818

@@ -50,10 +50,7 @@ public void onCreate(Bundle savedInstanceState) {
5050

5151
// This is something somewhat experimental. Before uncommenting next
5252
// line, please see method comments in CurlView.
53-
mCurlView.setEnableTouchPressure(true);
54-
55-
// CAGS: This is to allow 2 pages landscape mode, set to false for legacy mode
56-
mCurlView.set2PagesLandscape(true);
53+
// mCurlView.setEnableTouchPressure(true);
5754
}
5855

5956
@Override
@@ -83,6 +80,21 @@ private class BitmapProvider implements CurlView.BitmapProvider {
8380

8481
@Override
8582
public Bitmap getBitmap(int width, int height, int index) {
83+
84+
// For every "odd" bitmap (back-facing ones); 1, 3, 5, 7... Return a
85+
// static few pixel default bitmap only.
86+
if ((index & 0x01) == 0x01) {
87+
final int colors[] = { 0xFF808080, 0xFFA0A0A0, 0xFFA0A0A0,
88+
0xFF808080 };
89+
Bitmap bitmap = Bitmap.createBitmap(colors, 2, 2,
90+
Bitmap.Config.ARGB_8888);
91+
return bitmap;
92+
}
93+
94+
// For front facing bitmaps (even ones) change index --> index / 2
95+
// --> 0, 1, 2, 3...
96+
index >>= 1;
97+
8698
Bitmap b = Bitmap.createBitmap(width, height,
8799
Bitmap.Config.ARGB_8888);
88100
b.eraseColor(0xFFFFFFFF);
@@ -122,7 +134,9 @@ public Bitmap getBitmap(int width, int height, int index) {
122134

123135
@Override
124136
public int getBitmapCount() {
125-
return mBitmapIds.length;
137+
// Number of bitmaps * 2 for we have mBitmapIds.length bitmaps +
138+
// same amount of static "back-facing" bitmaps.
139+
return mBitmapIds.length * 2;
126140
}
127141
}
128142

0 commit comments

Comments
 (0)