objective c - How to show in-memory NSImage as Retina (@2x)? -


I am showing dynamic-loaded images like under the image in NSMenuItem s.

I am loading and resizing as the image:

  [menuItem setImage: [self process image: [[NSImage alloc] url] ]]; [Add MenuEystem: MenuEmix];   

The process image function changes 88x88 px size. The image is displayed on 24x24 px (shown below) because it does not look like a retina pictures but if I put it at 48x48px it is not shown as small as 24x24, so NSMenuItem does not actually resizing.

However I have to show these images in 48x48 in the same points of view. Showing this as @ 2x I can not find a way to use the [NSMenuItem setImage:] method or save the file of NSImage without the 48x48 file and the file Name ending @ 2x .

If I use 48x48 image in the setImage: method, then the height of the NSMINIT is only twice as large and it actually indicates 48 digits * 48 digits.

Any ideas how can I get memory images in NSMenuItem without a file?

Just it should be enough to [image set size: NSMakeSize (24, 24)] < / Code> is more pixels than that image -setSize: sets its logical size in the digits The given representation in the image determines how many pixels it has if the pixel amplitude is greater than the point dimensions , Then there is more detail. This extension can be used if the drawing destination is also high-resolution.

If this does not work, you can make the image "manually", starting with the desired size, with the available description representing the bitmap image, the size of the delegation and the pixel dimension ( Separate), and add that representation to the image.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -