#import #import "Fraction.h"#import "Complex.h" int main( int argc, const char *argv[] ) { // create a new instance Fraction *frac = [[Fraction alloc] initWithNumerator: 1 denominator: 10]; Complex *comp = [[Complex alloc] initWithReal: 10 andImaginary: 15]; id number; // print fraction number = frac; printf( "The fraction is: " ); [number print]; printf( "\n" ); // print complex number = comp; ..
#import 대 #include: 위의 hello world 예제에서 눈치챘겠지만, 파일을 포함할 때 #import를 사용한다. #import는 gcc 컴파일러가 지원한다. 다만 #include를 더 선호하기 때문에 덜 사용되게 될 뿐이다. #import는 사용자가 만든 .h파일의 위와 아래에 #ifndef #define #endif 블럭을 붙이는 것과 같은 일을 한다. 이 블럭을 붙이는 건 정말 멍청한 짓이라고 생각하고, 아마 다른 모든 개발자들도 동의할 것이다. 따라서 그냥 #import를 사용하면 된다. 걱정할 필요도 없고, gcc에서 #import를 제거한다고 해도, 다른 오브젝티브-C 개발자들이 그런 일이 생기지 못하게 할 것이다. 공식적으로 애플에서 #import를 자신들의 코드에 사용하니,..
File dir = Environment.getExternalStorageDirectory();String path = dir.getAbsolutePath() + "/Download/SampleVideo_1280x720_50mb.mp4"; ImageView iv = (ImageView)findViewById(R.id.thumb);Bitmap b = ThumbnailUtils.createVideoThumbnail(path, MediaStore.Images.Thumbnails.MICRO_KIND);
Android-16에서 변경점: 구버전: 1. RSSurfaceView는 GLSurfaceView와 유사한 동작을 하며 GLRenderer를 set한다. 2. RenderScriptGL이라는 객체를 사용하며, GLSL shader program을 지원한다. 3. 2번과 연동되어 rsg_graphics.rsh를 지원하며 void main()대신에 int main()을 사용한다. 신버전: 1. RSSurfaceView, RenderScriptGL을 사용하지 않는다. 2. 따라서 GLSL을 사용하지 못하고 독자적으로 .rs에서 내장함수를 사용한다. 3. rsg_graphics.rsh를 사용할수 없다. int main()을 RenderScriptGL을 사용하지 않고는 call할 방법이 없다.
#include "rs_matrix.rsh" #pragma version(1) #pragma rs java_package_name(com.example.android.rs.hellocompute) float gFactor;// 0.0f: color, 1.0f: mono float3 m0 = {0.3588f, 0.7044f, 0.1368f}; float3 m1 = {0.2990f, 0.5870f, 0.1140f}; float3 m2 = {0.2392f, 0.4696f, 0.0912f}; void root(const uchar4 *v_in, uchar4 *v_out) { float4 f4 = rsUnpackColor8888(*v_in); float3 out; out.r = dot(f4.rgb, m0); ou..
- Total
- Today
- Yesterday