Color Palette

derez

Expert
Licensed User
Longtime User
Agraham & Klaus

I combined Agraham's ColorDialog and Klaus's ColorPalette module to one library.
I request your permission to publish it.
Thanks.

Edit:
The zip file contains dll & cs files, simple demo program which can be used to see the use of the few methods, and the palette.
The palette should be placed with the application or in directory "images" underneath.
Preset colors can be changed one at a time.
The lib is for use of Desktop and Device, tested for QVGA and VGA.

Edit: - ver 1.1, the palette is embeded in the code, and also I found that a desktop version is required for compilation.
 

Attachments

  • cp.jpg
    cp.jpg
    23.4 KB · Views: 52
  • CP 1.1.zip
    22.3 KB · Views: 86
Last edited:

ceaser

Active Member
Licensed User
Hi Derez

Thanks for the combined library. Just one question. Is it please possible to put the color palette in an imagelist so that it gets compliled with the program.

Regards
Michael
 

derez

Expert
Licensed User
Longtime User
Do believe me I wanted to do it when tackled with the folder and file icon images in TvDialog. I wanted the library to load the images from the Library directory to a imagelist and then use it.
I asked Erel how to do it and this is what he answered:
It is not possible to embed this files in the compiled executable without a user action (adding them to an Imagelist). These files are only added when you target smartphones and it is not configured.
If you like you can embed them in your DLL, however you will need to distribute the dll instead of compiling the code.

If someone will show me how - I'll be glad to do it.
 

agraham

Expert
Licensed User
Longtime User
You could always generate the bitmap yourself in the library if you really want to get rid of the file. An unoptimised algorithm is in the attached project. It's a bit slow in the IDE but runs in a flash when compiled.
 

Attachments

  • ColorBmp.sbp
    2.5 KB · Views: 23

derez

Expert
Licensed User
Longtime User
Thank you Agraham, I'll try to integrate it into the library.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Thank you Agraham but I used the existing private method in the library, and the bitmap creation is reduced to this piece of code :
B4X:
 this.palette = new Bitmap(120,120) ;// create the palette bitmap
 for (int h = 0;h <120;h++)
     for(int s = 0;s <120;s++)
       this.palette.SetPixel(h,s,HSLToRGB(h*2,240-s*2,120));

The library is updated to ver 1.1
 
Last edited:

aklisiewicz

Active Member
Licensed User
Longtime User
running DialogsDemo gives me an error:


Compiling code. Error
Error parsing program.
Error description: Unknown type: colordialog
Are you missing a library reference?
Occurred on line: 71
Dim cd As ColorDialog



Arthur
 
Top