Processing 의 New Tab 을 클릭하여 PrintIt 이라는 이름으로 새로운 탭 생성 후 다음 코드 입력

// //////////////////////////////////////////////////////////////////////////
// Printer - Jpg and Text (more can easily be implemented)
//
// PrintService http://java.sun.com/j2se/1.4.2/docs/api/javax/print/PrintService.html
// DocFlavor http://java.sun.com/j2se/1.4.2/docs/api/javax/print/DocFlavor.html
// PrintRequestAttributeSet http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/PrintRequestAttributeSet.html
// Attribute http://java.sun.com/j2se/1.4.2/docs/api/javax/print/attribute/Attribute.html
//
//
// Yonas Sandbæk - http://seltar.wliia.org
// //////////////////////////////////////////////////////////////////////////

import javax.print.*;
import javax.print.attribute.*;
import com.sun.image.codec.jpeg.*;

class PrintIt{
  PrintService[] services;
  PrintService service;
  DocFlavor docflavor;
  Doc myDoc;
  PrintRequestAttributeSet aset;
  DocPrintJob job;
  PrintIt(){
    myDoc = null;
    job = null;
    services = null;
    setService(PrintServiceLookup.lookupDefaultPrintService());
    setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
    aset =  new HashPrintRequestAttributeSet();
  }

  void setService(PrintService p)
  {
    service = p;
  }
 
  void setDocFlavor(DocFlavor d)
  {
    docflavor = d; 
  }

  void listPrinters(){
    services = PrintServiceLookup.lookupPrintServices(null, null);
    for (int i = 0; i < services.length; i++) {
    System.out.println(services[i].getName());
    DocFlavor[] d = services[i].getSupportedDocFlavors();
    for(int j = 0; j < d.length; j++)
      System.out.println("  "+d[j].getMimeType());
    }
    services = null;
  }

  // prints a given image
  void printJpg(PImage img){
    setDocFlavor(DocFlavor.BYTE_ARRAY.JPEG);
    print(bufferImage(img));
  }

  // prints a given string
  void printString(String s){
    setDocFlavor(DocFlavor.BYTE_ARRAY.AUTOSENSE);
    print(s.getBytes());
  }

  boolean print(byte[] b){
    if(!service.isDocFlavorSupported(docflavor)){
     println("MimeType: \""+docflavor.getMimeType()+"\" not supported by the currently selected printer");
     return false;
    }
   
    boolean ret = true;
    try{
    myDoc = new SimpleDoc(b, docflavor, null); 
    }
    catch(Exception e){
    println(e);
    ret = false;
    }   
   
    job = service.createPrintJob();
    try {
    job.print(myDoc, aset);
    }
    catch (PrintException pe) {
    println(pe);
    ret = false;
    }
   
    return ret;
  }
 
  // used with printJpg()
  byte[] bufferImage(PImage srcimg){
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BufferedImage img = new BufferedImage(srcimg.width, srcimg.height, 2);
    img = (BufferedImage)createImage(srcimg.width, srcimg.height);
    for(int i = 0; i < srcimg.width; i++)
    {
    for(int j = 0; j < srcimg.height; j++)
    {
      int id = j*srcimg.width+i;
      img.setRGB(i,j, srcimg.pixels[id]);
    }
    }
    try{
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam encpar = encoder.getDefaultJPEGEncodeParam(img);
    encpar.setQuality(1,false);
    encoder.setJPEGEncodeParam(encpar);
    encoder.encode(img);
    }
    catch(FileNotFoundException e){
    System.out.println(e);
    }
    catch(IOException ioe){
    System.out.println(ioe);
    }
    return out.toByteArray();
  }

}

사용될 메인 코드에서는 다음과 같이 사용하면 됩니다.

글로벌하게 PrintIt 의 인스턴스 생성
PrintIt p = new PrintIt();

draw() 안에 다음과 같이 작성, 특정키보드를 누르면 현재화면이 프린트 되도록 함
  if(keyPressed && key == 'p') p.printJpg(get(0,0,width,height));




Posted by 알 수 없는 사용자
Etc/참고2009. 4. 17. 22:21
오랜만에 글 올립니다. 이번 iamas dsp코스에서 2학년들이 한국에서 전시를 합니다.정확한 내용은 잘 모르겠지만
관심있는 분들은 가보세요. 전 일본에 있어 가보지 못하지만;;;
이곳 일본에서 재밌는 소식 있으면 또 올릴께요~
Exhibition Title:
HOME PARTY
Exhibition  :  Soongsil University BK21 Media Division + IAMAS DSP-Course

Venue:
Songwon Art Center
106-5 Hwa-dong Jongno-gu Seoul S.KOREA
+82 10 6472 7672

Time:
2009. 4. 25 (Sat) - 5. 3 (Sun)
11am - 6pm

*Opening Party 5pm, 25 April 2009

Artist:
Huibeom Yu  Junghwan Sung  CHEMICAL!  Melting Pot  LIM GhaEun  Yang HyunRoc  KIM Dongho Hoonida-Kim  Kitamura Yutaka  Tokisato Mitsuru  Kim dong kwan  Fujiyama Yukimasa Tsutusi kazutaka Ito Yuya

