1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#import "ui/base/cocoa/appkit_utils.h" 6 7#include "ui/base/resource/resource_bundle.h" 8 9namespace { 10 11// Gets an NSImage given an image id. 12NSImage* GetImage(int image_id) { 13 return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(image_id) 14 .ToNSImage(); 15} 16 17} // namespace 18 19namespace ui { 20 21void DrawNinePartImage(NSRect frame, 22 const NinePartImageIds& image_ids, 23 NSCompositingOperation operation, 24 CGFloat alpha, 25 BOOL flipped) { 26 NSDrawNinePartImage(frame, 27 GetImage(image_ids.top_left), 28 GetImage(image_ids.top), 29 GetImage(image_ids.top_right), 30 GetImage(image_ids.left), 31 GetImage(image_ids.center), 32 GetImage(image_ids.right), 33 GetImage(image_ids.bottom_left), 34 GetImage(image_ids.bottom), 35 GetImage(image_ids.bottom_right), 36 operation, 37 alpha, 38 flipped); 39} 40 41} // namespace ui 42