Results 1 to 9 of 9

Thread: how can create nine patch png or use nine patch png picture in vb6?(any way?)

  1. #1

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Post how can create nine patch png or use nine patch png picture in vb6?(any way?)

    hi i am looking for use nine patch pictures in vb6. any body hv sample or source code for do it?
    for example i want create uc control button (use png picture) and when user resized button so button resize too without any scale problem.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    Interesting idea. Since I wasn't aware of the term "nine patch", needed to look it up. Here's one decent link describing the general idea. And how Android implements it here.

    As far as developing this yourself. Gotta think this isn't too difficult, in theory. Since the stretch areas are defined by a 1 pixel buffer around the image, it's a matter of locating the non-transparent parts of that one-pixel buffer. Once those are known, you have the areas of the image that can be stretched vertically, horizontally or both.

    Definitely could be some fun developing this for VB users. If I didn't have a bunch of other stuff on my plate, I think I'd give it a shot, including a designer tool to create/modify them. Heck, if Olaf sees this post, you might get an addition to his RC5 project if it doesn't already exist there
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    I'm wondering if this technique can by used w/ icons on DPI aware apps. The idea is to *downsample* an original 32x32 and at some point *upsample* when scaling goes beyond 200%

    cheers,
    </wqw>

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    That's pretty much what LoadIconWithScaleDown function is for. By including several images for likely sizes it can give enhanced results by skipping any scaling at all.

  5. #5

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    i can use like this tools for create 9patch picture but i want know how use in vb6(png format is matter for me,i want keep transparent picture property too)
    Name:  nine.jpg
Views: 367
Size:  32.5 KB

  6. #6

    Thread Starter
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    575

    Post Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    i created this activex for test :
    theme is between 1 to 4 in this demo version.
    i did set just 4 images png for theme.

    Name:  ninepatch.jpg
Views: 366
Size:  35.6 KB

    any other hv sample like this for better optimize?
    Attached Files Attached Files

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)



    Here is a sample cNinePatch class that implements the android specification (including repeating parts). Heavily based on 9patch.js, included PNGs in res folder from Ogre's Lab blog.

    Included ctxNineButton is a transparent windowless user control that accepts 9-patches for normal/hover/pressed/focused button states and implements blending animation for state transition.

    cheers,
    </wqw>
    Attached Files Attached Files
    Last edited by wqweto; Apr 16th, 2018 at 09:04 AM.

  8. #8
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    https://github.com/wqweto/NinePatch

    FYI, the project got it's own repo



    cheers,
    </wqw>

  9. #9
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: how can create nine patch png or use nine patch png picture in vb6?(any way?)

    Quote Originally Posted by wqweto View Post
    https://github.com/wqweto/NinePatch

    FYI, the project got it's own repo



    cheers,
    </wqw>
    very good.

    i think you can post to codebank

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width