From the 25th of April to the 3rd of May, we will hold the joint
Korea-Japan exhibition "HOME PARTY" at the Sung-Won Art-Centre.
The artists are students from Soongsil University BK21 Media Division
(Korea) and IAMAS DSP Course (Japan).
In this exhibition "HOME PARTY", many artists from Korea and Japan,
coming from various backgrounds and with their own ways of artistic
expression, come together, and exhibit their works.
The concept of this event is that of "HOME PARTY", in which the audience
and artists meet and talk in a warm mood like 'a home party', where you
spend time together with friends and family with good food and drinks.
We hope our works triggers conversations between you and the artists,
and also between the artists themselves.

- - - - - - - - - -

IAMAS/DSP Lectures series 

4/27 10:00~16:00
Physical Computing
Speaker:Shigeru Kobayashi
Contents:
Designing of toolkits and workshops for physical computing to fill gaps between designers/artists and engineers

4/28 13:00~17:00
Art and Computer Vision
Speaker:PELLETIER JEAN-MARC
Contents:OpenCV

4/29 13:00~17:00
Mobility:The next generation of computing 1
Speaker:Masami Hirabayashi
Contents:CCCity Game
An iPhone/iPodTouch Application for
Creative Commons and a location-aware interface

Mobility:The next generation of computing 2
Speaker:Masayuki Akamatsu
Contents:iPhone as art platform
Posted by 알 수 없는 사용자
Research Topics/iPhone SDK2009. 4. 14. 18:30

iPhone SDK 의 MediaPlayer 를 사용하기 위해선 다음 두가지 프레임웍을 추가해줍니다.
AVFoundation.framework
MediaPlayer.framework



헤더파일에는 다음과 같이 MPMoviePlayerController 를 선언합니다.
MovieViewController.h
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>


@interface AboutViewController : UIViewController {
    MPMoviePlayerController *player;
}

@property (nonatomic, retain) MPMoviePlayerController *player;

- (IBAction)playVideoWithControls;
- (IBAction)playVideoWithoutControls;

@end

구현은 다음과 같습니다. 번들의 file 을 플레이하는 방식과 웹상의 URL 을 통한 스트리밍 방식 모두 가능합니다.
MovieViewController.m
#import "MovieViewController.h"


@implementation MovieViewController
@synthesize player;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"Movie Player";
   
    [self playVideoWithControls];
}


- (void)playVideoWithURL:(NSURL *)url showControls:(BOOL)showControls {
    if (!player) {
        player = [[MPMoviePlayerController alloc] initWithContentURL:url];
       
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlaying:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
       
        if (!showControls) {
            player.scalingMode = MPMovieScalingModeAspectFill;
            player.movieControlMode = MPMovieControlModeHidden;
        }
       
        [player play];
    }
}

- (IBAction)playVideoWithControls {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"test_movie" ofType:@"m4v"];

    NSURL *url = [NSURL fileURLWithPath:path];
    //NSURL *url = [NSURL URLWithString:@"http://cdsig.tistory.com/test_movie.m4v"];
   
    [self playVideoWithURL:url showControls:YES];
}

- (IBAction)playVideoWithoutControls {
    NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"test_movie" ofType:@"m4v"];
    NSURL *url = [NSURL fileURLWithPath:moviePath];
   
    [self playVideoWithURL:url showControls:NO];
}

- (void)didFinishPlaying:(NSNotification *)notification {
    if (player == [notification object]) {   
        [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];
        [player release];
        player = nil;
    }
    [self.navigationController popViewControllerAnimated:YES];

}


위의
didFinishPlaying 함수에서 MoviePlayer 종료시 후처리를 할 수 있습니다.
SDK 의 시뮬레이터에서 동영상이 플레이되지 않으면 DivX 등 기타 추가로 설치한 코덱을 지워주면 된다고합니다.


좀더 다양한 MoviePlayer 의 세부 컨트과 사용자 제작 그래픽의 영상 오버레이 처리 등은 iPhone Dev Center 의 Sample code 들 중 MoviePlayer 라는 샘플 코드를 보시면 됩니다.
Posted by 알 수 없는 사용자
Etc/site2009. 3. 16. 01:44
다들 안녕하세요~?

오랜만이죠~ ㅎㅎ

재밌는 사이트를 봐서요.

http://ge.ecomagination.com/smartgrid/#/landing_page

유명해서 이미 보신 분들도 많겠지만

GE에서 환경 관련하여 만든 마이크로 사이트인데

3D그래픽도 좋고 비쥬얼이 깔끔한것 같아요~

프로모션쪽 관심있다면 재미있게 볼것같아요.

긍금한건 AS 3.0과 영상으로 구현된건지 궁금해요

롤오버나 드래그 같은 인터렉션도 심플하지만 재미밌는것 같아서~~
Posted by 알 수 없는 사용자

인터넷에서 만난 문서입니다.
쭉 보면 PV3D에 대한 기본 개념을 잡는데 조금 도움이 될 것 같습니다.
근데 언어가 영어가 아닙니다. +_=;;;;...(그래도 그림도 잘되어 있고...코드는 영어니까~^^...)
Posted by chacolina