dzImage Library

klaus

Expert
Licensed User
Longtime User
Hello dzt
Thank's for your information, I already had some of them but it's always interesting to have several sources. But I left for the moment the save ICO function besides, because as you say it needs some deep diving into it.
The Icon Editor has improved,
- almost all the drawing functions work as I want them to do
- edit functions copy, paste, cut also undo, redo not yet done.
- save and load bmp, jpg and gif was quite easy with your library and the ImageLib.
Load ICO I will look at Erel's code.
Save ICO is the challenge for the next days.
I don't want to send the code as long as the save ICO functon is not implemented to ensure that the program does at least the basic functions that it is made for.
And of course I want to make the icon for this program with itself !
And just another screenshot.

Klaus
Switzerland
 

Attachments

  • IconEdit1.jpg
    IconEdit1.jpg
    27.7 KB · Views: 24

dzt

Active Member
Licensed User
1. Rotation Angle 0 blacks out the screen or image control.
2. While running fine in the IDE, the exe sometimes prompts
"Invalid Pixel Format" error upon InvertImage.
3. Also upon Invert, the desktop shows correct, while the device does
not invert (perhaps I am seeing things the wrong way round).

Hello Robert,

1. Solved (I think). Actualy Angle 0 returns the image as it was. Did you expect anything else?
2 & 3. Can you post a simple code with an image that acts like you are describing?

I hope these bugs does not affect your accomodation proposal.
:)
 

derez

Expert
Licensed User
Longtime User
Dimitris
I am afraid to ask for anything because you just sit down to work on it.
The fast rotate is fast and I managed to have the map oriented with the heading quite quickly.
I am still fighting with the size of the result because, if I understand correctly, the copying to the form may change the size, not to let the image "spill over the sides".
In my program I drawimage the map, after sizing it to the required size, with the left top corner somewhere above and to the left of the form. This way the form gets the part of the map which it should get according to the right position. I use drawimage because I need the x,y,width and height definitions, but drawimage works on forms only.
When I rotate the image from the form - it works only on the part that is on the form, while I need also the surrounding parts which should be on the form after the rotation. If there is a way to do it I will not have to play with the resizing.
Take few days off before you answer...:sign0188:

Robert
This program works with raster maps, not vectors, and is for off-road navigation. The program I saw doing it is for the same use, actually I "borrowed" some ideas from it. That program was for WM 2003 and is not maintained any more.
 

derez

Expert
Licensed User
Longtime User
colors

dimitris (or any other who can help)
Well I solved the sizing issue, taking a smaller width and height of the map before the rotation, so that after rotated it matches the form width.

Still, there is a strange behaviour of the color of the part which is not the map - the color is changing all the time. In the thumbnail you can see example with two different colors. I shall appreciate an advice, I think it has to do with the pixel at 0,0 but I need help in this.

Thanks again.
 

Attachments

  • gray.JPG
    gray.JPG
    30.3 KB · Views: 31
  • g2.JPG
    g2.JPG
    25.5 KB · Views: 40

derez

Expert
Licensed User
Longtime User
I Have found how to control the color also - it is the color of the pixel at the top-left of the image I take to rotate.
So I color this pixel before I take the image.:)
 

alfcen

Well-Known Member
Licensed User
Longtime User
Hello Dimitris,

The most important issue first: no affect on your accommodation ;)

I attached the whole prototype.
In there, blur.sbp demonstrates the "Clear Screen"
method using Rotation = 0. Please ignore the Blur function, it's a joke :)

As for item 2, please select Offline, pick an image, press the palette button
(rainbow icon) and then [N] for negative. Here I find

IDE: ok
desktop EXE Ver 6.01: Invalid Pixel Format
desktop EXE Ver 5.8: ok
device: ok

My desktop runs XP Home Edition.

Each image is 480 x 480, a palette image is 300 x 10 pixels

Enjoy playing with the program, eeh, prototype.
I can wait for the answer until next year :cool:

Edit: Sorry mate, I forgot, in chosa.sbp please REM the line Registration in App_Start.
 
Last edited:

dzt

Active Member
Licensed User
Hi guys,

derez, I'm glad you are having progress. You are right about Pixel(0,0). It's colour is used to fill the empty space. The same technique is used by the new (2008) CombineImagesHorizontal and CombineImagesVertical functions.

klaus, my daughter already waits for your paint program:)

Robert, nice blur func... eeh joke! I've allready implemented a CreteEmptyImage (like clear) function. The issue about InvertImage solved. The problem was the 1 byte per pixel format. One a have to say. I wish I had astronomy as a hobby to use your software.

Next update 2008 (I mean GMT+2 2008 not GMT+9)

Are there any other issues before I'll post the update?

I wish you to enjoy 2008 much more than 2007.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Haisai Dimitris,

