2009年6月4日木曜日

Hi, everyone!
I'd leave from Sendai. At tomorrow(today!?).
...today, I prepared about departure and I studied NSUserDefault class and NSMutableDictionary class.
I thought I can get a feature of "save" and "restore".
But I couldn't it.
NSUserdefault clas is can save and restore a data includes NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary.
I save the UIImage class object, but NSUserDefault class can't save the UIImage class object.
Therefore, I save a NSMutableDictionary class object includes the UIImage classobject.
But I couldn't.
NSUserDefault class could restore the NSMUtableDictionary object, but not UIIMage class object is include the NSMutableDictionary object.

mmm...

After all, I have to translate the UIImage class object to the NSdata class object.
I don't know about it,,,,,..
I'll confer to apple engineer in the WWDC2009.


I'll just have to keep working in the WWDC2009.

2009年6月3日水曜日

6/1

Good morning.
I prepared to the WWDC2009.

I proposed a Schedule(reserved a bus, action in Sunfransisco, and more) and prepared a lab session.
I'll have a talk to Apple engineers in lab session.
I made a data for lab session.
Because I'd like to get good answer in lab session, I made the earnest data.


I'll go to lab for I get best answer about problem of a Quartz2D(My application).

And I'll go to User Interface design lab session.
I study about it until attend the WWDC2009.

2009年6月2日火曜日

Good morning.
I studied about UI Design by pdf "iPhone Human Inter face Guidelines
", because I'll attend the "iPhone Interface Design Consulting Lab"
but I couldn't study hard, because I had to do other work.

I read some of pages only...

2009年6月1日月曜日

5/31

Good morning !
I solved most of yesterday problem.
I didn't know a content of unknown address at yesterday.
But I could know most of a real identity.
It's alpha value of pixel.
Each values(RGBA) are exist in the each address.
Please see below.
+-----+ _
|alpha| |
+-----+ |
|blue | |
+-----+ Current pixel
|green| |
+-----+ |
|red | |
+-----+ _
|alpha| |
+-----+ |
|blue | |
+-----+ Next pixel
|green| |
+-----+ |
|red | |
+-----+  ̄
| : |
| : |

So, these exist it seem above.
I tried change value of alpha.
But It's not complete.
I could get result see below.
Image1
Image2
Image1+2


These alpha value are 100/255.
About half pixels are transparent.
But remains aren't, more likely, these pixel are seem to broken.
I wouldn't fix it until the WWDC2009 started, because I can't fix it soon.
And I think I should study another that useful for attend WWDC2009.
I took the statistic about differential of touchMoved method count per 10 seconds.
My algorithm of the "Nazca(change name from"YubiFude")" uses three CGLayer objects (depend on the situation, sometime 4layers).
Application speed is slowed by number of layers.
I took the statistic about it.
Result is this.



As a result, application is slowed by increase layer.
It's increase about 20counts per 10seconds.
I'll ask to Apple company member about more good algorithm in WWDC2009.

2009年5月31日日曜日

Good morning!
I could study bitmap and prepare for the WWDC2009.

when I get and change an information of pixel, I used pointer to access the pixel.
information of pixel is 4 components.
but I use 3components, there are red, green, blue.
I didn't know another component.
I studied it.
I accessed the componets and change value(0~255).
this is a result.

probably, some of pixel data is bloken.
but I don't know it what identity yet.

Because of I‘m lacking skill of drawing emvironment, I'll study it by reference(quarz2d drawing guide).
I spent plenty of time analysys code.
I have to get knowledge about 2D Drawing.

****************************************************************
with only 8 days left until the WWDC2009 started!!
****************************************************************

2009年5月30日土曜日

I studied about a bit map at yesterday.
I understood a algorithm about the bitmap.
See code and explanation below.

