Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / I want to blend data from 2 bitmaps together

Author
Message
Knifeworld
10
Years of Service
User Offline
Joined: 28th Sep 2014
Location: England
Posted: 28th Sep 2014 22:50
Hi, i've been using DB and DBpro for some years, i stopped for a while to study at uni so for about a year now ive been getting back to it after that.
I'm new to this forum though.

With a bit of digging through examples i managed to write a program to mess up bitmaps creatively at the byte level.
Thanks go to IanM.

It works fine so far, but i want to know how to get it to blend two bitmaps together, in addition to the color shifting and pixel warping.

I'd like to hear suggestions as to what changes i can make to the code.

These are the results so far.


for the desk image


for the keanu image


Thanks!



Spooky Data
VisualProg
16
Years of Service
User Offline
Joined: 31st Mar 2009
Location: RussianFederation, Smolensk
Posted: 29th Sep 2014 09:11 Edited at: 29th Sep 2014 16:42
from rgb map:


MZh[NUL] <---

My musics

Attachments

Login to view attachments
VisualProg
16
Years of Service
User Offline
Joined: 31st Mar 2009
Location: RussianFederation, Smolensk
Posted: 29th Sep 2014 09:16
Quote: "pixel warping"

I do not understand
Do you can give pictures for example?

MZh[NUL] <---

My musics
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Sep 2014 11:36
Might be simpler to convert the two bitmaps to images and apply them to a plain using the blend mapping commands. Then extract the new bitmap from the result. Depends what kind of blending you need of course.

For really fancy blending you could use a shader solution plus set camera to image.



Powered by Free Banners
VisualProg
16
Years of Service
User Offline
Joined: 31st Mar 2009
Location: RussianFederation, Smolensk
Posted: 29th Sep 2014 13:20 Edited at: 29th Sep 2014 16:42
Quote: "Might be simpler to convert the two bitmaps to images and apply them to a plain using the blend mapping commands. Then extract the new bitmap from the result"

He use bitwise operations:

I think, he be teaches theory or get information about how to do it "on their own".
Else - easier to use WinApi - GDI32.dll, DirectX Api - Sprites.

MZh[NUL] <---

My musics
Knifeworld
10
Years of Service
User Offline
Joined: 28th Sep 2014
Location: England
Posted: 2nd Oct 2014 09:32
Hi, thanks for the responses guys. Visual i'll try out your code example tomorrow (it's 7:00 am here & my sleep cycle is upside down )

What i meant by warping is the pixels can be moved by SIN commands in the main part of my code.





the col2 variable is set as a local DWORD inside the function and the code above is grabbing the color from a position in the original bitmap.

the position is modified by the custom rnd and sin values, so it could be 0 or 255 or a super huge value.

the bitshift is for the colors.
i changed part of the code so you can choose which color channels will be affected by the altered position and which will stay the same as the original.

Thank you for the suggestion, i will try it , but i'm not too keen on using objects for this program, what i mean by that is the resulting bitmap isn't meant to be displayed in the program at all, not yet, anyway.

My goal is to do it purely with processing and altering the raw data.

is it possible to blend the images by using .PNG images instead of .BMP? would i then be able to change transparency? by altering the data for the alpha channel, as in R.G.B.A ??

Spooky Data
VisualProg
16
Years of Service
User Offline
Joined: 31st Mar 2009
Location: RussianFederation, Smolensk
Posted: 2nd Oct 2014 13:05
If you need "get result image" (not program algorithm), you can use "High Level functions".

Quote: "is it possible to blend the images by using .PNG images instead of .BMP?"

you can use BMP as PNG this language feature. DBP add alpha channel for image.

Quote: " but i'm not too keen on using objects for this program, what i mean by that is the resulting bitmap isn't meant to be displayed in the program at all, not yet, anyway."

Use save result, not sent this in display)

MZh[NUL] <---

My musics
VisualProg
16
Years of Service
User Offline
Joined: 31st Mar 2009
Location: RussianFederation, Smolensk
Posted: 2nd Oct 2014 13:46 Edited at: 2nd Oct 2014 13:59
for example, i use sprites:

images



results:









may use GDI32, but in DBP this can be challenging

MZh[NUL] <---

My musics

Attachments

Login to view attachments
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Oct 2014 08:05
These old snippets of mine might give you some ideas.
http://forum.thegamecreators.com/?m=forum_view&t=32791&b=6

http://forum.thegamecreators.com/?m=forum_view&t=32327&b=6

There was a fairly large image library by Kenmo (I think) that did all sorts of image manipulation. I can't seem to find it.



Managed to find one of my old snippets:


Knifeworld
10
Years of Service
User Offline
Joined: 28th Sep 2014
Location: England
Posted: 22nd Oct 2014 18:20
Thank you so much guys, i never thought of reloading the saved image, or the sprite idea, hahaha.

I still have to try out the first two suggestions, i got lost for a week trying to implement usage of .PNG files, but it was just too confusing for me.

I have been watching many lectures about digital image processing on youtube, and i kinda went off at an angle trying to write edge detection programs for bitmaps XD!

Today i'll try returning to the bitmap blending idea.



Spooky Data

Login to post a reply

Server time is: 2025-05-12 20:38:49
Your offset time is: 2025-05-12 20:38:49