本文整理匯總了Golang中C.struct_jpeg_compress_struct.dest方法的典型用法代碼示例。如果您正苦於以下問題:Golang struct_jpeg_compress_struct.dest方法的具體用法?Golang struct_jpeg_compress_struct.dest怎麽用?Golang struct_jpeg_compress_struct.dest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類C.struct_jpeg_compress_struct
的用法示例。
在下文中一共展示了struct_jpeg_compress_struct.dest方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: makeDestinationManager
func makeDestinationManager(dest io.Writer, cinfo *C.struct_jpeg_compress_struct) (ret destinationManager) {
ret.magic = magic
ret.dest = dest
ret.pub.init_destination = (*[0]byte)(C.destinationInit)
ret.pub.empty_output_buffer = (*[0]byte)(C.destinationEmpty)
ret.pub.term_destination = (*[0]byte)(C.destinationTerm)
ret.pub.free_in_buffer = writeBufferSize
ret.pub.next_output_byte = (*C.JOCTET)(&ret.buffer[0])
cinfo.dest = &ret.pub
return
}
示例2: makeDestinationManager
func makeDestinationManager(dest io.Writer, cinfo *C.struct_jpeg_compress_struct) (ret *destinationManager) {
ret = (*destinationManager)(C.malloc(C.size_t(unsafe.Sizeof(destinationManager{}))))
if ret == nil {
panic("Failed to allocate destinationManager")
}
ret.magic = magic
ret.dest = dest
ret.pub.init_destination = (*[0]byte)(C.destinationInit)
ret.pub.empty_output_buffer = (*[0]byte)(C.destinationEmpty)
ret.pub.term_destination = (*[0]byte)(C.destinationTerm)
ret.pub.free_in_buffer = writeBufferSize
ret.pub.next_output_byte = (*C.JOCTET)(&ret.buffer[0])
cinfo.dest = &ret.pub
return
}
示例3: makeDestinationManager
func makeDestinationManager(dest io.Writer, cinfo *C.struct_jpeg_compress_struct) (mgr *destinationManager) {
mgr = new(destinationManager)
mgr.dest = dest
mgr.pub = C.malloc_jpeg_destination_mgr()
if mgr.pub == nil {
panic("Failed to allocate C.struct_jpeg_destination_mgr")
}
mgr.buffer = C.malloc(writeBufferSize)
if mgr.buffer == nil {
panic("Failed to allocate buffer")
}
mgr.pub.init_destination = (*[0]byte)(C.destinationInit)
mgr.pub.empty_output_buffer = (*[0]byte)(C.destinationEmpty)
mgr.pub.term_destination = (*[0]byte)(C.destinationTerm)
mgr.pub.free_in_buffer = writeBufferSize
mgr.pub.next_output_byte = (*C.JOCTET)(mgr.buffer)
cinfo.dest = mgr.pub
destinationManagerMapMutex.Lock()
defer destinationManagerMapMutex.Unlock()
destinationManagerMap[uintptr(unsafe.Pointer(mgr.pub))] = mgr
return
}