Esempio n. 1
0
BStream *BStream_clone(BStream *self)
{
	BStream *child = BStream_new();
	UArray_copy_(child->ba, self->ba);
	child->index = self->index;
	return child;
}
Esempio n. 2
0
void Image_makeRGBA(Image *self)
{
	if (self->componentCount == 3)
	{
		//Image_addAlpha(self);
		//printf("converted component count from 3 to 4\n");
	} 
	else if (self->componentCount == 1)
	{
		UArray *outUArray = UArray_new();
		UArray_setSize_(outUArray, 4 * self->width * self->height);
		uint8_t *outData = (uint8_t *)UArray_bytes(outUArray);
		uint8_t *inData  = (uint8_t *)UArray_bytes(self->byteArray);
		size_t numPixels = self->width * self->height;
		size_t p1;
		size_t p2 = 0;
		
		for (p1 = 0; p1 < numPixels; p1 ++)
		{
			outData[p2] = inData[p1]; p2 ++;
			outData[p2] = inData[p1]; p2 ++;
			outData[p2] = inData[p1]; p2 ++;
			outData[p2] = 255; p2 ++;
		}
		
		UArray_copy_(self->byteArray, outUArray);
		UArray_free(outUArray);

		self->componentCount = 4;
		//printf("converted component count from 1 to 4\n");
	}
}
Esempio n. 3
0
IO_METHOD(IoSeq, asFixedSizeType)
{
	/*doc Sequence asFixedSizeType
	Returns a new sequence with the receiver encoded in the 
	minimal fixed width text encoding that it's characters can fit 
	into (either, ascii, utf8, utf16 or utf32). 
	*/
	
	UArray *out = UArray_new();
	UArray_copy_(out, DATA(self));
	UArray_convertToFixedSizeType(out);	
	return IoSeq_newWithUArray_copy_(IOSTATE, out, 0);
}
Esempio n. 4
0
IoSymbol *IoSeq_newSymbolWithUArray_copy_(void *state, UArray *ba, int copy)
{
	IoObject *self = IoSeq_new(state);

	if (copy)
	{
		UArray_copy_(DATA(self), ba);
	}
	else
	{
		UArray_free(DATA(self));
		IoObject_setDataPointer_(self, ba);
	}

	return self;
}
Esempio n. 5
0
IoObject *IoAudioDevice_read(IoAudioDevice *self, IoObject *locals, IoMessage *m)
{
	/*doc AudioDevice asyncRead
	Returns the audio read buffer.
	*/

	AudioDevice *device = DATA(self)->audioDevice;
	UArray *rba = IoSeq_rawUArray(DATA(self)->readBuffer);
	UArray *ba;

	while (device->locked)
	{
		AudioDevice_nanoSleep(device);
	}

	ba = AudioDevice_read(device);
	UArray_copy_(rba, ba);

	return DATA(self)->readBuffer;
}
Esempio n. 6
0
void IoSeq_rawCopy_(IoSeq *self, IoSeq *other)
{
	UArray_copy_(DATA(self), DATA(other));
}
Esempio n. 7
0
void Image_copyUArray_(Image *self, UArray *ba) /* private */
{
	UArray_copy_(self->byteArray, ba);
}
Esempio n. 8
0
File: UArray.c Progetto: bomma/io
UArray *UArray_clone(const UArray *self)
{
	UArray *out = UArray_new();
	UArray_copy_(out, self);
	return out;
}