Recent

Author Topic: [Laz Mac OSX] How to create a custom form from PNG image?  (Read 22962 times)

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
[Laz Mac OSX] How to create a custom form from PNG image?
« on: December 17, 2009, 08:28:57 am »
Hi guys,

I've searched  the forum but I didn't find any comprehensive suggestions about my issue.
I'm on Mac, I have installed lazarus on both of my Macs(iMac intel, Alubook g4 ppc).

I don't know much about 10.5 or 10.6 Api-s so I need you help.

Does anyone know how to create a form like this:

http://www.arunalabs.com/blogs/wp-content/uploads/2007/08/aruna_send_yahoo_widget.png

Not just a rounded form, but a PNG image with all it's alpha-blending features.

I know how to do it on Delphi win, there's a great lib from progdigy called Gdiplus, But I can't find any alternatives for mac.

So please help me out guys

Thanks and sorry about my poor English.

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #1 on: December 18, 2009, 07:44:08 am »
anyone?  :-\

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #2 on: December 18, 2009, 10:19:26 am »
I'm afraid there's no ready to use solution.

It's easy to make the whole window transparent (or adjust the transparency), but using a transparent image as window's form might be harder.  Especially for LCL, due to LCLCarbon internal implementation.

If you could find a C-sample on how to do it, using pure Carbon API, I can help you adopting it to Lazarus.

p.s. But i'll be away until 29th of december.

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #3 on: December 18, 2009, 11:35:47 am »
Thanks for your reply,

I'll  try to find something...  and will post it ASAP

Thanks a gain


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #5 on: December 18, 2009, 12:38:46 pm »
sorry. this samples are about how-to do make png-image shaped forms in Windows.
And i guess you need the same for OSX.

So the samples should also be applied for Mac OS X, and not Windows. Since Lazarus and Pascal is not much popular on OSX system, it's normal if you find C or C++ code.

You can search for samples at: developer.apple.com site. There might be useful links at lists.apple.com (apple developers mailing list)

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #6 on: December 18, 2009, 12:50:23 pm »
have you look at the first link? there are two projects available for download. Written on cocoa and pure Carbon api

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #7 on: December 18, 2009, 03:20:39 pm »
have you look at the first link? there are two projects available for download. Written on cocoa and pure Carbon api
yes. Both projects from the link are Cocoa based. Not Carbon.
To bad, that some code is actually "hidden" because both projects are using Interface Builder.

I'm afraid there won't be solution today.

upd: have found the carbon sample.
« Last Edit: December 18, 2009, 03:34:21 pm by skalogryyz »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #8 on: December 18, 2009, 06:13:44 pm »
here you go
« Last Edit: December 18, 2009, 06:16:02 pm by skalogryyz »

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #9 on: December 19, 2009, 01:33:16 am »
OMFG thanks alot  :o

The only thing as that img has some strange black gasps...  and also it mirrors itself if you try to  replace the circle.png with SomethingElse.png.

(http://img13.imageshack.us/img13/3545/picture1st.th.png)

Any ideas?

I think TFPImageBitmap is the reason for this.. PNG is recognized as 8 bit image... it should be 24.
« Last Edit: December 20, 2009, 11:41:41 am by Sandrix »

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #10 on: December 21, 2009, 05:01:12 pm »
May be you have a problem with the alpha channel. Load it with a graphic editor (i.e. The GIMP, Photoshop or similar) and see if it's all right. Also be sure that the transparent part is "plain".
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #11 on: December 21, 2009, 05:13:13 pm »
no there's nothing wrong with an alpha channel. Plus it'sa same img that was in you zip file. Try it by yourself. make a simple shape in PS and export it as a png. Replace the original circle.png with your file. Pls let me know how it goes  :) thanks again
« Last Edit: December 22, 2009, 11:05:15 am by Sandrix »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #12 on: December 29, 2009, 11:14:19 am »
It's caused by some LCL->carbon features...
Anyway, i've fixed OSXUtils.pas file, and now the transparent image should be drawn correctly.

Sandrix

  • New Member
  • *
  • Posts: 32
    • My Portfolio
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #13 on: December 30, 2009, 08:09:24 pm »
 %)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: [Laz Mac OSX] How to create a custom form from PNG image?
« Reply #14 on: January 02, 2010, 01:52:19 pm »
 :D I'm sorry, I've forgotten to remove "debug drawing"

please test the fixed osxutils
« Last Edit: January 02, 2010, 01:56:52 pm by skalogryyz »

 

TinyPortal © 2005-2018