*****************************************************************************
//This method is invoked when choose button clicked
- (void)imagePickerController:(UIImagePickerController*)picker
didFinishPickingImage:(UIImage*)image
editingInfo:(NSDictionary*)editingInfo
{
//Restore the buttons
statusButton.hidden = NO;
colorButton.hidden = NO;
fillColorButton.hidden = NO;
doneButton.hidden = NO;
allClearButton.hidden = NO;
layer1ClearButton.hidden = NO;
layer2ClearButton.hidden = NO;
layer3ClearButton.hidden = NO;
saveButton.hidden = NO;
loadButton.hidden = NO;

//Hide an ImagePickerView
[self dismissModalViewControllerAnimated:YES];

//Create a new UIImage object(originalImage) and substitude originalImage for choose Image.
UIImage* originalImage;
originalImage = [editingInfo objectForKey:UIImagePickerControllerOriginalImage];

//Create a new CGSize object(size) and initize it.it size is full screen size.
CGSize size = { 320, 480 };
//Creates a bitmap-based graphics context and makes it the current context.
UIGraphicsBeginImageContext(size);

//create a CGRect object for use drawInRect
CGRect rect;
rect.origin = CGPointZero;//(0, 0)
rect.size = size;
[originalImage drawInRect:rect];

//Get an image by use UIGraphicsGetImageFromCurrentImageContext method. //this method is Returns an image based on the contents of the current bitmap-based graphics context.
shrinkedImage = UIGraphicsGetImageFromCurrentImageContext();

//Removes the current bitmap-based graphics context from the top of the stack.
UIGraphicsEndImageContext();



//create the CGIMageRef(cgImage) object and institute cgImage for shrinkedImage.CGImage. //CGImage is UIImage class property. CGImageRef cgImage;
cgImage = shrinkedImage.CGImage;

// get an information about image //__SIZE_TYPE__ is macro and iqual to unsigned int //typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */ //typedef __darwin_size_t size_t; unsigned int width;//320
size_t height;//480
size_t bitsPerComponent;//8
size_t bitsPerPixel;//32
size_t bytesPerRow;//1280 = 4byte*320
CGColorSpaceRef colorSpace;
CGBitmapInfo bitmapInfo;//8193
bool shouldInterpolate;//true
CGColorRenderingIntent intent;//14081600

width = CGImageGetWidth(cgImage);
height = CGImageGetHeight(cgImage);
bitsPerComponent = CGImageGetBitsPerComponent(cgImage);
bitsPerPixel = CGImageGetBitsPerPixel(cgImage);
bytesPerRow = CGImageGetBytesPerRow(cgImage);
colorSpace = CGImageGetColorSpace(cgImage);
bitmapInfo = CGImageGetBitmapInfo(cgImage);
shouldInterpolate = CGImageGetShouldInterpolate(cgImage);//Returns the interpolation setting for a bitmap image.
intent = CGImageGetRenderingIntent(cgImage);//Returns the rendering intent setting for a bitmap image.
/*kCGRenderingIntentDefault, kCGRenderingIntentAbsoluteColorimetric, kCGRenderingIntentRelativeColorimetric, kCGRenderingIntentPerceptual, kCGRenderingIntentSaturation*/
// Create a dataProvider object and get a data provider
CGDataProviderRef dataProvider;// which you use to move data into and out of Quartz. // CGDataProviderRef allow you to supply Quartz functions with data.
dataProvider = CGImageGetDataProvider(cgImage);//Returns the data provider for a bitmap image.




//get an information about bit map datas
CFDataRef data;
data = CGDataProviderCopyData(dataProvider);//data = 614400byte = 153600(320*480)*4 //Returns a copy of the provider’s data.

//A reference to an immutable CFData object.
UInt8* buffer;//buffer is a pointer to UItnt8 //typedef unsigned char UInt8;

buffer = (UInt8*)CFDataGetBytePtr(data);
//Returns a read-only pointer to the bytes of a CFData object.

// give the effect of change color per pixel
NSUInteger i, j;
for (j = 0; j < i =" 0;" style="font-weight: bold; font-style: italic; color: rgb(255, 0, 0);"> // get the pointer information /*address space↓↓↓// //___________// //1pixel// //___________// //blue // //___________// //green // //___________// //red // //___________// //next pixel // //___________// //blue // //. // //. // //. */
UInt8* tmp;
tmp = buffer + j * bytesPerRow + i * 4;
//tmpはbufferのメモリ空間を頭から4バイトずつ移動しながらピクセルに効果を与えている。
// RGBの値を取得する
UInt8 r, g, b;
r = *(tmp + 3);//r
g = *(tmp + 2);//g
b = *(tmp + 1);//b

// 輝度値を計算する
UInt8 y;
y = (77 * r + 28 * g + 151 * b) / 256;//重み付きの平均値 /* この重み付きの平均値 gray は輝度と呼ばれるもので、カラーテレビの信号処理 に使われます。輝度は色の明るさを表します。  重みを付けて平均を取るのは、人の視覚は赤・緑・青に対してそれぞれ感度が異 なるためで、     青 < 赤 < 緑 の順に感度が高くなります。最も感度の高い色に重みを持たせています。 http://www.asahi-net.or.jp/~uc3k-ymd/Glib32/loadbmp.html*/ // 輝度の値をRGB値として設定する /*********ネガポジ************ *(tmp + 1) = 255-b;//b *(tmp + 2) = 255-g;//g *(tmp + 3) = 255-r;//r ***************************/

*(tmp + 3) = 0;//r
*(tmp + 2) = g;//g
*(tmp + 1) = 0;//b

}
}
*****************************************************************************
I could get the pixel data of image and various effect to image.
for example gray scale nega


I couldn't understand some a method.((UInt8*)CFDataGetBytePtr(data);)
I'll understand it.

2009年5月28日木曜日

Good morning!

I studied about the bitmap, color coponent and algorithm of my application.

I have problem about my application algorithm.

I use an UIImagePickerController class.

But this class has a few APIs, and it have no API that I want.

I'd like to a get feature that is invoked when cansel button clicked.


Thus I'll make the new method for myproblem is solved.


Next, about the bitmap, color coponent.

These needs knowledge of Quarts2D. 

I got a knowledge of premultiplied alpha value.

Use premultiplied alpha value, so speed up of render.

,,,reference say

"For bitmaps that have an alpha component, whether the color components are already multiplied by the alphavalue. Premultiplied alpha describes a source color whose components are already multiplied by an alpha value. Premultiplying speeds up the rendering of animage bye liminating an extra multiplication operation per color component. For example, inan RGB color space, rendering animage 
with premultiplied alpha eliminates three multiplication operations(red times alpha, green times alpha, 
and blue times alpha)for each pixel in the image."


Bitmap has a difficult  problem.

I studied how to change UIImage to bitmap, and change color component of pixel of  bitmap.

Today, I cold get knowledge the ,,,

size_t macro  a unsigned int.

y = (77 * r + 28 * g + 151 * b) / 256;←this code represent a brightness for human.

concept of pointer of C language.


********************************

I'll study about the bitmap component.

And I'll prepare the attend the technical lab at wwdc2009.