summaryrefslogtreecommitdiffstats
path: root/o3d/samples/bitmap-draw-image.html
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 04:53:24 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 04:53:24 +0000
commit132899b905b0f1794d7e82e28f9fe77ca6a08282 (patch)
tree47af391191ac78d3b4e02533f74e3575970cebcc /o3d/samples/bitmap-draw-image.html
parent22e037073118aaf90549410b32d66885d39b78a9 (diff)
downloadchromium_src-132899b905b0f1794d7e82e28f9fe77ca6a08282.zip
chromium_src-132899b905b0f1794d7e82e28f9fe77ca6a08282.tar.gz
chromium_src-132899b905b0f1794d7e82e28f9fe77ca6a08282.tar.bz2
A step in exposing Bitmap to JavaScript.
The plan is to make pack.createBitmapFromRawData return an array of bitmaps. 1 bitmap if it's a standard 2d image 6 bitmaps if it's a cubemap N bitmaps if it's a volume map. The bitmaps will have a semantic so you can look at them and tell they were from a volumemap, a cubemap or a 2d image. On the way I'm attempting to clean up the code. Moving stuff out of Bitmap the did not belong there and Refactoring Bitmap so there are less If Format = stuff. Review URL: http://codereview.chromium.org/164034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/bitmap-draw-image.html')
-rw-r--r--o3d/samples/bitmap-draw-image.html32
1 files changed, 12 insertions, 20 deletions
diff --git a/o3d/samples/bitmap-draw-image.html b/o3d/samples/bitmap-draw-image.html
index 66471f1..1e3bac0 100644
--- a/o3d/samples/bitmap-draw-image.html
+++ b/o3d/samples/bitmap-draw-image.html
@@ -113,8 +113,6 @@ function makeShape(texture, effect) {
// Make a transform for each quad.
var transform = g_pack.createObject('Transform');
-
- transform.translate(0, 0, 0);
transform.scale(hScale, 1, vScale);
transform.addShape(myShape);
transform.parent = g_client.root;
@@ -184,34 +182,28 @@ function initStep2(clientElements) {
var bitmap2 = g_pack.createBitmapFromRawData(rawdata2);
var rawdata_hi = archiveInfo.getFileByURI('hi.jpg', true);
var bitmap_hi = g_pack.createBitmapFromRawData(rawdata_hi);
- var bitmap = g_pack.createBitmap(300, 300, g_o3d.Texture.XRGB8);
+ var texture = g_pack.createTexture2D(300, 300, g_o3d.Texture.XRGB8, 0,
+ false);
// draw image on bitmap.
// scale down on top left corner.
- bitmap.drawImage(bitmap1, 0, 0, 300, 300, 0, 0, 150, 150);
+ texture.drawImage(bitmap1, 0, 0, 300, 300, 0, 0, 150, 150, 0);
// scale up on top right corner.
- bitmap.drawImage(bitmap1, 0, 0, 100, 100, 150, 0, 150, 150);
+ texture.drawImage(bitmap1, 0, 0, 100, 100, 150, 0, 150, 150, 0);
// flip and draw part of the img on bottom left.
- bitmap.drawImage(bitmap1, 150, 0, 150, 150, 149, 299, -150, -150);
+ texture.drawImage(bitmap1, 150, 0, 150, 150, 149, 299, -150, -150, 0);
// draw out of boundary.
- bitmap.drawImage(bitmap1, 0, 0, 300, 300, 150, 150, 300, 300);
+ texture.drawImage(bitmap1, 0, 0, 300, 300, 150, 150, 300, 300, 0);
// draw o3d.
- bitmap.drawImage(bitmap_hi, 0, 0, 100, 50, 100, 125, 100, 50);
-
- var texture = g_pack.createTexture2D(300, 300, g_o3d.Texture.XRGB8,
- 0, false);
- if (texture) {
- // draw image on texture.
- texture.drawImage(bitmap, 0, 0, 300, 300, 0, 0, 300, 300, 0);
+ texture.drawImage(bitmap_hi, 0, 0, 100, 50, 100, 125, 100, 50, 0);
- // draw image on different mip-maps.
- texture.drawImage(bitmap1, 0, 0, 300, 300, 0, 0, 150, 150, 1);
- texture.drawImage(bitmap2, 0, 0, 2, 2, 0, 0, 75, 75, 2);
+ // draw image on different mip-maps.
+ texture.drawImage(bitmap1, 0, 0, 300, 300, 0, 0, 150, 150, 1);
+ texture.drawImage(bitmap2, 0, 0, 2, 2, 0, 0, 75, 75, 2);
- makeShape(texture, effect);
- }
+ makeShape(texture, effect);
}
}
- o3djs.event.addEventListener(o3dElement, 'wheel', scrollMe);
+ o3djs.event.addEventListener(o3dElement, 'wheel', scrollMe);
}
function scrollMe(e) {