Skip to content
Browse files

fixed some issues.

  • Loading branch information...
1 parent 5ca00da commit c2fe20f4a2357ae96f923980509202da6a1b1dca KATAOKA,Atsushi committed Mar 7, 2011
View
19 Classes/ComArmarkertiCameraView.m
@@ -125,6 +125,12 @@ - (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
return rotatedImage;
}
+- (void)addSubview:(UIView *)view
+{
+ [super addSubview:view];
+ view.layer.anchorPoint = CGPointMake(0.5f, 0.5f);
+}
+
#if !TARGET_IPHONE_SIMULATOR
// Delegate routine that is called when a sample buffer was written
- (void)captureOutput:(AVCaptureOutput *)captureOutput
@@ -184,13 +190,7 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput
// Unlock the pixel buffer
CVPixelBufferUnlockBaseAddress(imageBuffer, 0);
- CGSize sz = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
- if(!detector)
- {
- return;
- }
-
- if (detected_handler)
+ if (detector && detected_handler)
{
NSMutableDictionary *args = [[NSMutableDictionary alloc] init];
NSMutableArray *markers = [[NSMutableArray alloc] init];
@@ -259,11 +259,6 @@ - (void)drawRect:(CGRect)rect
return;
}
- for(UIView *subview in self.subviews)
- {
- subview.layer.anchorPoint = CGPointMake(0.5f, 0.5f);
- }
-
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image));
View
14 example/app.js
@@ -2,6 +2,7 @@
Titanium.UI.setBackgroundColor('#000');
var window = Titanium.UI.createWindow();
+
var overlay = Titanium.UI.createView({
center:{x:0, y:0},
width:82,
@@ -10,8 +11,8 @@ var overlay = Titanium.UI.createView({
borderRadius:12,
borderWidth:1,
borderColor:'#fff',
- opacity:0.9,
- visible:true
+ opacity:1,
+ visible:false
});
var label = Titanium.UI.createLabel({
text:'a',
@@ -25,11 +26,10 @@ overlay.add(label);
var armarker = require('com.armarkerti');
var cameraView = armarker.createCameraView({
detected:function(e){
- var found_a = false;
+ var a_found = false;
for(var i in e.markers){
var marker = e.markers[i];
- if(marker.code == 0x9f9f) // is mark 'A'?
- {
+ if(marker.code == 0x9f9f) { // is mark 'A'?
var t = Ti.UI.create3DMatrix();
t.m11 = marker.transform.m11;
@@ -50,11 +50,11 @@ var cameraView = armarker.createCameraView({
t.m44 = marker.transform.m44;
overlay.animate({ transform:t, duration:0 });
- found_a = true;
+ a_found = true;
break;
}
}
- overlay.visible = found_a;
+ overlay.visible = a_found;
}
});
cameraView.add(overlay);
View
16,480 ...codeproj/project.xcworkspace/xcuserdata/atsusy.xcuserdatad/UserInterfaceState.xcuserstate
8,224 additions, 8,256 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit c2fe20f

Please sign in to comment.
Something went wrong with that request. Please try again.