Draw 32 Bit icons with alpha channel - Windows Mobile Software Development

How can I draw an icon with 32 bit (24 + 8 Bit Alpha) correctly.
When I use the LoadImage() and DrawIcon() API the alpha
channel info is lost and the icon is drawn normal.
Thanks for any information.
Houser

i've been using a program called iIcon and GIMP to edit my icons...

Edit and creation of icons is not my problem.
I want to display them with alpha on the device.
Houser

What format are you using?
I needed to do Alpha blended buttons for some project a while back and found that the only (or at least the fastest) way to get it done in a native C++ app was using OpengGL ES and png files.
To my knowledge there are no native windows APIs to handle Alpha blending.
There are also GDI+ (if you can use .NET) and DirectDraw (which I understand is not implemented on all devices OS versions). I am not certain about their capabilities.

Look at IImage and interfaces that comes with it. It's rather slow but can do the job. (native programming of course).
A faster approach would be doing the drawing yourself using DIBSection (or ddraw).

It would help to have more information, like what type of image file you're trying to produce? Are you trying to do transparency?
bitmap = no alpha + no transparency
png = multiple alpha + transparency
jpg = apha (jpeg2000) + no transparency
gif = single alpha + transparency
You can create all the alpha channels you want in photoshop or paint shop pro, but if you save it as a bitmap it's lost.
Hope this helps, not sure because your question doesn't give much details to your problem.

tene said:
Look at IImage and interfaces that comes with it. It's rather slow but can do the job. (native programming of course).
A faster approach would be doing the drawing yourself using DIBSection (or ddraw).
Click to expand...
Click to collapse
I have used Imaging API and IImage for displaying PNG images with alpha successfull.
Have tried this for icon files with alpha but the icon is not displayed when I use
the IImage interface.
IImagingFactory* m_pImgFactory;
IImage* m_pImage;
m_pImgFactory->CreateImageFromFile( TEXT("file.ico"), &m_pImage );
m_pImage->Draw( m_hDC, &rc, NULL );
Houser

Ok i have managed to display the icon.
But now I am trying to load and icon from an *.ICO file.
The LoadImage() API cannot be used for this because the
flag LR_LOADFROMFILE is not supported under CE.
Has anybody loaded an icon from file and not from resource?
Thanks!
Houser

Houser said:
Ok i have managed to display the icon.
Click to expand...
Click to collapse
hello. can you tell how did you solved alpha-channel problem?
sorry for my french

Related

[TUT] A mini-tutorial on rearranging the Manila Home Screen