With resolving the InvertImage issue there is nothing more I could wish for.
As you have seen, I used a different approach for magnification, reason
being, I saw "Out of Memory" errors on the device beyond 140% using
ZoomImage. There was no such error on the desktop - naturally :)

Astronomy is part of human exploration. Just raise your eyes up
during a clear night and enjoy what you see. Whatever you are looking
at you are seeing the past. The "Great Orion Nebula" is 1,500 light-years
away. You are looking at an object as it was 1,500 years ago.
And...most constellations were born from Greek mythology, a most valuable
heritage.

All the very best!
Robert
 

derez

Expert
Licensed User
Longtime User
Dimitris
For the black screen problem I use direct copy instead of rotation so I have a way around with an if.
It would be nice if you find why and correct it, no hurry...;)

Robert
I want to recomend a book for you to read - "Strata" by Terry Pratchet.
Its fiction, but has a very interesting point of view about "previous" and "later". It involves lots of stars of course.
 

dzt

Active Member
Licensed User
The 2008 update.

Bugs corrected:
RotateImage, angle = 0 acts correctly now.
InvertImage works OK for Images with 8 bits colour depth.

Added:
CombineImagesHorizontal(Image1, Image2): Returns a new Image. The Left part is Image1 and right part is Image2. New width = width1+width2 and new height = height of the highest Image. The empty space is filled with the colour of pixel(0,0) of Image1

CombineImagesVertical(Image1, Image2):
Returns a new Image. The upper part is Image1 and bottom part is Image2. New height = height1+height2 and new width = width of the wider Image. The empty space is filled with the colour of pixel(0,0) of Image1

CreateEmptyImage(Width, Height, alpha, red, green, blue): Return a new image with the above characteristics.

DrawImage(targetImage, sourceImage, x, y, width, height): Draws the sourceImage in a rectangle (x,y,width, height) on targetImage. Returns the new Image
 

Attachments

  • dzImage_05.zip
    14.9 KB · Views: 214

alfcen

Well-Known Member
Licensed User
Longtime User
Yasou Dimitris,
As far as I can see after a first quick check, all works as advertised.
In my app InvertImage also works for JPEGs (24-bit depth). The last
version appeared to have had a problem with GIFs only, which I can
no longer confirm. As the saying goes in Australia, "You're a bloody legend!"
Congrats on a big job. You have just added a few free drinks to your
accommodation ;)
Cheers
Robert
 

derez

Expert
Licensed User
Longtime User
Dimitris
the command "DrawImage(targetImage, sourceImage, x, y, width, height) " refuse to work for me. You say that it returns the image but the target is also defined as an argument.
I'll appreciate an example.
I tried to use it as a way to go around the fact that copying an image to a form resize it so that it fit within the form, while I need it to keep its size.
Thanks
David
 

klaus

Expert
Licensed User
Longtime User
Hello Dimitris,
I tried also the DrawImage function and didn't get a result. I agree with derez that an example would be of interest.

For the moment I use CopyImage
Sub HScroll_ValueChanged
ErrorLabel(DoneH)
MapX=HScroll.Value
bmpMap.Value=MapImage.CopyImage(ImageList1.Item(Map_I),MapX,MapY,GW,GH)
' bmpMap.Value=MapImage.DrawImage(frmMain.Image,ImageList1.Item(Map_I),MapX,MapY,GW,GH)
frmMain.DrawImage(bmpMap.Value,GX0,GY0)
DoneH:
End Sub

CopyImage is OK
DrawImage not

The ErrorLabel(DoneH) is to avoid an Out of memory error.

I use it in a small program to display parts of a bigger bitmap (in my case maps) onto a defined area on the screen.

Best regards

Klaus
Switzerland
 

agraham

Expert
Licensed User
Longtime User
Help file for dzImage library attached.

Klaus, derez - see the definition of DrawImage in the help. The folowing works for me.

B4X:
   ImageClass.New1
   bmp1.new1(AppPath & "\one.jpg")
   bmp2.new1(AppPath & "\two.jpg")
    bmp1.Value=ImageClass.DrawImage(bmp1.value,bmp2.value,40,40,20,20)
   form1.DrawImage(bmp1.Value,0,0)
 

Attachments

  • dzImagehelp.zip
    7.7 KB · Views: 145
Last edited:

LineCutter

Active Member
Licensed User
Longtime User
I may have missed it, but is there an way to use this (or another library if someone else knows of one) for simple picture processing (brightness, contrast, Gamma being the obvious examples).

I only want it for eye candy, so I'm trying not to write the function myself, working one pixel at a time.
 

derez

Expert
Licensed User
Longtime User
Thanks Agraham
This made it sink down: "Returns the new combined image leaving the originals unchanged."

david
 
Top