PDA

View Full Version : New plugin - PNG


mikedee
December 12th, 2006, 11:58 AM
There is a new plugin in head as of today, it is the png plugin.

It is needed to render the cube top image (or any image for that matter). Load it before decoration.

It is just a structural code thing but in case anyone starts getting missing images this is the reason.

PaK
December 12th, 2006, 12:26 PM
There is svg plugin too, but it seems that right now this plugin isnt in default list am i right ?

mikedee
December 12th, 2006, 12:43 PM
Yeah - I think that might be compiled if you use --enable-svg

I didnt mention it before because I didnt see it, but it makes sense now :)

PaK
December 12th, 2006, 01:06 PM
This two plugins can work together ?
Right now there is only one plugin that can write(png) and 2 plugins(png,svg) that can read right ?
If i will invoke writeImageToFile without loading png plugin it will do nothing, just return false, and for example in screenshot plugin invoking "screenshot" will raise error "failed to write screenshot image" on console.
So png plugin is adding pngImageToFile that will wrap imageToFile and if format will be png it will write image to png file on disk, if not it will return false. What will happen when i will write jpeg.c plugin and i will be using png and jpeg plguins with compiz ? How compiz will know what plugin to use ?

Sorry for bad english and for propably silly question, off ocurs i could check that :) How compiz works with whole plugin evironment but right now i dont have any compiz machine, all that i know is only theoretical :) and came from 4 days studing of compiz git.

Btw. it would be cool to write example plugin that is describing how plugins works and interact with each other.

mikedee
December 12th, 2006, 01:36 PM
These are all good questions for David, knowing him you will not have to worry about the image format, it will take care of it all for you. A quick post on the mailing list asking how these will work will be very useful for future documentation.

He may be half way through the changes, normally there is a quick post on the mailing list about 2 weeks after releasing the new plugin.

From my quick look at the code the image names are now specified without their extension, each image processing plugin will attempt to load the image name with their extension.

I suppose the order of the plugin loading has an impact if there are multiple files and multiple writers. The first plugin to return TRUE from the fileToImage function would have coped with it.

This is all just guess work though, its a bit hard to test without another writer plugin.

PaK
December 12th, 2006, 01:51 PM
So i suppose it will act in sth like that:

No image plugins:
WriteImageToFile->ImageToFile->False

Png plugin is loaded:
WriteImateToFile->ImateToFile(as pngImageToFile)->(True|False->Unwrap->ImateToFile->False)

Png plugins is loaded, jpeg plugin is loaded next to png:
WriteImateToFile->ImateToFile(jpegImageToFile)->(True|False->Unwrap->ImateToFile(pngImateToFile)->True|False->Unwrap->imageToFile->False)

It is acting like a heap, first plugin loaded is the last plugin that is used for writing file if any other doesn't match to output format. There is one exception of that, well if there is no jpeg plugin and format = "jpeg" file will be writed into png.

This is correct ?

mikedee
December 12th, 2006, 02:06 PM
Oops, just noticed that the imageToFile function has a format parameter. That looks like it is used to determine the format to be saved. The plugin should only try to save the file if it can save that format type.

When reading an image it looks like the first to read an image with that name wins, if one of those functions returns true then the subsequent plugins are not used because the extra unwrap->call->wrap is not executed.

PaK
December 12th, 2006, 02:08 PM
So Graph that i made is correct ? :)

mikedee
December 12th, 2006, 02:14 PM
Yes, I think its roughly the case, except if any of the functions return TRUE the chain is stopped.

PaK
December 12th, 2006, 02:26 PM
And first plugin loaded to compiz is King of Output, if there is no plugin that can handle format, first plugin will be "default format". Off cours if all plugins will be done simmilar to png.c :) that have "if (!status && file)" condition :)

Hehe this is something new for me, i really like it :) I never thought c would be for me such fascinating thing. Cant wait to install compiz on my machine and start hacking it :D