Rearranging the Manila Home Screen​
What do I need to know?
Manila uses few types of files: qtc, xml, mode9 and lua. First one is for graphics, second usually for different languages (although not only) and the two last ones are the ones we are interested in. Mode9 files contain information on position, visibility and other properties of almost every element on Manila tabs. Lua files contain different functions, used for animations, updating info and so on.
For editing the Home Screen we need the mode9 file - 1c684cd8_manila and the lua script - 25d04412_manila. You can find these files (from each Manila, starting from 1.0 and ending on 2.5) on this forum.
What tools do I need?
Editing mode9 files is quiet easy. You just have to run m9editor, open the file, make the changes you want and save it. Changing stuff in lua scripts is a bit more complicated, as you have to decompile it. Shorter scripts are easily decompilated by luadec, but some longer ones require us to correct errors. Fortunately, the lua script we have to change is easily decompilated (though there can be a problem with the if condition). To do this follow these points:
- copy luadec.exe and luac.exe to the folder you where you have the lua script (let's say it's c:\compacthome\mod\)
- press Windows Logo + R (or Start > Run) and type cmd
- go to the folder containing the lua script (in this case it's cd \compacthome\mod\)
- type luadec script_name > script_name.txt - where script_name is the script you want to decompile (for example 25d04412_manila) and script_name.txt is the name of the output file, which we will edit
- in case of errors you have to correct them (look for the lua decompiling tutorial by sztupy)
- once you have the script decompiled you don't need to do it again.
- open the output file and change whatever you want
- to compile the file just type luac -o script_name script_name.txt, where script_name is the file we want to have the script_name.txt compiled
What can I change?
When you open the mode9 file we want to edit, expand the tree and you'll see many sections called 'Object'. Below them there are few lines called 'Property'. What you can easily change is:
- Position - just change the value of X and Y (center position (X=0, Y=0) and axis are different for most of the objects - you have to test this)
- Visibility - True or False (sometimes you may have to change the size of a image to 0x0, so that it won't show never)
- Font
- Font Size
- Color of text in RGB format - if Property is not available, add it
In the 25d04412_manila script you can change positions of many objects in both portrait and landscape mode.
- TabsLeft - left part of the clock (animated)
- TabsRight - right part of the clock (animated)
- clock_tabs - background of the clock (pile of tabs)
- alarm_clock - alarm info and date
- NotifiCamera3D - notifications & appointments
- NotificationShiftY - shifting of appointments when changing to small clock
To change the position just modify the first two parameters of Vector3(X, Y, Z) - both CameraPosition.value and LookAtPosition.value.
How to save and test the changes in a fast way?
Open a cab creator (for example WinCE Cab Manager) and add the files you changed to /Windows. Save the cab, copy it to your device, install and reboot Manila. You can also copy manually the file, but I prefer the first way, because in case of any problems you can easily uninstall the cab and get the default Home Screen.
How to get the Home Screen working with Background4AllTabs?
Just open the 1c684cd8_manila file by m9editor, look for 'HomeBackground' and delete the whole paragraph which contains it (from <Object>Type="Group" to the next <Object>Type="Group").
- - -​
If you have any suggestions, propositions or ideas, please write them in this thread, I'll try to complete this tutorial, so it will be useful for everyone. Thanks!
i cannot come up with suggestions, but that tutorial is very nice on your side!
Although not actually about the home screen arrangement. I do think we need the information on how to patch the EXE for weather and especially non-HTC devices to be made public. The few people that know how to do it don't seem to want to SHARE that knowledge, which is damned frustrating!
Kamill, what an excellent idea. I'm looking forward to your tutorial. I wonder will it be for Manila 2.0?
Here are some ideas:
Change touch flo colour
Appointments for at least one week
Linking big clock with another application (similar to Ssmaho)
Changing soft keys names/applications
Changing font sizes/types
Changing date formats on appointments
I hope this doesn't make it too difficult (I think the second one is though for some Manila versions!)
UPDATE in first post - an early version of the mini-tutorial.
FloatingFatMan, unfortunately I don't know how to do it...
mitsi, thanks, I'll work on that.
Kamill, My question is what needs to be changed to get appointments in dates after tomorrow to appear? Do I need to edit both the mode9 and the lua script? Or is it just one of those? I'm willing to get my hands dirty to fix it.
The easiest way is to get the files from hallatore's mod for Manila 2.0 and compare them to the original. There are mainly 3 differences, you'll find them for sure. AFAIR all you have to change is in one script, you have to add an option to display the date, change the place from where appointments are being taken (poomappointments(TAB_Calendar) instead of poomappointments(TAB_Home)) and change the number of appointments in the for loop.
Hmm. Well I changed the TAB_Calendar and added the option to to display date. Those were easy. Finding the loop is harder. I forced A loop to go 5 times and I got 5 calendar events, but the ones past tomorrow were the default ones in the mode9 ("Review design comp (Dan's office)"). I did it in the InitializeFullAnimation function just below this if statement:
Code:
if l_15_15 > 5 then
l_15_15 = 5
end
So those items are not being updated from the calendar. Any ideas? Am I looking in the wrong loop?
Anyway you can post hallatore's mod de-compiled? I think I have the original, but when I use m9editor the lua has a lot of decompiled errors.
Here you go. Are you doing this on the Manila 2.1? I tried so many things to get this working, but with no success
how to change home tab
Hi, I have read all the posts here and in some other threads related, and I'm still confused
I did try to install the cabs posted, and it totally messed my home tab, so I had to hard reset every time (because uninstalling didn't fix it up).
All I want to have is this:
1. move the alarm notification on the upper-right corner (to cover or remove the ATT logo)
2. make the Call History to auto-hide if there is no missed call (or to delete it, if it is easier)
3. have more appointments visible (2-3) with the big clock, and to be able to flip the clock upwards in order to have even more appointments visible
4. when I click on the appointment, to open the Calendar (this is already possible, and I'd like to remain this way)
I apologize if this is a silly question: is this possible to be done only by editing some manila files, and if so, which ones and what should I modify?
I opened some manila files (e.g. 1c684cd8_manila) using notepad and m9editor.exe, and, honestly, I had no clue as to what should I do
I am sure that you guys know this stuff already, and it is very easy for you. If it's not complicated to explain it to me, please help me!
thank you very much
Kamill said:
Here you go. Are you doing this on the Manila 2.1? I tried so many things to get this working, but with no success
Click to expand...
Click to collapse
Thanks. I am trying for Manila 2.1. There's gotta be a way.
tatarasi said:
Hi, I have read all the posts here and in some other threads related, and I'm still confused
I did try to install the cabs posted, and it totally messed my home tab, so I had to hard reset every time (because uninstalling didn't fix it up).
All I want to have is this:
1. move the alarm notification on the upper-right corner (to cover or remove the ATT logo)
2. make the Call History to auto-hide if there is no missed call (or to delete it, if it is easier)
3. have more appointments visible (2-3) with the big clock, and to be able to flip the clock upwards in order to have even more appointments visible
4. when I click on the appointment, to open the Calendar (this is already possible, and I'd like to remain this way)
I apologize if this is a silly question: is this possible to be done only by editing some manila files, and if so, which ones and what should I modify?
I opened some manila files (e.g. 1c684cd8_manila) using notepad and m9editor.exe, and, honestly, I had no clue as to what should I do
I am sure that you guys know this stuff already, and it is very easy for you. If it's not complicated to explain it to me, please help me!
thank you very much
Click to expand...
Click to collapse
Here is the solution to all 4 requests, but it is for Manila 2.0, so be careful. Back-up first just in case. Your screen will then look similar to the one shown.
Been trying...
I've been trying for some time now to get more than today's and tomorrow's appointment's displayed in manila 2.1. I added in the code that Hallatore added (can be found in stupy's lua thread) but there seems to be something limiting the amount of days shown ahead (I hope is not limited by the manila.exe, but I think not).
As additional info, the lua file that use to be embedded in the Home.mode9 isn't any more and is named 53cc1e4f_manila for 2.1 manila and 652ae0f4_manila for 2.5 manila,
12
mitsi said:
Here is the solution to all 4 requests, but it is for Manila 2.0, so be careful. Back-up first just in case. Your screen will then look similar to the one shown.
Click to expand...
Click to collapse
This is exactly what I'm after.
Unfortunately, I tried that alternative and, again, it totally messes my TFLO, and I had to hard reset again.
What do you mean by Manila 2.0, is this the TFLO version (in Settings, I see that I have ver. 3.0 build 29946)?
thank you
Change Home tab display
Hi, thank you very much for your interest and trying to give me solutions for my request. It is amazing how people from different corners of the world are connecting and helping each other.
I presume that the file to work with is 1c684cd8_manila.
I opened that with m9editor 3.3.0.1. It's a lot of info there
Could you guys be so kind and give some clues as to what should I look for in order to change:
- the alarm notification - to move it on the upper-right corner
- the carrier logo - to delete it
- the Call History - to delete it
- the Appointments - to have at least 2-3 shown
Also, important clues as to what NOT to touch, in order to
- continue to be able to flip over the big clock
- continue to be able to open the Calendar when click on the appointment
thank you again
tatarasi said:
- the alarm notification - to move it on the upper-right corner
Click to expand...
Click to collapse
Change the X and Y in the 'Position' Property of these objects: AlarmClockOn, AlarmClockOff, AlarmTime.
tatarasi said:
- the carrier logo - to delete it
Click to expand...
Click to collapse
To the object 'OperatorLogo' add a property called 'Visibility' and change its value to False - if it won't work change it's height to 0 in the 'Size' property.
tatarasi said:
- the Call History - to delete it
Click to expand...
Click to collapse
The same as above, objects: MissedCall_SBar1, MissedCall_SBar2, MissedCallIcon, MissedCallText.
tatarasi said:
- the Appointments - to have at least 2-3 shown
Click to expand...
Click to collapse
You need to decompile the 53cc1e4f_manila script and find l_15_0.MaxShowCount and change the value of it to the desired one.
Kamill said:
You need to decompile the 53cc1e4f_manila script and find l_15_0.MaxShowCount and change the value of it to the desired one.
Click to expand...
Click to collapse
If only it was that easy... I've been trying all kinds stuff including what you suggest above. I have decompiled the 53cc1e4f_manila I'll attach it here (it's the one from yozgatg's r1.5),
12
I mean you CAN change the number of appointments, but in a range of 0 to 6 (5 with big clock). I've tried to get more appointments shown, but I failed...
Kamill said:
Change the X and Y in the 'Position' Property of these objects: AlarmClockOn, AlarmClockOff, AlarmTime.
To the object 'OperatorLogo' add a property called 'Visibility' and change its value to False - if it won't work change it's height to 0 in the 'Size' property.
The same as above, objects: MissedCall_SBar1, MissedCall_SBar2, MissedCallIcon, MissedCallText.
You need to decompile the 53cc1e4f_manila script and find l_15_0.MaxShowCount and change the value of it to the desired one.
Click to expand...
Click to collapse
Hi, Kamill,
Apologize for double posting, I am growing impatient feeling that I am so close to a solution
Regarding the Manila, I checked where you told me to, and I found out that I have TFLO 3D 1.2.37896.1_1813.6. Thank you.
Thank you for your advices, I already tried to remove the logo
- first, I added the <Property> Name=Visibility Value="False" - did not work
- then, I changed the Height=0 - still ATT was there
- lastly, I deleted the entire Object GLESSprite2D (which was above the "OperatorLogo" property - still no result
What do you think I am doing wrong?
Speaking of the number of appointments, I amazingly discovered that I do not have 53cc1e4f_manila file. What do you think that means?
thank you very much, again
Manila 1 is a bit different from 2.0 or 2.1, the 53cc1e4f_manila script is embedded in the 1c684cd8_manila mode9 file (one of those at the beginning).
AFAIK you can replace the logo file with a blank one (don't ask me which file is it, I don't know ). Or you can try to add a 'Position' property and move it out of the sight (but it may come back in some situations) - though I do not guarantee it'll work.
I hope you'll success in modifying the Manila 1 homescreen, I guess there is still a couple of people who use that version of TF3D.

[win32] API - New Sense interface Look 'n Feel V1.6.4 (01/28/11)

I have created a win32 API for C++ that mimics HTC's Sense UI Look 'n Feel... More informations on my website: charlie-soft.com
DOCUMENTATION : http://charlie-soft.com/Software/Manila_SDK/html/
This SDK is designed for speed: .NET applications are usually very slow to load and not fluid. I use some tricks to improve speed, like drawing only area having changes, scrolling without backbuffer or creating textures for text (GDI text drawing was slower…).
What’s in the box:
PNG resources for VGA/WVGA. They can be easily modified. SDK will resize automatically the resources if your device has a smaller (or higher) resolution!
Design your app for VGA, the SDK will adjust the layout for other resolutions!
Full Finger Control.
Source files (.cpp and .h) of library.
Source files of example.
Class:
MyEditControl: Edit box with different width. Easy get and set text. SIP detection: scroll Edit area.
MyItem: Button (3 types), checkboxes and switch (TripleState!). Event on click, visibility and state can be changed/get easily.
MyPanel : This element is not visible but is used to bring together elements. This element can have a title and dotted separator between each element.
ChildSection : Contains a subsection which is displayed with a sliding effect.
MyLabel: Print text with different font and color.
MyPictureBox: To print image (png, jpg, bmp, gif…)
MySelector: Like the HTML select. Scroll screen if list is out of screen (see video below).
Section: A section is a panel which can be scrolled up/down. It contains the different elements.
MessageBoxSense: Four type of messagebox: info, Ok/Cancel, Abort/Retry and Yes/No.
MySlider: A simple slider of any size... The min and max values can be changed easily, as the cursor position.
Change log
V1.6.4
Added the possibility of multilines in edit control
V1.6.3
Added possibility to add picture to slider of ChildSection...[bug solved]
Explorer bug solved
V1.6.2
Added an event when user click on screen...
V1.6.1
Memory usage improved
V1.6
Loading of image is now safe (use video memory by default but if problems use device memory)
File Explorer
Icons
Speed and memory improvement
V1.5
just add possibility to change color of text for hover and selected...
Minor bug changes:
items out of screen no longer try to redraw
text of items recompute their size when changing
background color is correctly changed
The SDK is now multi thread safe!
Add the possibility to right clicks (long press)
Add the possibility to hook windows message (WM_ACTIVATE for example)
Add the possibility to have a bottom bar.
Add the possibility to have a background image (landscape and portrait).
If the app is allready started, close the new instance and show the previous one.
MySelector can be scrolled if the list is too long.
Text is now printed with alpha transparency.
Compatible with any character (hebrew, vietnamese...).
MyPictureBox can now be stretched.
Memory usage reduced.
V1.4
Minor bugs fixed
Add the possibility to show MessageBox without a main application.
V1.3
Background can be transparent ! (see this app for demo)
Native drawing (DirectDraw was too slow in landscape)
Slider can have a force feedback (see this app for demo)
V1.2
MySlider added
drawing process rewrited: less redraw->less computation->less CPU utilization -> battery consumption reduced
Loading optimisation
The layout is now independent of screen resolution!
top taskbar is occassionally cleared [fixed]
White screen, touching the panel brings it back [fixed]
landscape items position incorrect [fixed]
V1.1
landscape compatible
Abort/Retry added to MessageBoxSense
TripleState Checkboxes and OnOffItems added
FAQ
is QVGA resolution supported?
Yes, SDK will find the correct resolution and select the appropriate resource resolution. The SDK will delete the other resources...
have you planned to extend MessageBox types to Abort/Retry?
Yes, to create one:
MessageBoxSense::show(L"Hello",L"Try again ?", MESSAGE_ABORTRETRY);
is this landscape compatible?
Yes but having refresh rate issue. Seems to be a DirectDraw problem (S2U2 was subject to the same issue...)
If someone know how to solve this problem, send me a message !
Back button too slow.
You can change the speed anim using this function: changeSpeed(double nbMilisecond)
why aren't you including some TripleState Checkboxes and OnOffItems ?
Both are now included:
new MyItem(1,5,15,ITEM_IS_CHECKBOX,ITEM_THIRD_STATE,L"My third checkbox (Third state)");
Other apps
Wake on Wan is a new app which use this SDK. Sources are available!
Quick shutdown is a software which use this SDK too. It can turn off, restart or set the phone in sleep mode. Sources are also available!
"
Sense SDK win32 C++
For informations about SDK (installation, use compile...), see here: http://charlie-soft.com/Software/Manila_SDK/html/
Good work ! thanks for sharing hope devs will use it.
Hello my friend !
Great work !
( C'était exactement ce que je cherchais en c++ pour mes MFC smart device !!! )
Great Work, Thx for the source!!
Really great work!
but I have two questions:
- is QVGA resolution supported?
- have you planned to extend MessageBox types to Abort/Retry?
thank you
regards
NIce work
Altough i don't really know what todo with it... i instalt the example.cab and it was really smooth!
Only one thing if i go to other controls and i want to change the value then the onscreen keyboard should show up right? But it doesn't.... So i slide my qwerty keyboard open, and in landscape i get an error message: DDERR_SURFACELOST(back buffer)
I dont know what it means... is this landscape compatible?
Good job man !
Nice works !
I just have a feedback, I find too slow the animation when you click on the "back" button, is there is a way to speed it up ? (or disable simply the animation)
SDK Manila
Hello all !
I will try to answer all your questions. So :
- is QVGA resolution supported?
No but easy to implement... Just resize resources to correct resolution. I will post resources shortly.
- have you planned to extend MessageBox types to Abort/Retry?
If it's something wanted, I will do it.
- is this landscape compatible?
No, not yet. But will be in next release!
-Back button too slow.
I will add a method to set the speed of animation... in the next release
-Bug with hardware keyboard
The onscreen keyboard don't show up and I don't know why... I will look around for a fix.
If a developer wants to translate .NET applications into C++, feel free to post I will try to help you!
There is still lot of work, but I will try to do this quickly!
petititi said:
- have you planned to extend MessageBox types to Abort/Retry?
If it's something wanted, I will do it.
Click to expand...
Click to collapse
thank you for quick reply. I need this extension for my app "htc menu loader" (link in signature) to migrate from .net to c++
again, really great work. You are making something that HTC should have done months ago.
Great project !
I don't know if you notice but I disabled the bottom taskbar... Do you think that I should add the possibility to enabled it? I saw that your application needed one...
I hope you will find my SDK easy to use !
Hey, this looks awesome.
Question though: I'm just shy of clueless when it comes to making an actual working app. Is there any place I can go to read/learn the coding I will need to actually use this?
Application win32 c++
You can use the example application included into the SDK to learn basic stuff or you can download this application: WakeOnWan. It’s based on my SDK (here are the sources).
You need some basic knowledge about Object-oriented programming and C language. I try to explain how to use the SDK in the example using comments or on my webpage.
I will also post a short tuto in second post...
Very, very nice! The demo runs very smoothly on my stock Touch Pro 2.
petititi said:
You can use the example application included into the SDK to learn basic stuff or you can download this application: WakeOnWan. It’s based on my SDK (here are the sources).
You need some basic knowledge about Object-oriented programming and C language. I try to explain how to use the SDK in the example using comments or on my webpage.
I will also post a short tuto in second post...
Click to expand...
Click to collapse
Awesome thanks!
What's sad, is when I was young, I used to be able to code in C. Made my first video game when I was 6 on a Commodore 64 (ok i dated myself here) Now, can't remember very much
C++ ? It's just like riding a bike!
Hatefly said:
Awesome thanks!
What's sad, is when I was young, I used to be able to code in C. Made my first video game when I was 6 on a Commodore 64 (ok i dated myself here) Now, can't remember very much
Click to expand...
Click to collapse
I'm sure you can!
It's just like riding a bike - you never really forget how. And we are here to help you to refresh your memory.
petititi said:
I'm sure you can!
It's just like riding a bike - you never really forget how. And we are here to help you to refresh your memory.
Click to expand...
Click to collapse
Sweet thanks! Just downloaded an ebook on c programing.
Sounds (and looks) great, although there are still to many glitches (like not working in landscape etc.) which are preventing me from using this package.
But I have one question, why aren't you (all) including some TripleState Checkboxes and OnOffItems ?
I need them often but you cant find such controls online - not to speak of sense.
TripleState Checkboxes ?
Hello,
the TripleState Checkboxes is a simple feature I can add. To be sure, TripleState Checkboxes will looks like:
And tripleState On/Off:
I will include them in the next release... Be patient, the next release is coming soon and adds support for portrait and fixes a few bugs...

[Controls] SenseSDK Extended Controls (6 Controls) Updated: 31July,2010

Hello, i am trying to post few extended controls from SenseSDK from eboelzner with source code.
They all inherit SensePanelBase
http://forum.xda-developers.com/showthread.php?t=648906
They all will work under SenseListControl or direct on form.
Controls name starting with SensePanel only work under SenseListControl.
Code may be bit dirty, but is due to lack of time. But will surely be fixed and optimized.
Right now controls do not have documentation. I am working on it to make it and will post at earliest.
However there are examples for all controls in a demo app for VB.net and C#.net.
http://sensesdkextended.codeplex.com/SourceControl/list/changesets
Controls:
1. SenseButtonControlEx (very basic release)
2. SenseHeaderControlEx (2 Different Styles, see screenshots)
3. SensePanelItemEx (4 Different Styles, inludes multi columns, see screenshots)
4. SensePanelLinkLabel (see screenshots)
5. SensePanelNumericItemEx (2 and 3 digit support, see screenshots)
6. SenseSelectionControl (under development, do not use as it is incomplete)​
I did not get much time to test. however i am fixing bugs at earliest on them.
Give feedback with a reason on how you want to use this control as, helps me a lot to develop further, and if i know how it is going to be used, then it will give me motivation too
Requirements:
1. .Net Compact Framework 3.5 (requirement of SenseSDK)
2. Application running without any errors using SenseSDK​
Screenshots in Post #3
I know lots of developers are looking for this controls. Would be helpful to them.
If there are bugs, post them here, and they will be fixed for sure.
Feedbacks would be great.
Will add more controls soon.
Have Fun!!
[Downloads]
It was getting difficult to manage multiple versions, and release.
So now i am using Codeplex for everything.
It has Complete Source Code, screenshots, and releases for download.
Has a compiled Dll which simply can be added as Reference.
Project: http://sensesdkextended.codeplex.com/
Release: http://sensesdkextended.codeplex.com/releases/view/49857
Daily Updated Code: http://sensesdkextended.codeplex.com/SourceControl/list/changesets
Documentation Coming soon.
Please refer to demo app for now.
Screenshots:
http://s832.photobucket.com/albums/zz246/greenhacks/SenseSDKExtended/
Hi! nice work! is possibile to set font of SensePanelItemEx as "Bold"?
leen15 said:
Hi! nice work! is possibile to set font of SensePanelItemEx as "Bold"?
Click to expand...
Click to collapse
Yes, in few minutes , i will post v0.2 shortly for you.
greenhacks said:
Yes, in few minutes , i will post v0.2 shortly for you.
Click to expand...
Click to collapse
Oh thanks a lot.. I'm trying to implement it, but i use c# and not vb, so i'm curious to see if i did the right things
leen15 said:
Hi! nice work! is possibile to set font of SensePanelItemEx as "Bold"?
Click to expand...
Click to collapse
leen15 said:
Oh thanks a lot.. I'm trying to implement it, but i use c# and not vb, so i'm curious to see if i did the right things
Click to expand...
Click to collapse
It now has FontStyle property.
uhm.. but how can i use the class in my c# project? I add the SensePanelItemEx to my project and build successful, but if i try in any place to create an object derived from SensePanelItemEx i have :
"The name 'SensePanelItemEx' does not exist in the current context"
leen15 said:
uhm.. but how can i use the class in my c# project? I add the SensePanelItemEx to my project and build successful, but if i try in any place to create an object derived from SensePanelItemEx i have :
"The name 'SensePanelItemEx' does not exist in the current context"
Click to expand...
Click to collapse
I dont think you can include vb version in your c# project.
I think i will have to get c# versions also for this controls.
Will try to post tomorrow which should work for you.
If you want you can create a class library project in vb for smart device, and compile, and use the dll in your c# and that would work.
greenhacks said:
I dont think you can include vb version in your c# project.
I think i will have to get c# versions also for this controls.
Will try to post tomorrow which should work for you.
Click to expand...
Click to collapse
I'll wait you, very need this control!
Hi, i successful convert your SensePanelItemEx to C# with this:
http://www.developerfusion.com/tools/convert/vb-to-csharp/
So here is the working c# class
ps. I attach a little screenshot of the working item with Bold and Red Color
An idea:
I think it would be very useful integrate in this custom item the automatic resize of the height according to the length of the text and the screen position (portrait or landscape).
PS:No normal Thumbnail Support?
leen15 said:
An idea:
I think it would be very useful integrate in this custom item the automatic resize of the height according to the length of the text and the screen position (portrait or landscape).
PS:No normal Thumbnail Support?
Click to expand...
Click to collapse
There is no support for landscape in SenseSDK, so nothing much we can do as we are just inheriting SensePanelBase.
Regarding, thumbnail support, i will get it checked and get it drawn. thanks for noticing, missed it completely.
Good to know you was able to make it work.
I would also suggest you to study the code so you can understand it completely and also do changes like you need, that is the main reason i am providing code.
if you find bugs, do let me know.
thanks.
greenhacks said:
There is no support for landscape in SenseSDK, so nothing much we can do as we are just inheriting SensePanelBase.
Regarding, thumbnail support, i will get it checked and get it drawn. thanks for noticing, missed it completely.
Good to know you was able to make it work.
I would also suggest you to study the code so you can understand it completely and also do changes like you need, that is the main reason i am providing code.
if you find bugs, do let me know.
thanks.
Click to expand...
Click to collapse
I'm tring to understand the code for Thumbnail support but with no result because the SensePanelItem have Thumbnail and iThumbnail support and I try to integrate Thumbnail in your SensePanelItemEx but the text don't go at the right of the thumb, i think because i've problem to manage the Rectangole in the panel..
I need to have like as the screenshot, with bold support!
PS: i don't understand the no landscape support..
The senseSDK go fine in landscape.
I think that we can user the SizeF stringSize = g.MeasureString(s, f); that you call in OnRender function but that you don't use, and the text don't go in multiline.
leen15 said:
I'm tring to understand the code for Thumbnail support but with no result because the SensePanelItem have Thumbnail and iThumbnail support and I try to integrate Thumbnail in your SensePanelItemEx but the text don't go at the right of the thumb, i think because i've problem to manage the Rectangole in the panel..
I need to have like as the screenshot, with bold support!
PS: i don't understand the no landscape support..
The senseSDK go fine in landscape.
I think that we can user the SizeF stringSize = g.MeasureString(s, f); that you call in OnRender function but that you don't use, and the text don't go in multiline.
Click to expand...
Click to collapse
I dint knew landscape was supported. i will get it checked.
If you can post a screenshot in landscape mode, would be appreciated.
Thumbnail support is already coded few hours ago, and going through some basic testing.
should be posted in next few hours.
and will look same like your screenshot.
in the last screenshot you provided, i believe you are setting the height yourself for the panelitem?
greenhacks said:
in the last screenshot you provided, i believe you are setting the height yourself for the panelitem?
Click to expand...
Click to collapse
Yes, it is because i need MeasureString onRender!
Now i manually add a \r\n when the string is upper of the width of the panel, and add a costant height on every new line , but not working good in landscape mode and in different resolution mode.
See my screenshot for landscape mode.
leen15 said:
Yes, it is because i need MeasureString onRender!
Now i manually add a \r\n when the string is upper of the width of the panel, and add a costant height on every new line , but not working good in landscape mode and in different resolution mode.
See my screenshot for landscape mode.
Click to expand...
Click to collapse
thanks for screenshot.
I already figured out the issue for height, and MeasureString is being integrated.
Will get the landscaped support working.
Do you think in first screenshot of SMS you showed, the thumbnail should have been moved to top align, rather then middle? or should have option for top,middle,below?
greenhacks said:
thanks for screenshot.
I already figured out the issue for height, and MeasureString is being integrated.
Will get the landscaped support working.
Do you think in first screenshot of SMS you showed, the thumbnail should have been moved to top align, rather then middle? or should have option for top,middle,below?
Click to expand...
Click to collapse
I think that would be great to set the position in screen.
In my app i need in the list of sender this right size and middle, but in SMS that i show i would have the thumb a little small and at the top (align of the first line of Primary Text, that is the contact name )
Thanks for your work i wait for automatic height of the panel!
leen15 said:
I think that would be great to set the position in screen.
In my app i need in the list of sender this right size and middle, but in SMS that i show i would have the thumb a little small and at the top (align of the first line of Primary Text, that is the contact name )
Thanks for your work i wait for automatic height of the panel!
Click to expand...
Click to collapse
Auto height and thumbnail support added.
thanks and do give feedback.

[24/08/2010] first development project 4 on 1 row

intro: I'm a bachelor student who has a little knowledge of programming.
For the first time i try to make a simple game that i already wrote in java work in vb.
I'm planning to make this a full working game that I can place on the market place for free.
I already have the idea how to make the AI to play 1 vs PPC
I wrote it for a WVGA screen but its completely dynamic so it should work on other screen sizes.
Only when you change the orientation the text will not be visible (need to think where i'm gonna place it)
pls feel free to give input on the project.
I uploaded the whole vb net directory so its open for everybody
(Im still a bit strugling with a cab file that has links in it
if you instal it, it should be visible in the programfiles dir)
--edited 24/08
-thanks to Gaz25 the refresh problem is soved
-the 4 on a row detection algorithm is completed
Hi, I had a look at your code and fixed your flicker problem.
Basically, when you do you own drawing on a control like a panel you need to take control of painting the background as when a control is redrawn it paints the background first and then anything else on top like text, images etc...
The best thing to do is create a custom control. Then you can override the OnBackgroundPaint event and say do nothing.
Then override the OnPaint event and here is another trick.
In the OnPaint event, create a bitmap. This will be the 'backbuffer' which you will do all your drawing on. Then when you have done all your drawing on the backbuffer, you draw the backbuffer to the screen.
I have included your solution with my modification which I hope make more sense .
If you need more explanation then let me know and I will go into more detail.
Gaz25 said:
Hi, I had a look at your code and fixed your flicker problem.
Basically, when you do you own drawing on a control like a panel you need to take control of painting the background as when a control is redrawn it paints the background first and then anything else on top like text, images etc...
The best thing to do is create a custom control. Then you can override the OnBackgroundPaint event and say do nothing.
Then override the OnPaint event and here is another trick.
In the OnPaint event, create a bitmap. This will be the 'backbuffer' which you will do all your drawing on. Then when you have done all your drawing on the backbuffer, you draw the backbuffer to the screen.
I have included your solution with my modification which I hope make more sense .
If you need more explanation then let me know and I will go into more detail.
Click to expand...
Click to collapse
i will look at it monday when i'm back from a festival
thanks in advance.
sended from x1
Thank you very mutch,
i just tested it and it works perfect.
I will try to make it better in the following weeks.
Only one thing that you changed in my code that wasn't correct "speler = 0" (on load, needs to be 1 or 2) (speler = player)
I also found an error in my own algortim for the 4 on a row detection
"teller1 = teller2 = 0" ( gave me a -1 on teller1)

How to get smooth graphics (no jaggies)?

Hi
I built a simple clock app yesterday. It was surprisingly easy. One question I have though is how to make my images smooth (without jaggies). I drew my clock face and hands in photoshop. At first I did them at 300x300 pixels and the jaggies were so obnoxious I threw those images away. Then I did everything at 1000 x 1000 pixels and resized down to 300 when I was finished. This was much better, but still not as smooth as the clock in Jelly Bean. I notice that most of the graphics and fonts I see in Android are all very smooth. I've been testing the app on a Galaxy Nexus.
What is the secret to creating/displaying nice smooth images?
Thanks, Derek
vector graphic is the keyword with fix sized effects (photoshop, ie. inner shadow is always 1px, above 256px use 2px)... yeah, the simple bitmap resizing won't give pro result for you
Heh Yeah, I've had this problem and it was a ***** to solve. Mainly because the answer is distributed over a dozen different posts on half a dozen different forums.
Anyway, the answer depends mainly on if you're using imageviews/buttons or something or if you're drawing directly to a/your own canvas. But the way to solve it can be applied to both. It basically involves using BitmapFactory.Options and configuring it correctly:
Code:
private BitmapFactory.Options ops;
ops = new BitmapFactory.Options();
ops.inPurgeable = true; //means the system can recycle and reclaim the memory used by the bmp when the system has low memory
ops.inDensity = 0; //load the bitmap without scaling it to the screen density
ops.inDither = false; //don't dither (you only want dithering when you're working/converting between bitmaps/canvasses with different color depths (16bit to 8 bit etc)
ops.inScaled = false; //no scaling, related to some other settings in ops
ops.inPreferredConfig = Bitmap.Config.ARGB_8888; //load the bmp into a 32bit argb bitmap
ops.inJustDecodeBounds = false; //if true, you're just looking at the underlying bmp data, eg to see the height/width without loading the bmp into memory
//then load your bitmap like so:
Bitmap yourbitmap = BitmapFactory.decodeResource(getResources(), R.drawable.yourprettybmp, ops);
Now you can use the bitmap to draw onto all kinds of surfaces or load it into widgets.
Be warned, this is a non-mutable bitmap. If you want to change it's data (like you want to draw on it by making it the backing bmp of a canvas) you'll have to get a copy of the BMPFactory.decodeResouce bit by adding
Code:
.copy(Config.ARGB_8888, true);
to it.
For resizing the bmp, you can also do the following (which returns a mutable bmp, so you won't need the copy bit above):
Code:
yourresizedbmp = Bitmap.createScaledBitmap(yourbmp, width, height, true);
Of course, you can combine all this in one step (where "res" is a reference to getResources()):
Code:
yourresizedbmp = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(res, bgIDInt, ops), width, height, true);
One more thing to ensure quick drawing, lower memory usage etc is to define the window type of your activity to match the colour depth of your bitmaps. You can do that by adding the following to the onCreate of your activity:
Code:
getWindow().setFormat(PixelFormat.RGBA_8888);
And if you're also drawing to a surface canvas in a thread, you also set that:
Code:
mSurfaceHolder.setFormat(PixelFormat.RGBA_8888);
Anyway, the most important thing is the "ops" section. Hope you get it sorted!
PS: clean, minimal graphics can often be more easily gotten by just drawing things yourself on a canvas (extend the View object and override it's onDraw()). Just use a correctly setup and antialiased Paint to draw circles, lines and text on it and use the result.
Bitmaps are not generally used for graphics. Try to use PNG images, Google does so too.
I might be wrong, but from the OP it seems like you're using the same image size for all resolutions, use the Android Dpi Calculator to easily get the right dimensions for each screen resolution (and put the resized images respectively in /res/drawable-xhdi, hdpi, mdpi, ldpi...)
If you didn't do so, then it's definitely the problem as mdpi is the default behaviour of /res/drawable, so it will be awfully resized on your xhdpi Galaxy Nexus.
dealy663 said:
Hi
I built a simple clock app yesterday. It was surprisingly easy. One question I have though is how to make my images smooth (without jaggies). I drew my clock face and hands in photoshop. At first I did them at 300x300 pixels and the jaggies were so obnoxious I threw those images away. Then I did everything at 1000 x 1000 pixels and resized down to 300 when I was finished. This was much better, but still not as smooth as the clock in Jelly Bean. I notice that most of the graphics and fonts I see in Android are all very smooth. I've been testing the app on a Galaxy Nexus.
What is the secret to creating/displaying nice smooth images?
Thanks, Derek
Click to expand...
Click to collapse
Not sure if you've fixed this already but it's really easy. No code is required to remove jaggies, regardless of resolution. Assuming you're using Photoshop, choose save for web and devices, then select PNG-24 (not jpg or PNG-8) with transparency enabled. Initial resolutions of 200x200, 300x300 etc. are all fine; there's no need to create it at 1000x1000 and scale down if you need something smaller. Your graphics will look great.
One more tip - clock widgets fill a certain number of "squares" on the home screen grid, so just make sure that you determine the right number of dp pixels to cover the size you want (e.g., 2x2 or 2x4, or 3x3) and then specify it in xml. See the Android site for widget sizing.

Categories

Resources