Skip to content

Commit

Permalink
fixed some issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
KATAOKA,Atsushi committed Mar 7, 2011
1 parent 5ca00da commit c2fe20f
Show file tree
Hide file tree
Showing 3 changed files with 8,238 additions and 8,275 deletions.
19 changes: 7 additions & 12 deletions Classes/ComArmarkertiCameraView.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ - (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
return rotatedImage; return rotatedImage;
} }


- (void)addSubview:(UIView *)view
{
[super addSubview:view];
view.layer.anchorPoint = CGPointMake(0.5f, 0.5f);
}

#if !TARGET_IPHONE_SIMULATOR #if !TARGET_IPHONE_SIMULATOR
// Delegate routine that is called when a sample buffer was written // Delegate routine that is called when a sample buffer was written
- (void)captureOutput:(AVCaptureOutput *)captureOutput - (void)captureOutput:(AVCaptureOutput *)captureOutput
Expand Down Expand Up @@ -184,13 +190,7 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput
// Unlock the pixel buffer // Unlock the pixel buffer
CVPixelBufferUnlockBaseAddress(imageBuffer, 0); CVPixelBufferUnlockBaseAddress(imageBuffer, 0);


CGSize sz = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)); if (detector && detected_handler)
if(!detector)
{
return;
}

if (detected_handler)
{ {
NSMutableDictionary *args = [[NSMutableDictionary alloc] init]; NSMutableDictionary *args = [[NSMutableDictionary alloc] init];
NSMutableArray *markers = [[NSMutableArray alloc] init]; NSMutableArray *markers = [[NSMutableArray alloc] init];
Expand Down Expand Up @@ -259,11 +259,6 @@ - (void)drawRect:(CGRect)rect
return; return;
} }


for(UIView *subview in self.subviews)
{
subview.layer.anchorPoint = CGPointMake(0.5f, 0.5f);
}

CGContextRef context = UIGraphicsGetCurrentContext(); CGContextRef context = UIGraphicsGetCurrentContext();
CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)); CGRect imageRect = CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image));


Expand Down
14 changes: 7 additions & 7 deletions example/app.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Titanium.UI.setBackgroundColor('#000'); Titanium.UI.setBackgroundColor('#000');


var window = Titanium.UI.createWindow(); var window = Titanium.UI.createWindow();

var overlay = Titanium.UI.createView({ var overlay = Titanium.UI.createView({
center:{x:0, y:0}, center:{x:0, y:0},
width:82, width:82,
Expand All @@ -10,8 +11,8 @@ var overlay = Titanium.UI.createView({
borderRadius:12, borderRadius:12,
borderWidth:1, borderWidth:1,
borderColor:'#fff', borderColor:'#fff',
opacity:0.9, opacity:1,
visible:true visible:false
}); });
var label = Titanium.UI.createLabel({ var label = Titanium.UI.createLabel({
text:'a', text:'a',
Expand All @@ -25,11 +26,10 @@ overlay.add(label);
var armarker = require('com.armarkerti'); var armarker = require('com.armarkerti');
var cameraView = armarker.createCameraView({ var cameraView = armarker.createCameraView({
detected:function(e){ detected:function(e){
var found_a = false; var a_found = false;
for(var i in e.markers){ for(var i in e.markers){
var marker = e.markers[i]; var marker = e.markers[i];
if(marker.code == 0x9f9f) // is mark 'A'? if(marker.code == 0x9f9f) { // is mark 'A'?
{
var t = Ti.UI.create3DMatrix(); var t = Ti.UI.create3DMatrix();


t.m11 = marker.transform.m11; t.m11 = marker.transform.m11;
Expand All @@ -50,11 +50,11 @@ var cameraView = armarker.createCameraView({
t.m44 = marker.transform.m44; t.m44 = marker.transform.m44;


overlay.animate({ transform:t, duration:0 }); overlay.animate({ transform:t, duration:0 });
found_a = true; a_found = true;
break; break;
} }
} }
overlay.visible = found_a; overlay.visible = a_found;
} }
}); });
cameraView.add(overlay); cameraView.add(overlay);
Expand Down
Loading

0 comments on commit c2fe20f

Please sign in to comment.