Skip to content

Instantly share code, notes, and snippets.

-(UIImage *) createARGBImageFromRGBAImage: (UIImage*)image
{ CGSize dimensions = [image size];
NSUInteger bytesPerPixel = 4;
NSUInteger bytesPerRow = bytesPerPixel * dimensions.width;
NSUInteger bitsPerComponent = 8;
unsigned char *rgba = malloc(bytesPerPixel * dimensions.width * dimensions.height);
unsigned char *argb = malloc(bytesPerPixel * dimensions.width * dimensions.height);
@phoenixxyang
phoenixxyang / customized_form.py
Created August 29, 2013 10:26
Django form: customize form style.
from django.forms import ModelForm, Textarea
from myapp.models import Author
class AuthorForm(ModelForm):
class Meta:
model = Author
fields = ('name', 'title', 'birth_date')
widgets = {
'name': Textarea(attrs={'cols': 80, 'rows': 20}),
}